2007-09-05 18:42:15 +08:00
|
|
|
IF(BUILD_TESTS)
|
|
|
|
|
2008-08-19 19:06:40 +08:00
|
|
|
|
2008-05-28 12:38:16 +08:00
|
|
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
IF(CMAKE_SYSTEM_NAME MATCHES Linux)
|
2008-08-04 12:45:59 +08:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g2")
|
2008-06-14 21:02:41 +08:00
|
|
|
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g2")
|
|
|
|
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-inline-functions")
|
2008-06-15 16:33:44 +08:00
|
|
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g2")
|
2008-05-28 12:38:16 +08:00
|
|
|
ENDIF(CMAKE_SYSTEM_NAME MATCHES Linux)
|
2008-08-19 19:06:40 +08:00
|
|
|
SET(EI_OFLAG "-O2")
|
|
|
|
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
SET(EI_OFLAG "")
|
2008-05-28 12:38:16 +08:00
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
|
2008-03-09 03:02:24 +08:00
|
|
|
OPTION(EIGEN_NO_ASSERTION_CHECKING "Disable checking of assertions" OFF)
|
|
|
|
|
2008-06-22 23:02:05 +08:00
|
|
|
# similar to SET_TARGET_PROPERTIES but append the property instead of overwriting it
|
2008-05-22 20:18:55 +08:00
|
|
|
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)
|
|
|
|
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
MACRO(EI_ADD_TEST testname)
|
|
|
|
|
|
|
|
SET(targetname test_${testname})
|
|
|
|
|
2008-08-19 19:06:40 +08:00
|
|
|
SET(filename ${testname}.cpp)
|
2008-08-02 07:44:59 +08:00
|
|
|
ADD_EXECUTABLE(${targetname} ${filename})
|
2008-05-22 20:18:55 +08:00
|
|
|
|
|
|
|
IF(NOT EIGEN_NO_ASSERTION_CHECKING)
|
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES(${targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
|
|
|
|
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)
|
|
|
|
|
|
|
|
ELSE(NOT EIGEN_NO_ASSERTION_CHECKING)
|
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES(${targetname} PROPERTIES COMPILE_DEFINITIONS "-DEIGEN_NO_ASSERTION_CHECKING=1")
|
|
|
|
|
|
|
|
ENDIF(NOT EIGEN_NO_ASSERTION_CHECKING)
|
|
|
|
|
2008-08-09 23:23:54 +08:00
|
|
|
IF(${ARGC} GREATER 1)
|
|
|
|
EI_ADD_TARGET_PROPERTY(${targetname} COMPILE_FLAGS "${ARGV1}")
|
|
|
|
ENDIF(${ARGC} GREATER 1)
|
|
|
|
|
2008-05-22 20:18:55 +08:00
|
|
|
EI_ADD_TARGET_PROPERTY(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
|
|
|
|
|
2008-06-14 21:02:41 +08:00
|
|
|
IF(TEST_LIB)
|
|
|
|
target_link_libraries(${targetname} Eigen2)
|
|
|
|
ENDIF(TEST_LIB)
|
2008-06-01 07:21:49 +08:00
|
|
|
|
2008-05-22 20:18:55 +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)
|
|
|
|
|
|
|
|
|
2007-09-05 18:42:15 +08:00
|
|
|
ENABLE_TESTING()
|
2008-05-22 20:18:55 +08:00
|
|
|
|
2008-06-14 21:02:41 +08:00
|
|
|
IF(TEST_LIB)
|
|
|
|
ADD_DEFINITIONS("-DEIGEN_EXTERN_INSTANTIATIONS=1")
|
|
|
|
ENDIF(TEST_LIB)
|
2008-06-01 07:21:49 +08:00
|
|
|
|
2008-06-02 22:54:52 +08:00
|
|
|
EI_ADD_TEST(sizeof)
|
|
|
|
EI_ADD_TEST(nomalloc)
|
2008-08-21 04:08:38 +08:00
|
|
|
EI_ADD_TEST(packetmath)
|
2008-05-22 20:18:55 +08:00
|
|
|
EI_ADD_TEST(basicstuff)
|
2008-05-28 12:38:16 +08:00
|
|
|
EI_ADD_TEST(linearstructure)
|
|
|
|
EI_ADD_TEST(cwiseop)
|
2008-08-21 00:43:28 +08:00
|
|
|
EI_ADD_TEST(sum)
|
2008-08-02 07:44:59 +08:00
|
|
|
EI_ADD_TEST(product_small)
|
2008-08-19 19:06:40 +08:00
|
|
|
EI_ADD_TEST(product_large ${EI_OFLAG})
|
2008-05-22 20:18:55 +08:00
|
|
|
EI_ADD_TEST(adjoint)
|
|
|
|
EI_ADD_TEST(submatrices)
|
2008-05-28 12:38:16 +08:00
|
|
|
EI_ADD_TEST(miscmatrices)
|
2008-08-21 04:08:38 +08:00
|
|
|
EI_ADD_TEST(commainitializer)
|
2008-05-22 20:18:55 +08:00
|
|
|
EI_ADD_TEST(smallvectors)
|
|
|
|
EI_ADD_TEST(map)
|
2008-06-20 20:38:03 +08:00
|
|
|
EI_ADD_TEST(array)
|
2008-05-22 20:18:55 +08:00
|
|
|
EI_ADD_TEST(triangular)
|
|
|
|
EI_ADD_TEST(cholesky)
|
2008-08-19 19:06:40 +08:00
|
|
|
EI_ADD_TEST(lu ${EI_OFLAG})
|
2008-08-04 12:45:59 +08:00
|
|
|
EI_ADD_TEST(determinant)
|
2008-06-01 07:44:11 +08:00
|
|
|
EI_ADD_TEST(inverse)
|
2008-05-27 17:16:27 +08:00
|
|
|
EI_ADD_TEST(qr)
|
|
|
|
EI_ADD_TEST(eigensolver)
|
2008-06-03 15:32:12 +08:00
|
|
|
EI_ADD_TEST(geometry)
|
2008-08-11 10:25:40 +08:00
|
|
|
EI_ADD_TEST(regression)
|
2008-08-20 01:52:04 +08:00
|
|
|
EI_ADD_TEST(svd)
|
2008-08-21 21:17:21 +08:00
|
|
|
EI_ADD_TEST(ioformat)
|
2007-09-05 18:42:15 +08:00
|
|
|
|
|
|
|
ENDIF(BUILD_TESTS)
|