From 92480ffd265475a25070b8ea9dfbc8536d038378 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sun, 27 Sep 2009 17:48:53 -0400 Subject: * Introduce make targets btest (build tests), blas (build blas lib), demos (build demos). * remove EIGEN_BUILD_TESTS and siblings * add summary at the end of cmake run, hopefully not too verbose * fix build of quaternion demo * kill remnants of old binary library option --- CMakeLists.txt | 44 ++++++++++++------------- Eigen/src/Cholesky/CholeskyInstantiations.cpp | 35 -------------------- Eigen/src/Core/CMakeLists.txt | 9 +---- Eigen/src/Core/CoreInstantiations.cpp | 47 --------------------------- Eigen/src/QR/QrInstantiations.cpp | 38 ---------------------- blas/CMakeLists.txt | 2 ++ cmake/EigenTesting.cmake | 13 ++++---- demos/CMakeLists.txt | 10 ++++-- demos/mandelbrot/CMakeLists.txt | 1 + demos/mix_eigen_and_c/README | 4 ++- demos/opengl/CMakeLists.txt | 2 +- demos/opengl/camera.cpp | 2 +- test/CMakeLists.txt | 3 +- unsupported/CMakeLists.txt | 10 ++---- 14 files changed, 47 insertions(+), 173 deletions(-) delete mode 100644 Eigen/src/Cholesky/CholeskyInstantiations.cpp delete mode 100644 Eigen/src/Core/CoreInstantiations.cpp delete mode 100644 Eigen/src/QR/QrInstantiations.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 94b2e99d0..be76903e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,20 +33,11 @@ include(CheckCXXCompilerFlag) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -option(EIGEN_BUILD_TESTS "Build tests" OFF) -option(EIGEN_BUILD_DEMOS "Build demos" OFF) -if(NOT WIN32) - option(EIGEN_BUILD_LIB "Build the binary shared library" OFF) -endif(NOT WIN32) option(EIGEN_BUILD_BTL "Build benchmark suite" OFF) if(NOT WIN32) option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON) endif(NOT WIN32) -if(EIGEN_BUILD_LIB) - option(EIGEN_TEST_LIB "Build the unit tests using the library (disable -pedantic)" OFF) -endif(EIGEN_BUILD_LIB) - set(CMAKE_INCLUDE_CURRENT_DIR ON) if(CMAKE_COMPILER_IS_GNUCXX) @@ -129,27 +120,32 @@ endif(EIGEN_BUILD_PKGCONFIG) add_subdirectory(Eigen) -add_subdirectory(doc) +add_subdirectory(doc EXCLUDE_FROM_ALL) -if(EIGEN_BUILD_TESTS) - include(CTest) - add_subdirectory(test) -endif(EIGEN_BUILD_TESTS) +include(CTest) +enable_testing() # must be called from the root CMakeLists, see man page +add_subdirectory(test EXCLUDE_FROM_ALL) add_subdirectory(unsupported) -if(EIGEN_BUILD_DEMOS) - add_subdirectory(demos) -endif(EIGEN_BUILD_DEMOS) +add_subdirectory(demos EXCLUDE_FROM_ALL) -if(EIGEN_BUILD_BLAS) - add_subdirectory(blas) -endif(EIGEN_BUILD_BLAS) +add_subdirectory(blas EXCLUDE_FROM_ALL) +# TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"? if(EIGEN_BUILD_BTL) - add_subdirectory(bench/btl) + add_subdirectory(bench/btl EXCLUDE_FROM_ALL) endif(EIGEN_BUILD_BTL) -if(EIGEN_BUILD_TESTS) - ei_testing_print_summary() -endif(EIGEN_BUILD_TESTS) +ei_testing_print_summary() +message("You can now do the following:") +message("Command | Description") +message("-------------+------------------------------------------------------------------") +message("make install | Install Eigen to ${CMAKE_INSTALL_PREFIX}") +message(" | Do: cmake -DCMAKE_INSTALL_PREFIX=yourprefix . to change that") +message("make test | Build and run the unit tests (using CTest)") +message(" | Note: this takes lots of time & memory! Easy on the -j option!") +message("make btest | Only build tests, don't run them") +message("make doc | Generate the API documentation, requires Doxygen & LaTeX") +message("make blas | Build BLAS library") +message("-------------+------------------------------------------------------------------") diff --git a/Eigen/src/Cholesky/CholeskyInstantiations.cpp b/Eigen/src/Cholesky/CholeskyInstantiations.cpp deleted file mode 100644 index 92902f19b..000000000 --- a/Eigen/src/Cholesky/CholeskyInstantiations.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_EXTERN_INSTANTIATIONS -#define EIGEN_EXTERN_INSTANTIATIONS -#endif -#include "../../Core" -#undef EIGEN_EXTERN_INSTANTIATIONS - -#include "../../Cholesky" - -namespace Eigen { - EIGEN_CHOLESKY_MODULE_INSTANTIATE(); -} diff --git a/Eigen/src/Core/CMakeLists.txt b/Eigen/src/Core/CMakeLists.txt index a555be756..2346fc2bb 100644 --- a/Eigen/src/Core/CMakeLists.txt +++ b/Eigen/src/Core/CMakeLists.txt @@ -5,13 +5,6 @@ INSTALL(FILES DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel ) -FILE(GLOB Eigen_Core_Product_SRCS "products/*.h") - -INSTALL(FILES - ${Eigen_Core_Product_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel - ) - - +ADD_SUBDIRECTORY(products) ADD_SUBDIRECTORY(util) ADD_SUBDIRECTORY(arch) diff --git a/Eigen/src/Core/CoreInstantiations.cpp b/Eigen/src/Core/CoreInstantiations.cpp deleted file mode 100644 index 3c021a8db..000000000 --- a/Eigen/src/Core/CoreInstantiations.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifdef EIGEN_EXTERN_INSTANTIATIONS -#undef EIGEN_EXTERN_INSTANTIATIONS -#endif - -#include "../../Core" - -namespace Eigen -{ - -#define EIGEN_INSTANTIATE_PRODUCT(TYPE) \ -template static void ei_cache_friendly_product( \ - int _rows, int _cols, int depth, \ - bool _lhsRowMajor, const TYPE* _lhs, int _lhsStride, \ - bool _rhsRowMajor, const TYPE* _rhs, int _rhsStride, \ - bool resRowMajor, TYPE* res, int resStride) - -EIGEN_INSTANTIATE_PRODUCT(float); -EIGEN_INSTANTIATE_PRODUCT(double); -EIGEN_INSTANTIATE_PRODUCT(int); -EIGEN_INSTANTIATE_PRODUCT(std::complex); -EIGEN_INSTANTIATE_PRODUCT(std::complex); - -} diff --git a/Eigen/src/QR/QrInstantiations.cpp b/Eigen/src/QR/QrInstantiations.cpp deleted file mode 100644 index 695377d69..000000000 --- a/Eigen/src/QR/QrInstantiations.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_EXTERN_INSTANTIATIONS -#define EIGEN_EXTERN_INSTANTIATIONS -#endif -#include "../../Core" -#undef EIGEN_EXTERN_INSTANTIATIONS - -#include "../../QR" - -namespace Eigen -{ - -EIGEN_QR_MODULE_INSTANTIATE(); - -} diff --git a/blas/CMakeLists.txt b/blas/CMakeLists.txt index 477693bad..65ef77c90 100644 --- a/blas/CMakeLists.txt +++ b/blas/CMakeLists.txt @@ -1,7 +1,9 @@ +add_custom_target(blas) set(EigenBlas_SRCS single.cpp double.cpp complex_single.cpp complex_double.cpp) add_library(eigen_blas SHARED ${EigenBlas_SRCS}) +add_dependencies(blas eigen_blas) install(TARGETS eigen_blas RUNTIME DESTINATION bin diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake index 96049aa93..d4e0678f9 100644 --- a/cmake/EigenTesting.cmake +++ b/cmake/EigenTesting.cmake @@ -39,6 +39,7 @@ macro(ei_add_test testname) set(filename ${testname}.cpp) add_executable(${targetname} ${filename}) + add_dependencies(btest ${targetname}) if(NOT EIGEN_NO_ASSERTION_CHECKING) @@ -102,31 +103,31 @@ macro(ei_testing_print_summary) if(EIGEN_TEST_SSE2) message("SSE2: ON") else(EIGEN_TEST_SSE2) - message("SSE2: AUTO") + message("SSE2: Using architecture defaults") endif(EIGEN_TEST_SSE2) if(EIGEN_TEST_SSE3) message("SSE3: ON") else(EIGEN_TEST_SSE3) - message("SSE3: AUTO") + message("SSE3: Using architecture defaults") endif(EIGEN_TEST_SSE3) if(EIGEN_TEST_SSSE3) message("SSSE3: ON") else(EIGEN_TEST_SSSE3) - message("SSSE3: AUTO") + message("SSSE3: Using architecture defaults") endif(EIGEN_TEST_SSSE3) if(EIGEN_TEST_ALTIVEC) - message("Altivec: ON") + message("Altivec: Using architecture defaults") else(EIGEN_TEST_ALTIVEC) - message("Altivec: AUTO") + message("Altivec: Using architecture defaults") endif(EIGEN_TEST_ALTIVEC) if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION) message("Explicit vec: OFF") else(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION) - message("Explicit vec: AUTO") + message("Explicit vec: Using architecture defaults") endif(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION) message("\n${EIGEN_TESTING_SUMMARY}") diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index 4e8f5164f..1ec49d13e 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -1,3 +1,9 @@ +add_custom_target(demos) -add_subdirectory(mandelbrot) -add_subdirectory(opengl) +find_package(Qt4) +if(QT4_FOUND) + add_subdirectory(mandelbrot) + add_subdirectory(opengl) +else(QT4_FOUND) + message(STATUS "Qt4 not found, so disabling the mandelbrot and opengl demos") +endif(QT4_FOUND) diff --git a/demos/mandelbrot/CMakeLists.txt b/demos/mandelbrot/CMakeLists.txt index d34b60a54..5c500e064 100644 --- a/demos/mandelbrot/CMakeLists.txt +++ b/demos/mandelbrot/CMakeLists.txt @@ -16,5 +16,6 @@ set(mandelbrot_SRCS qt4_automoc(${mandelbrot_SRCS}) add_executable(mandelbrot ${mandelbrot_SRCS}) +add_dependencies(demos mandelbrot) target_link_libraries(mandelbrot ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) diff --git a/demos/mix_eigen_and_c/README b/demos/mix_eigen_and_c/README index d543f8d99..21dba8679 100644 --- a/demos/mix_eigen_and_c/README +++ b/demos/mix_eigen_and_c/README @@ -1,7 +1,9 @@ +This is an example of how one can wrap some of Eigen into a C library. + To try this with GCC, do: g++ -c binary_library.cpp -O2 -msse2 -I ../.. gcc example.c binary_library.o -o example -lstdc++ ./example -This is an example of how one can wrap some of Eigen into a C library. +TODO: add CMakeLists, add more explanations here \ No newline at end of file diff --git a/demos/opengl/CMakeLists.txt b/demos/opengl/CMakeLists.txt index 968ed6cb4..b98a30c01 100644 --- a/demos/opengl/CMakeLists.txt +++ b/demos/opengl/CMakeLists.txt @@ -1,4 +1,3 @@ - find_package(Qt4 REQUIRED) find_package(OpenGL REQUIRED) @@ -14,6 +13,7 @@ set(quaternion_demo_SRCS gpuhelper.cpp icosphere.cpp camera.cpp trackball.cpp q qt4_automoc(${quaternion_demo_SRCS}) add_executable(quaternion_demo ${quaternion_demo_SRCS}) +add_dependencies(demos quaternion_demo) target_link_libraries(quaternion_demo ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} diff --git a/demos/opengl/camera.cpp b/demos/opengl/camera.cpp index a785caf78..26598522e 100644 --- a/demos/opengl/camera.cpp +++ b/demos/opengl/camera.cpp @@ -260,7 +260,7 @@ void Camera::activateGL(void) Vector3f Camera::unProject(const Vector2f& uv, float depth) const { - Matrix4f inv = mViewMatrix.inverse(); + Matrix4f inv = mViewMatrix.inverse().matrix(); return unProject(uv, depth, inv); } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f3c15612f..19b832873 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,5 @@ - +add_custom_target(btest) include(EigenTesting) -enable_testing() ei_init_testing() find_package(GSL) diff --git a/unsupported/CMakeLists.txt b/unsupported/CMakeLists.txt index 895fcdbed..7104085a3 100644 --- a/unsupported/CMakeLists.txt +++ b/unsupported/CMakeLists.txt @@ -1,9 +1,3 @@ - add_subdirectory(Eigen) - -add_subdirectory(doc) - -if(EIGEN_BUILD_TESTS) - add_subdirectory(test) -endif(EIGEN_BUILD_TESTS) - +add_subdirectory(doc EXCLUDE_FROM_ALL) +add_subdirectory(test EXCLUDE_FROM_ALL) -- cgit v1.2.3