2011-11-04 00:37:25 +08:00
2009-02-28 00:19:13 +08:00
macro ( ei_add_property prop value )
2016-11-09 01:08:02 +08:00
get_property ( previous GLOBAL PROPERTY ${ prop } )
2011-11-12 17:54:16 +08:00
if ( ( NOT previous ) OR ( previous STREQUAL "" ) )
2011-02-20 18:54:07 +08:00
set_property ( GLOBAL PROPERTY ${ prop } "${value}" )
else ( )
set_property ( GLOBAL PROPERTY ${ prop } "${previous} ${value}" )
2016-11-09 01:08:02 +08:00
endif ( )
2019-11-01 00:36:27 +08:00
endmacro ( )
2009-02-28 00:19:13 +08:00
2009-10-20 01:29:00 +08:00
#internal. See documentation of ei_add_test for details.
macro ( ei_add_test_internal testname testname_with_suffix )
2009-12-03 01:07:47 +08:00
set ( targetname ${ testname_with_suffix } )
2016-11-09 01:08:02 +08:00
2013-11-05 22:41:45 +08:00
if ( EIGEN_ADD_TEST_FILENAME_EXTENSION )
set ( filename ${ testname } . ${ EIGEN_ADD_TEST_FILENAME_EXTENSION } )
else ( )
set ( filename ${ testname } .cpp )
endif ( )
2016-11-09 01:08:02 +08:00
2021-04-01 06:09:00 +08:00
# Add the current target to the list of subtest targets
get_property ( EIGEN_SUBTESTS_LIST GLOBAL PROPERTY EIGEN_SUBTESTS_LIST )
set ( EIGEN_SUBTESTS_LIST "${EIGEN_SUBTESTS_LIST}${targetname}\n" )
set_property ( GLOBAL PROPERTY EIGEN_SUBTESTS_LIST "${EIGEN_SUBTESTS_LIST}" )
2021-09-15 04:53:55 +08:00
set ( is_gpu_test OFF )
2013-11-05 22:41:45 +08:00
if ( EIGEN_ADD_TEST_FILENAME_EXTENSION STREQUAL cu )
2021-09-15 04:53:55 +08:00
set ( is_gpu_test ON )
2018-06-06 22:12:58 +08:00
if ( EIGEN_TEST_HIP )
2018-06-21 04:44:58 +08:00
hip_reset_flags ( )
2021-12-13 05:03:30 +08:00
hip_add_executable ( ${ targetname } ${ filename } HIPCC_OPTIONS -std=c++14 )
target_compile_definitions ( ${ targetname } PRIVATE -DEIGEN_USE_HIP )
set_property ( TARGET ${ targetname } PROPERTY HIP_ARCHITECTURES gfx900 gfx906 gfx908 gfx90a gfx1030 )
2018-06-06 22:12:58 +08:00
elseif ( EIGEN_TEST_CUDA_CLANG )
2016-04-09 04:16:08 +08:00
set_source_files_properties ( ${ filename } PROPERTIES LANGUAGE CXX )
2018-07-13 22:03:14 +08:00
if ( CUDA_64_BIT_DEVICE_CODE AND ( EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" ) )
2016-04-09 04:16:08 +08:00
link_directories ( "${CUDA_TOOLKIT_ROOT_DIR}/lib64" )
else ( )
link_directories ( "${CUDA_TOOLKIT_ROOT_DIR}/lib" )
endif ( )
2018-07-13 22:03:14 +08:00
2021-12-10 07:09:56 +08:00
add_executable ( ${ targetname } ${ filename } )
2018-07-13 22:03:14 +08:00
set ( CUDA_CLANG_LINK_LIBRARIES "cudart_static" "cuda" "dl" "pthread" )
if ( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
set ( CUDA_CLANG_LINK_LIBRARIES ${ CUDA_CLANG_LINK_LIBRARIES } "rt" )
endif ( )
target_link_libraries ( ${ targetname } ${ CUDA_CLANG_LINK_LIBRARIES } )
2016-03-09 09:28:21 +08:00
else ( )
2021-12-10 07:09:56 +08:00
cuda_add_executable ( ${ targetname } ${ filename } )
2016-03-09 09:28:21 +08:00
endif ( )
2013-11-05 22:41:45 +08:00
else ( )
add_executable ( ${ targetname } ${ filename } )
endif ( )
2016-11-09 01:08:02 +08:00
2021-09-15 04:53:55 +08:00
add_dependencies ( buildtests ${ targetname } )
if ( is_gpu_test )
add_dependencies ( buildtests_gpu ${ targetname } )
2011-01-25 21:37:18 +08:00
endif ( )
2009-02-05 01:11:04 +08:00
2009-11-12 05:11:33 +08:00
if ( EIGEN_NO_ASSERTION_CHECKING )
2021-12-10 07:09:56 +08:00
target_compile_definitions ( ${ targetname } PRIVATE EIGEN_NO_ASSERTION_CHECKING=1 )
2019-11-01 00:36:27 +08:00
else ( )
2009-02-05 01:11:04 +08:00
if ( EIGEN_DEBUG_ASSERTS )
2021-12-10 07:09:56 +08:00
target_compile_definitions ( ${ targetname } PRIVATE EIGEN_DEBUG_ASSERTS=1 )
2019-11-01 00:36:27 +08:00
endif ( )
endif ( )
2016-11-09 01:08:02 +08:00
2021-12-10 07:09:56 +08:00
target_compile_definitions ( ${ targetname } PRIVATE EIGEN_TEST_MAX_SIZE= ${ EIGEN_TEST_MAX_SIZE } )
2009-02-05 01:11:04 +08:00
2016-10-27 04:48:46 +08:00
if ( MSVC )
2021-12-10 07:09:56 +08:00
target_compile_options ( ${ targetname } PRIVATE "/bigobj" )
2016-11-09 01:08:02 +08:00
endif ( )
2009-02-05 01:11:04 +08:00
2009-11-12 05:11:33 +08:00
# let the user pass flags.
2009-10-20 01:29:00 +08:00
if ( ${ ARGC } GREATER 2 )
2021-12-10 07:09:56 +08:00
target_compile_options ( ${ targetname } PRIVATE ${ ARGV2 } )
2019-11-01 00:36:27 +08:00
endif ( )
2016-11-09 01:08:02 +08:00
2011-12-09 17:50:13 +08:00
if ( EIGEN_TEST_CUSTOM_CXX_FLAGS )
2021-12-10 07:09:56 +08:00
target_compile_options ( ${ targetname } PRIVATE "${EIGEN_TEST_CUSTOM_CXX_FLAGS}" )
2011-12-09 17:50:13 +08:00
endif ( )
2009-02-05 01:11:04 +08:00
2010-04-19 23:19:22 +08:00
if ( EIGEN_STANDARD_LIBRARIES_TO_LINK_TO )
target_link_libraries ( ${ targetname } ${ EIGEN_STANDARD_LIBRARIES_TO_LINK_TO } )
endif ( )
2009-11-12 05:11:33 +08:00
if ( EXTERNAL_LIBS )
target_link_libraries ( ${ targetname } ${ EXTERNAL_LIBS } )
endif ( )
2011-12-09 17:50:13 +08:00
if ( EIGEN_TEST_CUSTOM_LINKER_FLAGS )
target_link_libraries ( ${ targetname } ${ EIGEN_TEST_CUSTOM_LINKER_FLAGS } )
endif ( )
2010-10-17 23:04:43 +08:00
2009-10-20 01:29:00 +08:00
if ( ${ ARGC } GREATER 3 )
2010-10-28 22:44:20 +08:00
set ( libs_to_link ${ ARGV3 } )
# it could be that some cmake module provides a bad library string " " (just spaces),
# and that severely breaks target_link_libraries ("can't link to -l-lstdc++" errors).
# so we check for strings containing only spaces.
string ( STRIP "${libs_to_link}" libs_to_link_stripped )
string ( LENGTH "${libs_to_link_stripped}" libs_to_link_stripped_length )
if ( ${ libs_to_link_stripped_length } GREATER 0 )
# notice: no double quotes around ${libs_to_link} here. It may be a list.
target_link_libraries ( ${ targetname } ${ libs_to_link } )
endif ( )
2016-11-09 01:08:02 +08:00
endif ( )
2009-02-05 01:11:04 +08:00
2013-08-01 05:11:43 +08:00
add_test ( ${ testname_with_suffix } "${targetname}" )
2016-11-09 01:08:02 +08:00
2018-07-17 00:35:05 +08:00
# Specify target and test labels according to EIGEN_CURRENT_SUBPROJECT
2016-11-09 01:08:02 +08:00
get_property ( current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT )
2013-03-20 15:40:13 +08:00
if ( ( current_subproject ) AND ( NOT ( current_subproject STREQUAL "" ) ) )
set_property ( TARGET ${ targetname } PROPERTY LABELS "Build${current_subproject}" )
add_dependencies ( "Build${current_subproject}" ${ targetname } )
set_property ( TEST ${ testname_with_suffix } PROPERTY LABELS "${current_subproject}" )
endif ( )
2021-09-15 04:53:55 +08:00
if ( is_gpu_test )
# Add gpu tag for testing only GPU tests.
set_property ( TEST ${ testname_with_suffix } APPEND PROPERTY LABELS "gpu" )
endif ( )
2019-11-28 18:08:54 +08:00
if ( EIGEN_SYCL )
# Force include of the SYCL file at the end to avoid errors.
set_property ( TARGET ${ targetname } PROPERTY COMPUTECPP_INCLUDE_AFTER 1 )
# Set COMPILE_FLAGS to COMPILE_DEFINITIONS instead to avoid having to duplicate the flags
# to the device compiler.
get_target_property ( target_compile_flags ${ targetname } COMPILE_FLAGS )
separate_arguments ( target_compile_flags )
foreach ( flag ${ target_compile_flags } )
if ( ${ flag } MATCHES "^-D.*" )
string ( REPLACE "-D" "" definition_flag ${ flag } )
set_property ( TARGET ${ targetname } APPEND PROPERTY COMPILE_DEFINITIONS ${ definition_flag } )
list ( REMOVE_ITEM target_compile_flags ${ flag } )
endif ( )
endforeach ( )
set_property ( TARGET ${ targetname } PROPERTY COMPILE_FLAGS ${ target_compile_flags } )
# Link against pthread and add sycl to target
set ( THREADS_PREFER_PTHREAD_FLAG ON )
find_package ( Threads REQUIRED )
target_link_libraries ( ${ targetname } Threads::Threads )
add_sycl_to_target ( TARGET ${ targetname } SOURCES ${ filename } )
endif ( EIGEN_SYCL )
endmacro ( ei_add_test_internal )
2009-10-20 01:29:00 +08:00
# Macro to add a test
#
2009-10-20 03:56:03 +08:00
# the unique mandatory parameter testname must correspond to a file
2009-10-20 01:29:00 +08:00
# <testname>.cpp which follows this pattern:
#
# #include "main.h"
# void test_<testname>() { ... }
#
2009-10-20 03:56:03 +08:00
# Depending on the contents of that file, this macro can have 2 behaviors,
# see below.
#
2009-11-12 05:11:33 +08:00
# The optional 2nd parameter is libraries to link to.
2009-10-20 02:40:35 +08:00
#
# A. Default behavior
#
2009-12-03 01:07:47 +08:00
# this macro adds an executable <testname> as well as a ctest test
# named <testname> too.
2009-10-20 01:29:00 +08:00
#
# On platforms with bash simply run:
# "ctest -V" or "ctest -V -R <testname>"
# On other platform use ctest as usual
#
2009-10-20 02:40:35 +08:00
# B. Multi-part behavior
2009-10-20 01:29:00 +08:00
#
2009-10-20 02:40:35 +08:00
# If the source file matches the regexp
2009-11-12 05:11:33 +08:00
# CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+
2009-10-20 02:40:35 +08:00
# then it is interpreted as a multi-part test. The behavior then depends on the
# CMake option EIGEN_SPLIT_LARGE_TESTS, which is ON by default.
2009-10-20 01:29:00 +08:00
#
2009-10-20 02:40:35 +08:00
# If EIGEN_SPLIT_LARGE_TESTS is OFF, the behavior is the same as in A (the multi-part
# aspect is ignored).
2009-10-20 01:29:00 +08:00
#
2009-10-20 02:40:35 +08:00
# If EIGEN_SPLIT_LARGE_TESTS is ON, the test is split into multiple executables
# test_<testname>_<N>
2018-03-11 22:01:44 +08:00
# where N runs from 1 to the greatest occurrence found in the source file. Each of these
2009-10-20 02:40:35 +08:00
# executables is built passing -DEIGEN_TEST_PART_N. This allows to split large tests
# into smaller executables.
2009-10-20 01:29:00 +08:00
#
2009-12-03 01:07:47 +08:00
# Moreover, targets <testname> are still generated, they
2009-10-20 02:40:35 +08:00
# have the effect of building all the parts of the test.
2009-10-20 01:29:00 +08:00
#
2009-10-20 02:40:35 +08:00
# Again, ctest -R allows to run all matching tests.
macro ( ei_add_test testname )
2009-11-26 10:26:37 +08:00
get_property ( EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST )
set ( EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}${testname}\n" )
set_property ( GLOBAL PROPERTY EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}" )
2013-11-05 22:41:45 +08:00
if ( EIGEN_ADD_TEST_FILENAME_EXTENSION )
set ( filename ${ testname } . ${ EIGEN_ADD_TEST_FILENAME_EXTENSION } )
else ( )
set ( filename ${ testname } .cpp )
endif ( )
2016-11-09 01:08:02 +08:00
2013-11-05 22:41:45 +08:00
file ( READ "${filename}" test_source )
2011-03-28 23:43:59 +08:00
string ( REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+"
2018-03-11 22:01:44 +08:00
o c c u r r e n c e s " $ { t e s t _ s o u r c e } " )
string ( REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_|EIGEN_SUFFIXES" "" suffixes "${occurrences}" )
2009-10-29 06:19:29 +08:00
list ( REMOVE_DUPLICATES suffixes )
2018-07-17 00:35:05 +08:00
set ( explicit_suffixes "" )
if ( ( NOT EIGEN_SPLIT_LARGE_TESTS ) AND suffixes )
# Check whether we have EIGEN_TEST_PART_* statements, in which case we likely must enforce splitting.
# For instance, indexed_view activate a different c++ version for each part.
string ( REGEX MATCHALL "EIGEN_TEST_PART_[0-9]+" occurrences "${test_source}" )
string ( REGEX REPLACE "EIGEN_TEST_PART_" "" explicit_suffixes "${occurrences}" )
list ( REMOVE_DUPLICATES explicit_suffixes )
endif ( )
if ( ( EIGEN_SPLIT_LARGE_TESTS AND suffixes ) OR explicit_suffixes )
2009-12-03 01:07:47 +08:00
add_custom_target ( ${ testname } )
2009-10-29 06:19:29 +08:00
foreach ( suffix ${ suffixes } )
2021-12-10 07:09:56 +08:00
ei_add_test_internal ( ${ testname } ${ testname } _ ${ suffix } "${ARGV1}" "${ARGV2}" )
2009-12-03 01:07:47 +08:00
add_dependencies ( ${ testname } ${ testname } _ ${ suffix } )
2021-12-10 07:09:56 +08:00
target_compile_definitions ( ${ testname } _ ${ suffix } PRIVATE -DEIGEN_TEST_PART_ ${ suffix } =1 )
2019-11-01 00:36:27 +08:00
endforeach ( )
2018-07-17 00:55:40 +08:00
else ( )
2021-12-10 07:09:56 +08:00
ei_add_test_internal ( ${ testname } ${ testname } "${ARGV1}" "${ARGV2}" )
target_compile_definitions ( ${ testname } PRIVATE -DEIGEN_TEST_PART_ALL=1 )
2018-07-17 00:55:40 +08:00
endif ( )
2019-11-01 00:36:27 +08:00
endmacro ( )
2009-10-20 01:29:00 +08:00
2011-02-06 07:57:29 +08:00
# adds a failtest, i.e. a test that succeed if the program fails to compile
# note that the test runner for these is CMake itself, when passed -DEIGEN_FAILTEST=ON
# so here we're just running CMake commands immediately, we're not adding any targets.
macro ( ei_add_failtest testname )
2018-12-12 22:48:36 +08:00
set ( test_target_ok ${ testname } _ok )
set ( test_target_ko ${ testname } _ko )
2011-02-06 07:57:29 +08:00
2018-12-12 22:48:36 +08:00
# Add executables
add_executable ( ${ test_target_ok } ${ testname } .cpp )
add_executable ( ${ test_target_ko } ${ testname } .cpp )
2011-02-06 07:57:29 +08:00
2018-12-12 22:48:36 +08:00
# Remove them from the normal build process
set_target_properties ( ${ test_target_ok } ${ test_target_ko } PROPERTIES
E X C L U D E _ F R O M _ A L L T R U E
E X C L U D E _ F R O M _ D E F A U L T _ B U I L D T R U E )
2011-02-06 07:57:29 +08:00
2018-12-12 22:48:36 +08:00
# Configure the failing test
target_compile_definitions ( ${ test_target_ko } PRIVATE EIGEN_SHOULD_FAIL_TO_BUILD )
2011-02-06 07:57:29 +08:00
2018-12-12 22:48:36 +08:00
# Add the tests to ctest.
add_test ( NAME ${ test_target_ok }
C O M M A N D $ { C M A K E _ C O M M A N D } - - b u i l d . - - t a r g e t $ { t e s t _ t a r g e t _ o k } - - c o n f i g $ < C O N F I G U R A T I O N >
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ B I N A R Y _ D I R } )
add_test ( NAME ${ test_target_ko }
C O M M A N D $ { C M A K E _ C O M M A N D } - - b u i l d . - - t a r g e t $ { t e s t _ t a r g e t _ k o } - - c o n f i g $ < C O N F I G U R A T I O N >
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ B I N A R Y _ D I R } )
2011-02-06 07:57:29 +08:00
2018-12-12 22:48:36 +08:00
# Expect the second test to fail
set_tests_properties ( ${ test_target_ko } PROPERTIES WILL_FAIL TRUE )
2019-11-01 00:36:27 +08:00
endmacro ( )
2011-02-06 07:57:29 +08:00
2009-02-28 00:19:13 +08:00
# print a summary of the different options
macro ( ei_testing_print_summary )
2010-12-30 05:02:01 +08:00
message ( STATUS "************************************************************" )
message ( STATUS "*** Eigen's unit tests configuration summary ***" )
message ( STATUS "************************************************************" )
message ( STATUS "" )
message ( STATUS "Build type: ${CMAKE_BUILD_TYPE}" )
2011-02-20 18:54:07 +08:00
message ( STATUS "Build site: ${SITE}" )
message ( STATUS "Build string: ${BUILDNAME}" )
2009-02-28 00:19:13 +08:00
get_property ( EIGEN_TESTING_SUMMARY GLOBAL PROPERTY EIGEN_TESTING_SUMMARY )
get_property ( EIGEN_TESTED_BACKENDS GLOBAL PROPERTY EIGEN_TESTED_BACKENDS )
get_property ( EIGEN_MISSING_BACKENDS GLOBAL PROPERTY EIGEN_MISSING_BACKENDS )
2010-12-30 05:02:01 +08:00
message ( STATUS "Enabled backends: ${EIGEN_TESTED_BACKENDS}" )
message ( STATUS "Disabled backends: ${EIGEN_MISSING_BACKENDS}" )
2009-02-28 00:19:13 +08:00
2010-01-27 20:48:48 +08:00
if ( EIGEN_DEFAULT_TO_ROW_MAJOR )
2010-12-30 05:02:01 +08:00
message ( STATUS "Default order: Row-major" )
2010-01-27 20:48:48 +08:00
else ( )
2010-12-30 05:02:01 +08:00
message ( STATUS "Default order: Column-major" )
2010-01-27 20:48:48 +08:00
endif ( )
2010-03-06 15:17:37 +08:00
if ( EIGEN_TEST_NO_EXPLICIT_ALIGNMENT )
2010-12-30 05:02:01 +08:00
message ( STATUS "Explicit alignment (hence vectorization) disabled" )
2010-03-06 15:17:37 +08:00
elseif ( EIGEN_TEST_NO_EXPLICIT_VECTORIZATION )
2010-12-30 05:02:01 +08:00
message ( STATUS "Explicit vectorization disabled (alignment kept enabled)" )
2009-11-25 04:12:43 +08:00
else ( )
2016-11-09 01:08:02 +08:00
2011-07-12 20:41:00 +08:00
message ( STATUS "Maximal matrix/vector size: ${EIGEN_TEST_MAX_SIZE}" )
2009-02-28 00:19:13 +08:00
2010-03-06 15:17:37 +08:00
if ( EIGEN_TEST_SSE2 )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSE2: ON" )
2010-03-06 15:17:37 +08:00
else ( )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSE2: Using architecture defaults" )
2010-03-06 15:17:37 +08:00
endif ( )
if ( EIGEN_TEST_SSE3 )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSE3: ON" )
2010-03-06 15:17:37 +08:00
else ( )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSE3: Using architecture defaults" )
2010-03-06 15:17:37 +08:00
endif ( )
if ( EIGEN_TEST_SSSE3 )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSSE3: ON" )
2010-03-06 15:17:37 +08:00
else ( )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSSE3: Using architecture defaults" )
2010-03-06 15:17:37 +08:00
endif ( )
if ( EIGEN_TEST_SSE4_1 )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSE4.1: ON" )
2010-03-06 15:17:37 +08:00
else ( )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSE4.1: Using architecture defaults" )
2010-03-06 15:17:37 +08:00
endif ( )
if ( EIGEN_TEST_SSE4_2 )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSE4.2: ON" )
2010-03-06 15:17:37 +08:00
else ( )
2010-12-30 05:02:01 +08:00
message ( STATUS "SSE4.2: Using architecture defaults" )
2014-01-30 03:43:05 +08:00
endif ( )
if ( EIGEN_TEST_AVX )
message ( STATUS "AVX: ON" )
else ( )
message ( STATUS "AVX: Using architecture defaults" )
2010-03-06 15:17:37 +08:00
endif ( )
2020-07-14 09:34:03 +08:00
if ( EIGEN_TEST_AVX2 )
message ( STATUS "AVX2: ON" )
else ( )
message ( STATUS "AVX2: Using architecture defaults" )
endif ( )
2016-02-05 02:34:10 +08:00
if ( EIGEN_TEST_FMA )
2014-03-25 00:52:45 +08:00
message ( STATUS "FMA: ON" )
else ( )
message ( STATUS "FMA: Using architecture defaults" )
endif ( )
2016-02-05 02:34:10 +08:00
if ( EIGEN_TEST_AVX512 )
2016-01-06 02:02:49 +08:00
message ( STATUS "AVX512: ON" )
else ( )
message ( STATUS "AVX512: Using architecture defaults" )
endif ( )
2020-07-14 09:34:03 +08:00
if ( EIGEN_TEST_AVX512DQ )
message ( STATUS "AVX512DQ: ON" )
else ( )
message ( STATUS "AVX512DQ: Using architecture defaults" )
endif ( )
2010-03-06 15:17:37 +08:00
if ( EIGEN_TEST_ALTIVEC )
2010-12-30 05:02:01 +08:00
message ( STATUS "Altivec: ON" )
2010-03-06 15:17:37 +08:00
else ( )
2010-12-30 05:02:01 +08:00
message ( STATUS "Altivec: Using architecture defaults" )
2010-03-06 15:17:37 +08:00
endif ( )
2014-08-30 04:03:49 +08:00
if ( EIGEN_TEST_VSX )
message ( STATUS "VSX: ON" )
else ( )
message ( STATUS "VSX: Using architecture defaults" )
endif ( )
2018-07-07 07:04:30 +08:00
if ( EIGEN_TEST_MSA )
message ( STATUS "MIPS MSA: ON" )
else ( )
message ( STATUS "MIPS MSA: Using architecture defaults" )
endif ( )
2010-03-06 15:17:37 +08:00
if ( EIGEN_TEST_NEON )
2010-12-30 05:02:01 +08:00
message ( STATUS "ARM NEON: ON" )
2010-03-06 15:17:37 +08:00
else ( )
2010-12-30 05:02:01 +08:00
message ( STATUS "ARM NEON: Using architecture defaults" )
2010-03-06 15:17:37 +08:00
endif ( )
2014-10-22 02:10:01 +08:00
if ( EIGEN_TEST_NEON64 )
message ( STATUS "ARMv8 NEON: ON" )
else ( )
message ( STATUS "ARMv8 NEON: Using architecture defaults" )
endif ( )
2016-11-09 01:08:02 +08:00
2016-03-22 01:46:47 +08:00
if ( EIGEN_TEST_ZVECTOR )
message ( STATUS "S390X ZVECTOR: ON" )
else ( )
message ( STATUS "S390X ZVECTOR: Using architecture defaults" )
endif ( )
2016-11-09 01:08:02 +08:00
2016-09-19 19:44:13 +08:00
if ( EIGEN_TEST_SYCL )
2017-05-06 02:26:27 +08:00
if ( EIGEN_SYCL_TRISYCL )
message ( STATUS "SYCL: ON (using triSYCL)" )
else ( )
message ( STATUS "SYCL: ON (using computeCPP)" )
endif ( )
2016-09-19 19:44:13 +08:00
else ( )
message ( STATUS "SYCL: OFF" )
endif ( )
2016-04-07 00:35:23 +08:00
if ( EIGEN_TEST_CUDA )
2016-04-09 04:16:08 +08:00
if ( EIGEN_TEST_CUDA_CLANG )
message ( STATUS "CUDA: ON (using clang)" )
else ( )
message ( STATUS "CUDA: ON (using nvcc)" )
endif ( )
2016-03-19 03:17:37 +08:00
else ( )
message ( STATUS "CUDA: OFF" )
endif ( )
2018-06-06 22:12:58 +08:00
if ( EIGEN_TEST_HIP )
message ( STATUS "HIP: ON (using hipcc)" )
else ( )
message ( STATUS "HIP: OFF" )
endif ( )
2016-03-19 03:17:37 +08:00
2010-03-06 15:17:37 +08:00
endif ( ) # vectorization / alignment options
2009-02-28 00:19:13 +08:00
2010-12-30 05:02:01 +08:00
message ( STATUS "\n${EIGEN_TESTING_SUMMARY}" )
2009-02-28 00:19:13 +08:00
2010-12-30 05:02:01 +08:00
message ( STATUS "************************************************************" )
2019-11-01 00:36:27 +08:00
endmacro ( )
2009-02-28 00:19:13 +08:00
macro ( ei_init_testing )
2013-03-20 15:40:13 +08:00
define_property ( GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT BRIEF_DOCS " " FULL_DOCS " " )
2009-02-28 00:19:13 +08:00
define_property ( GLOBAL PROPERTY EIGEN_TESTED_BACKENDS BRIEF_DOCS " " FULL_DOCS " " )
define_property ( GLOBAL PROPERTY EIGEN_MISSING_BACKENDS BRIEF_DOCS " " FULL_DOCS " " )
define_property ( GLOBAL PROPERTY EIGEN_TESTING_SUMMARY BRIEF_DOCS " " FULL_DOCS " " )
2009-11-26 10:26:37 +08:00
define_property ( GLOBAL PROPERTY EIGEN_TESTS_LIST BRIEF_DOCS " " FULL_DOCS " " )
2021-04-01 06:09:00 +08:00
define_property ( GLOBAL PROPERTY EIGEN_SUBTESTS_LIST BRIEF_DOCS " " FULL_DOCS " " )
2009-02-28 00:19:13 +08:00
set_property ( GLOBAL PROPERTY EIGEN_TESTED_BACKENDS "" )
set_property ( GLOBAL PROPERTY EIGEN_MISSING_BACKENDS "" )
set_property ( GLOBAL PROPERTY EIGEN_TESTING_SUMMARY "" )
2009-11-26 10:26:37 +08:00
set_property ( GLOBAL PROPERTY EIGEN_TESTS_LIST "" )
2021-04-01 06:09:00 +08:00
set_property ( GLOBAL PROPERTY EIGEN_SUBTESTS_LIST "" )
2011-02-06 07:57:29 +08:00
define_property ( GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT BRIEF_DOCS " " FULL_DOCS " " )
define_property ( GLOBAL PROPERTY EIGEN_FAILTEST_COUNT BRIEF_DOCS " " FULL_DOCS " " )
set_property ( GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT "0" )
set_property ( GLOBAL PROPERTY EIGEN_FAILTEST_COUNT "0" )
2016-11-09 01:08:02 +08:00
2011-12-07 20:20:52 +08:00
# uncomment anytime you change the ei_get_compilerver_from_cxx_version_string macro
# ei_test_get_compilerver_from_cxx_version_string()
2019-11-01 00:36:27 +08:00
endmacro ( )
2009-02-28 00:19:13 +08:00
2011-02-20 18:54:07 +08:00
macro ( ei_set_sitename )
# if the sitename is not yet set, try to set it
if ( NOT ${ SITE } OR ${ SITE } STREQUAL "" )
set ( eigen_computername $ENV{ COMPUTERNAME } )
2016-11-09 06:22:36 +08:00
set ( eigen_hostname $ENV{ HOSTNAME } )
2011-02-20 18:54:07 +08:00
if ( eigen_hostname )
set ( SITE ${ eigen_hostname } )
2016-11-09 06:22:36 +08:00
elseif ( eigen_computername )
set ( SITE ${ eigen_computername } )
2011-02-20 18:54:07 +08:00
endif ( )
endif ( )
# in case it is already set, enforce lower case
if ( SITE )
string ( TOLOWER ${ SITE } SITE )
2016-11-09 01:08:02 +08:00
endif ( )
2019-11-01 00:36:27 +08:00
endmacro ( )
2011-02-20 18:54:07 +08:00
macro ( ei_get_compilerver VAR )
2013-08-01 22:38:05 +08:00
if ( MSVC )
2021-10-01 05:12:43 +08:00
set ( ${ VAR } "${CMAKE_CXX_COMPILER_VERSION}" )
2017-11-18 05:54:39 +08:00
elseif ( ${ CMAKE_CXX_COMPILER_ID } MATCHES "PGI" )
set ( ${ VAR } "${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" )
2011-12-07 02:54:34 +08:00
else ( )
# on all other system we rely on ${CMAKE_CXX_COMPILER}
2015-02-16 23:26:47 +08:00
# supporting a "--version" or "/version" flag
2016-11-09 01:08:02 +08:00
2015-08-14 21:30:59 +08:00
if ( WIN32 AND ${ CMAKE_CXX_COMPILER_ID } EQUAL "Intel" )
2015-02-16 23:26:47 +08:00
set ( EIGEN_CXX_FLAG_VERSION "/version" )
else ( )
set ( EIGEN_CXX_FLAG_VERSION "--version" )
endif ( )
2016-11-09 01:08:02 +08:00
2015-08-14 21:30:59 +08:00
execute_process ( COMMAND ${ CMAKE_CXX_COMPILER } ${ EIGEN_CXX_FLAG_VERSION }
O U T P U T _ V A R I A B L E e i g e n _ c x x _ c o m p i l e r _ v e r s i o n _ s t r i n g O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
2021-06-08 21:48:21 +08:00
string ( REGEX REPLACE "^[ \n\r]+" "" eigen_cxx_compiler_version_string ${ eigen_cxx_compiler_version_string } )
2015-08-14 21:30:59 +08:00
string ( REGEX REPLACE "[\n\r].*" "" eigen_cxx_compiler_version_string ${ eigen_cxx_compiler_version_string } )
2016-11-09 01:08:02 +08:00
2013-06-18 23:25:37 +08:00
ei_get_compilerver_from_cxx_version_string ( "${eigen_cxx_compiler_version_string}" CNAME CVER )
2011-12-07 20:20:52 +08:00
set ( ${ VAR } "${CNAME}-${CVER}" )
2016-11-09 01:08:02 +08:00
2011-02-20 18:54:07 +08:00
endif ( )
2019-11-01 00:36:27 +08:00
endmacro ( )
2011-02-20 18:54:07 +08:00
2011-12-07 20:20:52 +08:00
# Extract compiler name and version from a raw version string
2021-06-12 01:21:07 +08:00
# WARNING: if you edit this macro, then please test it by uncommenting
2011-12-07 20:20:52 +08:00
# the testing macro call in ei_init_testing() of the EigenTesting.cmake file.
2021-06-12 01:21:07 +08:00
# See also the ei_test_get_compilerver_from_cxx_version_string macro at the end
# of the file
2011-12-07 20:20:52 +08:00
macro ( ei_get_compilerver_from_cxx_version_string VERSTRING CNAME CVER )
2016-11-09 01:08:02 +08:00
# extract possible compiler names
2011-12-07 20:20:52 +08:00
string ( REGEX MATCH "g\\+\\+" ei_has_gpp ${ VERSTRING } )
string ( REGEX MATCH "llvm|LLVM" ei_has_llvm ${ VERSTRING } )
string ( REGEX MATCH "gcc|GCC" ei_has_gcc ${ VERSTRING } )
string ( REGEX MATCH "icpc|ICC" ei_has_icpc ${ VERSTRING } )
string ( REGEX MATCH "clang|CLANG" ei_has_clang ${ VERSTRING } )
2021-06-12 01:21:07 +08:00
string ( REGEX MATCH "mingw32" ei_has_mingw ${ VERSTRING } )
2016-11-09 01:08:02 +08:00
2011-12-07 20:20:52 +08:00
# combine them
if ( ( ei_has_llvm ) AND ( ei_has_gpp OR ei_has_gcc ) )
set ( ${ CNAME } "llvm-g++" )
elseif ( ( ei_has_llvm ) AND ( ei_has_clang ) )
set ( ${ CNAME } "llvm-clang++" )
2016-05-22 21:21:14 +08:00
elseif ( ei_has_clang )
set ( ${ CNAME } "clang++" )
2021-06-12 01:21:07 +08:00
elseif ( ( ei_has_mingw ) AND ( ei_has_gpp OR ei_has_gcc ) )
set ( ${ CNAME } "mingw32-g++" )
2011-12-07 20:20:52 +08:00
elseif ( ei_has_icpc )
set ( ${ CNAME } "icpc" )
elseif ( ei_has_gpp OR ei_has_gcc )
set ( ${ CNAME } "g++" )
else ( )
set ( ${ CNAME } "_" )
endif ( )
2016-11-09 01:08:02 +08:00
2011-12-07 20:20:52 +08:00
# extract possible version numbers
# first try to extract 3 isolated numbers:
string ( REGEX MATCH " [0-9]+\\.[0-9]+\\.[0-9]+" eicver ${ VERSTRING } )
if ( NOT eicver )
# try to extract 2 isolated ones:
string ( REGEX MATCH " [0-9]+\\.[0-9]+" eicver ${ VERSTRING } )
if ( NOT eicver )
# try to extract 3:
string ( REGEX MATCH "[^0-9][0-9]+\\.[0-9]+\\.[0-9]+" eicver ${ VERSTRING } )
if ( NOT eicver )
# try to extract 2:
string ( REGEX MATCH "[^0-9][0-9]+\\.[0-9]+" eicver ${ VERSTRING } )
2021-06-12 01:21:07 +08:00
if ( NOT eicver AND ei_has_mingw )
# try to extract 1 number plus suffix:
string ( REGEX MATCH "[^0-9][0-9]+-win32" eicver ${ VERSTRING } )
endif ( )
2011-12-07 20:20:52 +08:00
endif ( )
endif ( )
endif ( )
2021-06-12 01:21:07 +08:00
if ( NOT eicver )
set ( eicver " _" )
endif ( )
2016-11-09 01:08:02 +08:00
2011-12-07 20:20:52 +08:00
string ( REGEX REPLACE ".(.*)" "\\1" ${ CVER } ${ eicver } )
2016-11-09 01:08:02 +08:00
2019-11-01 00:36:27 +08:00
endmacro ( )
2011-12-07 20:20:52 +08:00
2011-02-20 18:54:07 +08:00
macro ( ei_get_cxxflags VAR )
set ( ${ VAR } "" )
ei_is_64bit_env ( IS_64BIT_ENV )
if ( EIGEN_TEST_NEON )
set ( ${ VAR } NEON )
2014-10-22 02:10:01 +08:00
elseif ( EIGEN_TEST_NEON64 )
set ( ${ VAR } NEON )
2016-03-22 01:46:47 +08:00
elseif ( EIGEN_TEST_ZVECTOR )
set ( ${ VAR } ZVECTOR )
2014-09-26 00:06:16 +08:00
elseif ( EIGEN_TEST_VSX )
set ( ${ VAR } VSX )
2011-02-20 18:54:07 +08:00
elseif ( EIGEN_TEST_ALTIVEC )
set ( ${ VAR } ALVEC )
2014-03-25 00:52:45 +08:00
elseif ( EIGEN_TEST_FMA )
set ( ${ VAR } FMA )
elseif ( EIGEN_TEST_AVX )
set ( ${ VAR } AVX )
2011-02-20 18:54:07 +08:00
elseif ( EIGEN_TEST_SSE4_2 )
set ( ${ VAR } SSE42 )
elseif ( EIGEN_TEST_SSE4_1 )
set ( ${ VAR } SSE41 )
elseif ( EIGEN_TEST_SSSE3 )
set ( ${ VAR } SSSE3 )
elseif ( EIGEN_TEST_SSE3 )
set ( ${ VAR } SSE3 )
elseif ( EIGEN_TEST_SSE2 OR IS_64BIT_ENV )
2016-11-09 01:08:02 +08:00
set ( ${ VAR } SSE2 )
2018-07-07 07:04:30 +08:00
elseif ( EIGEN_TEST_MSA )
set ( ${ VAR } MSA )
2011-02-20 18:54:07 +08:00
endif ( )
if ( EIGEN_TEST_OPENMP )
if ( ${ VAR } STREQUAL "" )
2016-11-09 06:22:36 +08:00
set ( ${ VAR } OMP )
else ( )
set ( ${ VAR } ${ ${VAR } }-OMP )
endif ( )
2011-02-20 18:54:07 +08:00
endif ( )
2016-11-09 01:08:02 +08:00
2011-02-20 18:54:07 +08:00
if ( EIGEN_DEFAULT_TO_ROW_MAJOR )
if ( ${ VAR } STREQUAL "" )
2016-11-09 06:22:36 +08:00
set ( ${ VAR } ROW )
else ( )
set ( ${ VAR } ${ ${VAR } }-ROWMAJ )
endif ( )
2011-02-20 18:54:07 +08:00
endif ( )
2019-11-01 00:36:27 +08:00
endmacro ( )
2011-02-20 18:54:07 +08:00
macro ( ei_set_build_string )
ei_get_compilerver ( LOCAL_COMPILER_VERSION )
ei_get_cxxflags ( LOCAL_COMPILER_FLAGS )
2016-11-09 01:08:02 +08:00
2021-10-01 05:12:43 +08:00
set ( TMP_BUILD_STRING ${ CMAKE_SYSTEM } - ${ LOCAL_COMPILER_VERSION } )
2011-07-12 20:41:00 +08:00
2011-02-20 18:54:07 +08:00
if ( NOT ${ LOCAL_COMPILER_FLAGS } STREQUAL "" )
set ( TMP_BUILD_STRING ${ TMP_BUILD_STRING } - ${ LOCAL_COMPILER_FLAGS } )
endif ( )
2018-05-23 03:04:32 +08:00
if ( EIGEN_TEST_EXTERNAL_BLAS )
set ( TMP_BUILD_STRING ${ TMP_BUILD_STRING } -external_blas )
endif ( )
2011-02-20 18:54:07 +08:00
ei_is_64bit_env ( IS_64BIT_ENV )
if ( NOT IS_64BIT_ENV )
set ( TMP_BUILD_STRING ${ TMP_BUILD_STRING } -32bit )
else ( )
set ( TMP_BUILD_STRING ${ TMP_BUILD_STRING } -64bit )
endif ( )
2016-11-09 01:08:02 +08:00
2013-02-26 20:40:13 +08:00
if ( EIGEN_BUILD_STRING_SUFFIX )
set ( TMP_BUILD_STRING ${ TMP_BUILD_STRING } - ${ EIGEN_BUILD_STRING_SUFFIX } )
endif ( )
2011-02-20 18:54:07 +08:00
string ( TOLOWER ${ TMP_BUILD_STRING } BUILDNAME )
2019-11-01 00:36:27 +08:00
endmacro ( )
2011-02-20 18:54:07 +08:00
macro ( ei_is_64bit_env VAR )
2014-10-14 20:14:25 +08:00
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
2011-02-20 18:54:07 +08:00
set ( ${ VAR } 1 )
2014-10-14 20:14:25 +08:00
elseif ( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set ( ${ VAR } 0 )
else ( )
message ( WARNING "Unsupported pointer size. Please contact the authors." )
2011-02-20 18:54:07 +08:00
endif ( )
2019-11-01 00:36:27 +08:00
endmacro ( )
2011-12-07 20:20:52 +08:00
# helper macro for testing ei_get_compilerver_from_cxx_version_string
# STR: raw version string
# REFNAME: expected compiler name
# REFVER: expected compiler version
macro ( ei_test1_get_compilerver_from_cxx_version_string STR REFNAME REFVER )
ei_get_compilerver_from_cxx_version_string ( ${ STR } CNAME CVER )
if ( ( NOT ${ REFNAME } STREQUAL ${ CNAME } ) OR ( NOT ${ REFVER } STREQUAL ${ CVER } ) )
message ( "STATUS ei_get_compilerver_from_cxx_version_string error:" )
message ( "Expected \" ${ REFNAME } - ${ REFVER } \", got \"${CNAME}-${CVER}\"")
endif ( )
2019-11-01 00:36:27 +08:00
endmacro ( )
2011-12-07 20:20:52 +08:00
# macro for testing ei_get_compilerver_from_cxx_version_string
# feel free to add more version strings
macro ( ei_test_get_compilerver_from_cxx_version_string )
ei_test1_get_compilerver_from_cxx_version_string ( "g++ (SUSE Linux) 4.5.3 20110428 [gcc-4_5-branch revision 173117]" "g++" "4.5.3" )
ei_test1_get_compilerver_from_cxx_version_string ( "c++ (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)" "g++" "4.5.1" )
ei_test1_get_compilerver_from_cxx_version_string ( "icpc (ICC) 11.0 20081105" "icpc" "11.0" )
ei_test1_get_compilerver_from_cxx_version_string ( "g++-3.4 (GCC) 3.4.6" "g++" "3.4.6" )
ei_test1_get_compilerver_from_cxx_version_string ( "SUSE Linux clang version 3.0 (branches/release_30 145598) (based on LLVM 3.0)" "llvm-clang++" "3.0" )
ei_test1_get_compilerver_from_cxx_version_string ( "icpc (ICC) 12.0.5 20110719" "icpc" "12.0.5" )
ei_test1_get_compilerver_from_cxx_version_string ( "Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn)" "llvm-clang++" "2.1" )
ei_test1_get_compilerver_from_cxx_version_string ( "i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)" "llvm-g++" "4.2.1" )
ei_test1_get_compilerver_from_cxx_version_string ( "g++-mp-4.4 (GCC) 4.4.6" "g++" "4.4.6" )
ei_test1_get_compilerver_from_cxx_version_string ( "g++-mp-4.4 (GCC) 2011" "g++" "4.4" )
2021-06-12 01:21:07 +08:00
ei_test1_get_compilerver_from_cxx_version_string ( "x86_64-w64-mingw32-g++ (GCC) 10-win32 20210110" "mingw32-g++" "10-win32" )
2019-11-01 00:36:27 +08:00
endmacro ( )
2020-08-20 02:27:45 +08:00
# Split all tests listed in EIGEN_TESTS_LIST into num_splits many targets
# named buildtestspartN with N = { 0, ..., num_splits-1}.
#
2021-09-23 00:15:06 +08:00
# The intention behind the existence of this macro is the size of Eigen's
# testsuite. Together with the relatively big compile-times building all tests
2020-08-20 02:27:45 +08:00
# can take a substantial amount of time depending on the available hardware.
#
# The last buildtestspartN target will build possible remaining tests.
#
# An example:
#
# EIGEN_TESTS_LIST= [ test1, test2, test3, test4, test5, test6, test7 ]
#
# A call to ei_split_testsuite(3) creates the following targets with dependencies
#
# Target Dependencies
# ------ ------------
# buildtestspart0 test1, test2
# buildtestspart1 test3, test4
# buildtestspart2 test5, test6, test7
#
macro ( ei_split_testsuite num_splits )
get_property ( EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST )
# Translate EIGEN_TESTS_LIST into a CMake list
string ( REGEX REPLACE "\n" " " EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}" )
set ( EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}" )
separate_arguments ( EIGEN_TESTS_LIST )
set ( eigen_test_count "0" )
foreach ( t IN ITEMS ${ EIGEN_TESTS_LIST } )
math ( EXPR eigen_test_count "${eigen_test_count}+1" )
endforeach ( )
# Get number of tests per target
math ( EXPR num_tests_per_target "${eigen_test_count}/${num_splits} - ${eigen_test_count}/${num_splits} % 1" )
set ( test_idx "0" )
math ( EXPR target_bound "${num_splits}-1" )
foreach ( part RANGE "0" "${target_bound}" )
# Create target
set ( current_target "buildtestspart${part}" )
add_custom_target ( "${current_target}" )
math ( EXPR upper_bound "${test_idx} + ${num_tests_per_target} - 1" )
foreach ( test_idx RANGE "${test_idx}" "${upper_bound}" )
list ( GET EIGEN_TESTS_LIST "${test_idx}" curr_test )
add_dependencies ( "${current_target}" "${curr_test}" )
endforeach ( )
math ( EXPR test_idx "${test_idx} + ${num_tests_per_target}" )
endforeach ( )
# Handle the possibly remaining tests
math ( EXPR test_idx "${num_splits} * ${num_tests_per_target}" )
math ( EXPR target_bound "${eigen_test_count} - 1" )
foreach ( test_idx RANGE "${test_idx}" "${target_bound}" )
list ( GET EIGEN_TESTS_LIST "${test_idx}" curr_test )
add_dependencies ( "${current_target}" "${curr_test}" )
endforeach ( )
endmacro ( ei_split_testsuite num_splits )
2021-04-01 06:09:00 +08:00
2021-04-01 08:08:37 +08:00
# Defines the custom command buildsmoketests to build a number of tests
# specified in smoke_test_list.
2021-04-01 06:09:00 +08:00
#
# Test in smoke_test_list can be either test targets (e.g. packetmath) or
# subtests targets (e.g. packetmath_2). If any of the test are not available
# in the current configuration they are just skipped.
#
2021-04-01 08:08:37 +08:00
# All tests added via this macro are labeled with the smoketest label. This
# allows running smoketests only using ctest.
#
2021-04-01 06:09:00 +08:00
# Smoke tests are intended to be run before the whole test suite is invoked,
# e.g., to smoke test patches.
macro ( ei_add_smoke_tests smoke_test_list )
# Set the build target to build smoketests
set ( buildtarget "buildsmoketests" )
add_custom_target ( "${buildtarget}" )
# Get list of all tests and translate it into a CMake list
get_property ( EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST )
string ( REGEX REPLACE "\n" " " EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}" )
set ( EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}" )
separate_arguments ( EIGEN_TESTS_LIST )
# Check if the test in smoke_test_list is a currently valid test target
foreach ( test IN ITEMS ${ smoke_test_list } )
# Add tests in smoke_test_list to our smoke test target but only if the test
# is currently available, i.e., is in EIGEN_SUBTESTS_LIST
if ( "${test}" IN_LIST EIGEN_TESTS_LIST )
add_dependencies ( "${buildtarget}" "${test}" )
# In the case of a test we match all subtests
set ( ctest_regex "${ctest_regex}^${test}_[0-9]+$$|" )
endif ( )
endforeach ( )
# Get list of all subtests and translate it into a CMake list
get_property ( EIGEN_SUBTESTS_LIST GLOBAL PROPERTY EIGEN_SUBTESTS_LIST )
string ( REGEX REPLACE "\n" " " EIGEN_SUBTESTS_LIST "${EIGEN_SUBTESTS_LIST}" )
set ( EIGEN_SUBTESTS_LIST "${EIGEN_SUBTESTS_LIST}" )
separate_arguments ( EIGEN_SUBTESTS_LIST )
# Check if the test in smoke_test_list is a currently valid subtest target
foreach ( test IN ITEMS ${ smoke_test_list } )
# Add tests in smoke_test_list to our smoke test target but only if the test
# is currently available, i.e., is in EIGEN_SUBTESTS_LIST
if ( "${test}" IN_LIST EIGEN_SUBTESTS_LIST )
add_dependencies ( "${buildtarget}" "${test}" )
2021-04-01 08:08:37 +08:00
# Add label smoketest to be able to run smoketests using ctest
2021-09-15 04:53:55 +08:00
set_property ( TEST ${ test } APPEND PROPERTY LABELS "smoketest" )
2021-04-01 06:09:00 +08:00
endif ( )
endforeach ( )
2021-06-12 01:21:07 +08:00
endmacro ( ei_add_smoke_tests )