mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
add debug targets like debug_qr to build a specific test with debug info
remove the btest target, instead just do "make" since anyway we have to let "make" build the tests
This commit is contained in:
parent
3e4cb08054
commit
a1d9b76dd5
@ -146,10 +146,13 @@ message("Command | Description")
|
|||||||
message("-------------+-----------------------------------------------------------------")
|
message("-------------+-----------------------------------------------------------------")
|
||||||
message("make install | Install to ${CMAKE_INSTALL_PREFIX}")
|
message("make install | Install to ${CMAKE_INSTALL_PREFIX}")
|
||||||
message(" | To change that, do: cmake . -DCMAKE_INSTALL_PREFIX=yourpath")
|
message(" | To change that, do: cmake . -DCMAKE_INSTALL_PREFIX=yourpath")
|
||||||
message("make doc | Generate the API documentation, requires Doxygen & LaTeX")
|
message("make | Build the unit tests")
|
||||||
message("make btest | Build the unit tests (doesn't run them)")
|
message(" | Note: that's NOT needed if you just want to install Eigen!")
|
||||||
message(" | Note: this takes lots of time & memory! Easy on the -j option!")
|
message(" | Note: this takes lots of time & memory! Easy on the -j option!")
|
||||||
message("make test | Build and run the unit tests (using CTest)")
|
message("make test | Build and run the unit tests (using CTest)")
|
||||||
message("make test_qr | Build a specific test, here test_qr. To run it: test/test_qr")
|
message("make test_qr | Build a specific test, here test_qr. To run it: test/test_qr")
|
||||||
|
message("make debug_qr| Build a test with full debug info. To run it: test/debug_qr")
|
||||||
message("make blas | Build BLAS library")
|
message("make blas | Build BLAS library")
|
||||||
|
message("make doc | Generate the API documentation, requires Doxygen & LaTeX")
|
||||||
message("-------------+-----------------------------------------------------------------")
|
message("-------------+-----------------------------------------------------------------")
|
||||||
|
|
||||||
|
@ -27,7 +27,11 @@ endmacro(ei_add_property)
|
|||||||
# void test_<testname>() { ... }
|
# void test_<testname>() { ... }
|
||||||
#
|
#
|
||||||
# this macro add an executable test_<testname> as well as a ctest test
|
# this macro add an executable test_<testname> as well as a ctest test
|
||||||
# named <testname>
|
# named <testname>.
|
||||||
|
#
|
||||||
|
# it also adds another executable debug_<testname> that compiles in full debug mode
|
||||||
|
# and is not added to the test target. The idea is that when a test fails you want
|
||||||
|
# a quick way of rebuilding this specific test in full debug mode.
|
||||||
#
|
#
|
||||||
# On platforms with bash simply run:
|
# On platforms with bash simply run:
|
||||||
# "ctest -V" or "ctest -V -R <testname>"
|
# "ctest -V" or "ctest -V -R <testname>"
|
||||||
@ -36,39 +40,50 @@ endmacro(ei_add_property)
|
|||||||
macro(ei_add_test testname)
|
macro(ei_add_test testname)
|
||||||
|
|
||||||
set(targetname test_${testname})
|
set(targetname test_${testname})
|
||||||
|
set(debug_targetname debug_${testname})
|
||||||
|
|
||||||
set(filename ${testname}.cpp)
|
set(filename ${testname}.cpp)
|
||||||
add_executable(${targetname} ${filename})
|
add_executable(${targetname} ${filename})
|
||||||
add_dependencies(btest ${targetname})
|
add_executable(${debug_targetname} ${filename})
|
||||||
|
|
||||||
if(NOT EIGEN_NO_ASSERTION_CHECKING)
|
if(NOT EIGEN_NO_ASSERTION_CHECKING)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "/EHsc")
|
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "/EHsc")
|
||||||
|
set_target_properties(${debug_targetname} PROPERTIES COMPILE_FLAGS "/EHsc")
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
|
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
|
||||||
|
set_target_properties(${debug_targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
option(EIGEN_DEBUG_ASSERTS "Enable debuging of assertions" OFF)
|
option(EIGEN_DEBUG_ASSERTS "Enable debuging of assertions" OFF)
|
||||||
if(EIGEN_DEBUG_ASSERTS)
|
if(EIGEN_DEBUG_ASSERTS)
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")
|
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")
|
||||||
|
ei_add_target_property(${debug_targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")
|
||||||
endif(EIGEN_DEBUG_ASSERTS)
|
endif(EIGEN_DEBUG_ASSERTS)
|
||||||
|
|
||||||
else(NOT EIGEN_NO_ASSERTION_CHECKING)
|
else(NOT EIGEN_NO_ASSERTION_CHECKING)
|
||||||
|
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")
|
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")
|
||||||
|
ei_add_target_property(${debug_targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")
|
||||||
|
|
||||||
endif(NOT EIGEN_NO_ASSERTION_CHECKING)
|
endif(NOT EIGEN_NO_ASSERTION_CHECKING)
|
||||||
|
|
||||||
|
# let the user pass e.g. optimization flags, but don't apply them to the debug target
|
||||||
if(${ARGC} GREATER 1)
|
if(${ARGC} GREATER 1)
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV1}")
|
ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV1}")
|
||||||
endif(${ARGC} GREATER 1)
|
endif(${ARGC} GREATER 1)
|
||||||
|
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
|
# for the debug target, add full debug options
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
# O0 is in principle redundant here, but doesn't hurt
|
||||||
|
ei_add_target_property(${debug_targetname} COMPILE_FLAGS "-O0 -g3")
|
||||||
|
elseif(MSVC)
|
||||||
|
ei_add_target_property(${debug_targetname} COMPILE_FLAGS "/Od /Zi")
|
||||||
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
|
||||||
if(TEST_LIB)
|
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
|
||||||
target_link_libraries(${targetname} Eigen2)
|
ei_add_target_property(${debug_targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
|
||||||
endif(TEST_LIB)
|
|
||||||
|
|
||||||
target_link_libraries(${targetname} ${EXTERNAL_LIBS})
|
target_link_libraries(${targetname} ${EXTERNAL_LIBS})
|
||||||
if(${ARGC} GREATER 2)
|
if(${ARGC} GREATER 2)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
project(EigenTesting)
|
project(EigenTesting)
|
||||||
|
|
||||||
add_custom_target(btest)
|
|
||||||
include(EigenTesting)
|
include(EigenTesting)
|
||||||
ei_init_testing()
|
ei_init_testing()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user