2008-10-20 18:43:11 +08:00
|
|
|
|
2008-08-23 23:14:20 +08:00
|
|
|
find_package(GSL)
|
|
|
|
if(GSL_FOUND)
|
|
|
|
add_definitions("-DHAS_GSL")
|
2008-12-18 01:50:43 +08:00
|
|
|
else(GSL_FOUND)
|
|
|
|
set(GSL_LIBRARIES " ")
|
2008-08-23 23:14:20 +08:00
|
|
|
endif(GSL_FOUND)
|
2008-08-19 19:06:40 +08:00
|
|
|
|
2008-10-27 05:38:30 +08:00
|
|
|
set(SPARSE_LIBS "")
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_TESTED_BACKENDS "")
|
|
|
|
set(EIGEN_MISSING_BACKENDS "")
|
2008-10-27 05:38:30 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
find_package(Taucs)
|
|
|
|
if(TAUCS_FOUND)
|
|
|
|
add_definitions("-DEIGEN_TAUCS_SUPPORT")
|
|
|
|
include_directories(${TAUCS_INCLUDES})
|
2008-10-27 05:38:30 +08:00
|
|
|
set(SPARSE_LIBS ${SPARSE_LIBS} ${TAUCS_LIBRARIES})
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_TESTED_BACKENDS ${EIGEN_TESTED_BACKENDS} Taucs)
|
2008-10-21 21:35:04 +08:00
|
|
|
else(TAUCS_FOUND)
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_MISSING_BACKENDS ${EIGEN_MISSING_BACKENDS} Taucs)
|
2008-10-20 18:43:11 +08:00
|
|
|
endif(TAUCS_FOUND)
|
|
|
|
|
|
|
|
find_package(Cholmod)
|
|
|
|
if(CHOLMOD_FOUND)
|
|
|
|
add_definitions("-DEIGEN_CHOLMOD_SUPPORT")
|
|
|
|
include_directories(${CHOLMOD_INCLUDES})
|
2008-10-27 05:38:30 +08:00
|
|
|
set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES})
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_TESTED_BACKENDS ${EIGEN_TESTED_BACKENDS} Cholmod)
|
2008-10-21 21:35:04 +08:00
|
|
|
else(CHOLMOD_FOUND)
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_MISSING_BACKENDS ${EIGEN_MISSING_BACKENDS} Cholmod)
|
2008-10-20 18:43:11 +08:00
|
|
|
endif(CHOLMOD_FOUND)
|
|
|
|
|
2009-01-12 20:51:40 +08:00
|
|
|
option(EIGEN_TEST_NO_FORTRAN "Disable Fortran" OFF)
|
|
|
|
if(NOT MSVC AND NOT EIGEN_TEST_NO_FORTRAN)
|
2009-01-05 22:40:27 +08:00
|
|
|
enable_language(Fortran OPTIONAL)
|
2009-01-12 20:51:40 +08:00
|
|
|
endif(NOT MSVC AND NOT EIGEN_TEST_NO_FORTRAN)
|
2008-12-18 01:50:43 +08:00
|
|
|
|
2008-10-20 19:37:45 +08:00
|
|
|
find_package(Umfpack)
|
|
|
|
if(UMFPACK_FOUND)
|
|
|
|
add_definitions("-DEIGEN_UMFPACK_SUPPORT")
|
|
|
|
include_directories(${UMFPACK_INCLUDES})
|
2008-10-27 05:38:30 +08:00
|
|
|
set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES})
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_TESTED_BACKENDS ${EIGEN_TESTED_BACKENDS} UmfPack)
|
2008-10-21 21:35:04 +08:00
|
|
|
else(UMFPACK_FOUND)
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_MISSING_BACKENDS ${EIGEN_MISSING_BACKENDS} UmfPack)
|
2008-10-20 19:37:45 +08:00
|
|
|
endif(UMFPACK_FOUND)
|
|
|
|
|
|
|
|
find_package(SuperLU)
|
|
|
|
if(SUPERLU_FOUND)
|
|
|
|
add_definitions("-DEIGEN_SUPERLU_SUPPORT")
|
|
|
|
include_directories(${SUPERLU_INCLUDES})
|
2008-10-27 05:38:30 +08:00
|
|
|
set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES})
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_TESTED_BACKENDS ${EIGEN_TESTED_BACKENDS} SuperLU)
|
2008-10-21 21:35:04 +08:00
|
|
|
else(SUPERLU_FOUND)
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_MISSING_BACKENDS ${EIGEN_MISSING_BACKENDS} SuperLU)
|
2008-10-20 19:37:45 +08:00
|
|
|
endif(SUPERLU_FOUND)
|
2008-10-20 18:43:11 +08:00
|
|
|
|
2008-10-21 21:35:04 +08:00
|
|
|
find_package(GoogleHash)
|
|
|
|
if(GOOGLEHASH_FOUND)
|
|
|
|
add_definitions("-DEIGEN_GOOGLEHASH_SUPPORT")
|
|
|
|
include_directories(${GOOGLEHASH_INCLUDES})
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_TESTED_BACKENDS ${EIGEN_TESTED_BACKENDS} GoogleHash)
|
2008-10-21 21:35:04 +08:00
|
|
|
else(GOOGLEHASH_FOUND)
|
2009-01-12 21:40:02 +08:00
|
|
|
set(EIGEN_MISSING_BACKENDS ${EIGEN_MISSING_BACKENDS} GoogleHash)
|
2008-10-21 21:35:04 +08:00
|
|
|
endif(GOOGLEHASH_FOUND)
|
|
|
|
|
2009-01-21 00:50:47 +08:00
|
|
|
find_package(Qt4)
|
|
|
|
if(QT4_FOUND)
|
|
|
|
include(${QT_USE_FILE})
|
|
|
|
set(EIGEN_TESTED_BACKENDS ${EIGEN_TESTED_BACKENDS} "Qt4 support")
|
|
|
|
else(QT4_FOUND)
|
|
|
|
set(EIGEN_MISSING_BACKENDS ${EIGEN_MISSING_BACKENDS} "Qt4 support")
|
|
|
|
endif(QT4_FOUND)
|
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES Linux)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g2")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g2")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-inline-functions")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g2")
|
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES Linux)
|
|
|
|
set(EI_OFLAG "-O2")
|
|
|
|
else(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(EI_OFLAG "")
|
|
|
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
|
|
|
|
option(EIGEN_NO_ASSERTION_CHECKING "Disable checking of assertions" OFF)
|
|
|
|
|
|
|
|
# similar to set_target_properties but append the property instead of overwriting it
|
|
|
|
macro(ei_add_target_property target prop value)
|
|
|
|
|
|
|
|
get_target_property(previous ${target} ${prop})
|
|
|
|
set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}")
|
|
|
|
|
|
|
|
endmacro(ei_add_target_property)
|
2008-05-22 20:18:55 +08:00
|
|
|
|
|
|
|
# Macro to add a test
|
|
|
|
#
|
|
|
|
# the unique parameter testname must correspond to a file
|
|
|
|
# <testname>.cpp which follows this pattern:
|
|
|
|
#
|
|
|
|
# #include "main.h"
|
|
|
|
# void test_<testname>() { ... }
|
|
|
|
#
|
|
|
|
# this macro add an executable test_<testname> as well as a ctest test
|
|
|
|
# named <testname>
|
|
|
|
#
|
|
|
|
# On platforms with bash simply run:
|
|
|
|
# "ctest -V" or "ctest -V -R <testname>"
|
|
|
|
# On other platform use ctest as usual
|
|
|
|
#
|
2008-10-20 18:43:11 +08:00
|
|
|
macro(ei_add_test testname)
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
set(targetname test_${testname})
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
set(filename ${testname}.cpp)
|
|
|
|
add_executable(${targetname} ${filename})
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
if(NOT EIGEN_NO_ASSERTION_CHECKING)
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-12-18 02:37:04 +08:00
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "/EHsc")
|
|
|
|
else(MSVC)
|
|
|
|
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
|
|
|
|
endif(MSVC)
|
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
option(EIGEN_DEBUG_ASSERTS "Enable debuging of assertions" OFF)
|
|
|
|
if(EIGEN_DEBUG_ASSERTS)
|
|
|
|
set_target_properties(${targetname} PROPERTIES COMPILE_DEFINITIONS "-DEIGEN_DEBUG_ASSERTS=1")
|
|
|
|
endif(EIGEN_DEBUG_ASSERTS)
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
else(NOT EIGEN_NO_ASSERTION_CHECKING)
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
set_target_properties(${targetname} PROPERTIES COMPILE_DEFINITIONS "-DEIGEN_NO_ASSERTION_CHECKING=1")
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
endif(NOT EIGEN_NO_ASSERTION_CHECKING)
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
if(${ARGC} GREATER 1)
|
|
|
|
ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV1}")
|
|
|
|
endif(${ARGC} GREATER 1)
|
2008-08-09 23:23:54 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-10-20 18:43:11 +08:00
|
|
|
if(TEST_LIB)
|
2008-06-14 21:02:41 +08:00
|
|
|
target_link_libraries(${targetname} Eigen2)
|
2008-10-20 18:43:11 +08:00
|
|
|
endif(TEST_LIB)
|
|
|
|
|
|
|
|
target_link_libraries(${targetname} ${EXTERNAL_LIBS})
|
2008-10-27 05:38:30 +08:00
|
|
|
if(${ARGC} GREATER 2)
|
2008-12-20 21:36:12 +08:00
|
|
|
string(STRIP "${ARGV2}" ARGV2_stripped)
|
|
|
|
string(LENGTH "${ARGV2_stripped}" ARGV2_stripped_length)
|
|
|
|
if(${ARGV2_stripped_length} GREATER 0)
|
2008-12-20 09:13:38 +08:00
|
|
|
target_link_libraries(${targetname} ${ARGV2})
|
2008-12-20 21:36:12 +08:00
|
|
|
endif(${ARGV2_stripped_length} GREATER 0)
|
2008-10-27 05:38:30 +08:00
|
|
|
endif(${ARGC} GREATER 2)
|
2008-10-20 18:43:11 +08:00
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
add_test(${testname} "${targetname}")
|
|
|
|
else(WIN32)
|
|
|
|
add_test(${testname} "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${testname}")
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
endmacro(ei_add_test)
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
if(TEST_LIB)
|
|
|
|
add_definitions("-DEIGEN_EXTERN_INSTANTIATIONS=1")
|
|
|
|
endif(TEST_LIB)
|
|
|
|
|
|
|
|
ei_add_test(meta)
|
|
|
|
ei_add_test(sizeof)
|
|
|
|
ei_add_test(dynalloc)
|
|
|
|
ei_add_test(nomalloc)
|
2008-12-23 03:17:44 +08:00
|
|
|
ei_add_test(mixingtypes)
|
2008-10-20 18:43:11 +08:00
|
|
|
ei_add_test(packetmath)
|
2008-12-31 08:05:22 +08:00
|
|
|
ei_add_test(unalignedassert)
|
2009-01-08 06:20:03 +08:00
|
|
|
ei_add_test(vectorization_logic)
|
2008-10-20 18:43:11 +08:00
|
|
|
ei_add_test(basicstuff)
|
|
|
|
ei_add_test(linearstructure)
|
|
|
|
ei_add_test(cwiseop)
|
|
|
|
ei_add_test(sum)
|
|
|
|
ei_add_test(product_small)
|
|
|
|
ei_add_test(product_large ${EI_OFLAG})
|
|
|
|
ei_add_test(adjoint)
|
|
|
|
ei_add_test(submatrices)
|
|
|
|
ei_add_test(miscmatrices)
|
|
|
|
ei_add_test(commainitializer)
|
|
|
|
ei_add_test(smallvectors)
|
|
|
|
ei_add_test(map)
|
|
|
|
ei_add_test(array)
|
|
|
|
ei_add_test(triangular)
|
2008-11-05 21:47:55 +08:00
|
|
|
ei_add_test(cholesky " " "${GSL_LIBRARIES}")
|
2008-10-20 18:43:11 +08:00
|
|
|
ei_add_test(lu ${EI_OFLAG})
|
|
|
|
ei_add_test(determinant)
|
|
|
|
ei_add_test(inverse)
|
|
|
|
ei_add_test(qr)
|
2008-11-05 21:47:55 +08:00
|
|
|
ei_add_test(eigensolver " " "${GSL_LIBRARIES}")
|
2008-10-20 18:43:11 +08:00
|
|
|
ei_add_test(svd)
|
|
|
|
ei_add_test(geometry)
|
|
|
|
ei_add_test(hyperplane)
|
|
|
|
ei_add_test(parametrizedline)
|
2008-10-26 23:04:31 +08:00
|
|
|
ei_add_test(alignedbox)
|
2008-10-20 18:43:11 +08:00
|
|
|
ei_add_test(regression)
|
2009-01-10 07:26:45 +08:00
|
|
|
ei_add_test(stdvector)
|
2009-01-21 00:50:47 +08:00
|
|
|
if(QT4_FOUND)
|
|
|
|
ei_add_test(qtvector " " ${QT_QTCORE_LIBRARY})
|
|
|
|
endif(QT4_FOUND)
|
2009-01-12 05:59:04 +08:00
|
|
|
ei_add_test(sparse_vector)
|
2009-01-14 22:24:10 +08:00
|
|
|
ei_add_test(sparse_basic)
|
2008-11-05 21:47:55 +08:00
|
|
|
ei_add_test(sparse_solvers " " "${SPARSE_LIBS}")
|
2009-01-12 21:40:02 +08:00
|
|
|
|
|
|
|
# print a summary of the different options
|
|
|
|
message("************************************************************")
|
|
|
|
message("*** Eigen's unit tests configuration summary ***")
|
|
|
|
message("************************************************************")
|
|
|
|
if(GSL_FOUND)
|
|
|
|
message("Comparison with GSL: ON")
|
|
|
|
else(GSL_FOUND)
|
|
|
|
message("Comparison with GSL: OFF")
|
|
|
|
endif(GSL_FOUND)
|
|
|
|
|
|
|
|
message("Enabled backends: ${EIGEN_TESTED_BACKENDS}")
|
|
|
|
message("Disabled backends: ${EIGEN_MISSING_BACKENDS}")
|
|
|
|
|
|
|
|
if(EIGEN_TEST_SSE2)
|
|
|
|
message("SSE2: ON")
|
|
|
|
else(EIGEN_TEST_SSE2)
|
|
|
|
message("SSE2: AUTO")
|
|
|
|
endif(EIGEN_TEST_SSE2)
|
|
|
|
|
|
|
|
if(EIGEN_TEST_SSE3)
|
|
|
|
message("SSE3: ON")
|
|
|
|
else(EIGEN_TEST_SSE3)
|
|
|
|
message("SSE3: AUTO")
|
|
|
|
endif(EIGEN_TEST_SSE3)
|
|
|
|
|
|
|
|
if(EIGEN_TEST_SSSE3)
|
|
|
|
message("SSSE3: ON")
|
|
|
|
else(EIGEN_TEST_SSSE3)
|
|
|
|
message("SSSE3: AUTO")
|
|
|
|
endif(EIGEN_TEST_SSSE3)
|
|
|
|
|
|
|
|
if(EIGEN_TEST_ALTIVEC)
|
|
|
|
message("Altivec: ON")
|
|
|
|
else(EIGEN_TEST_ALTIVEC)
|
|
|
|
message("Altivec: AUTO")
|
|
|
|
endif(EIGEN_TEST_ALTIVEC)
|
|
|
|
|
|
|
|
if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
|
|
|
|
message("Explicit vec: OFF")
|
|
|
|
else(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
|
|
|
|
message("Explicit vec: AUTO")
|
|
|
|
endif(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
|
|
|
|
|
|
|
|
message("CXX: ${CMAKE_CXX_COMPILER}")
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version COMMAND head -n 1 OUTPUT_VARIABLE EIGEN_CXX_VERSION_STRING OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
message("CXX_VERSION: ${EIGEN_CXX_VERSION_STRING}")
|
|
|
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
message("CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
|
|
|
message("Sparse lib flags: ${SPARSE_LIBS}")
|
|
|
|
|
|
|
|
message("************************************************************")
|