diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a23479d7..a7d4089c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,18 +3,18 @@ project(Eigen) cmake_minimum_required(VERSION 2.6.2) if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.") + message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. (you may need to remove CMakeCache.txt ") endif() # automatically parse the version number -file(READ "${CMAKE_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header) -string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen2_world_version_match "${_eigen2_version_header}") -set(EIGEN2_WORLD_VERSION "${CMAKE_MATCH_1}") -string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen2_major_version_match "${_eigen2_version_header}") -set(EIGEN2_MAJOR_VERSION "${CMAKE_MATCH_1}") -string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen2_minor_version_match "${_eigen2_version_header}") -set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}") -set(EIGEN_VERSION_NUMBER ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION}) +file(READ "${CMAKE_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header) +string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}") +set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}") +string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}") +set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}") +string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}") +set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") +set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) # if the mercurial program is absent, this will leave the EIGEN_HG_CHANGESET string empty, # but won't stop CMake. @@ -63,31 +63,43 @@ if(CMAKE_COMPILER_IS_GNUCXX) if(NOT EIGEN_TEST_LIB) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") - endif(NOT EIGEN_TEST_LIB) + endif() option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) if(EIGEN_TEST_SSE2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") message("Enabling SSE2 in tests/examples") - endif(EIGEN_TEST_SSE2) + endif() option(EIGEN_TEST_SSE3 "Enable/Disable SSE3 in tests/examples" OFF) if(EIGEN_TEST_SSE3) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") message("Enabling SSE3 in tests/examples") - endif(EIGEN_TEST_SSE3) + endif() option(EIGEN_TEST_SSSE3 "Enable/Disable SSSE3 in tests/examples" OFF) if(EIGEN_TEST_SSSE3) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3") message("Enabling SSSE3 in tests/examples") - endif(EIGEN_TEST_SSSE3) + endif() + + option(EIGEN_TEST_SSE4_1 "Enable/Disable SSE4.1 in tests/examples" OFF) + if(EIGEN_TEST_SSE4_1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") + message("Enabling SSE4.1 in tests/examples") + endif() + + option(EIGEN_TEST_SSE4_2 "Enable/Disable SSE4.2 in tests/examples" OFF) + if(EIGEN_TEST_SSE4_2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2") + message("Enabling SSE4.2 in tests/examples") + endif() option(EIGEN_TEST_ALTIVEC "Enable/Disable altivec in tests/examples" OFF) if(EIGEN_TEST_ALTIVEC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec") message("Enabling AltiVec in tests/examples") - endif(EIGEN_TEST_ALTIVEC) + endif() endif(CMAKE_SYSTEM_NAME MATCHES Linux) endif(CMAKE_COMPILER_IS_GNUCXX) @@ -112,19 +124,25 @@ endif(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION) option(EIGEN_TEST_C++0x "Enables all C++0x features." OFF) -option(EIGEN_TEST_RVALUE_REF_SUPPORT "Enable rvalue references for unit tests." OFF) +option(EIGEN_TEST_MAX_WARNING_LEVEL "Sets the warning level to /Wall while building the unit tests." OFF) +mark_as_advanced(EIGEN_TEST_MAX_WARNING_LEVEL) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) set(INCLUDE_INSTALL_DIR - "${CMAKE_INSTALL_PREFIX}/include/eigen2" + "${CMAKE_INSTALL_PREFIX}/include/eigen3" CACHE PATH "The directory where we install the header files" ) +install(FILES + signature_of_eigen3_matrix_library + DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel + ) + if(EIGEN_BUILD_PKGCONFIG) - configure_file(eigen2.pc.in eigen2.pc) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen2.pc + configure_file(eigen3.pc.in eigen3.pc) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc DESTINATION share/pkgconfig ) endif(EIGEN_BUILD_PKGCONFIG) @@ -135,6 +153,9 @@ add_subdirectory(doc EXCLUDE_FROM_ALL) include(CTest) enable_testing() # must be called from the root CMakeLists, see man page +include(EigenTesting) +ei_init_testing() + if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest else() @@ -147,6 +168,7 @@ add_subdirectory(demos EXCLUDE_FROM_ALL) add_subdirectory(blas EXCLUDE_FROM_ALL) +# must be after test and unsupported, for configuring buildtests.in add_subdirectory(scripts EXCLUDE_FROM_ALL) # TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"? |