Merge pull request #6 from astron-rd/fix-tests-cmake
Improve the CMake for the tests
This commit is contained in:
@@ -7,9 +7,23 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
option(TRIGDX_USE_MKL "Enable Intel MKL backend" OFF)
|
option(TRIGDX_USE_MKL "Enable Intel MKL backend" OFF)
|
||||||
option(TRIGDX_USE_GPU "Enable GPU backend" OFF)
|
option(TRIGDX_USE_GPU "Enable GPU backend" OFF)
|
||||||
option(TRIGDX_USE_XSIMD "Enable XSIMD backend" OFF)
|
option(TRIGDX_USE_XSIMD "Enable XSIMD backend" OFF)
|
||||||
|
option(TRIGDX_BUILD_TESTS "Build tests" ON)
|
||||||
|
option(TRIGDX_BUILD_BENCHMARKS "Build tests" ON)
|
||||||
|
|
||||||
|
if(TRIGDX_BUILD_TESTS OR TRIGDX_BUILD_BENCHMARKS)
|
||||||
|
include(FetchContent)
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
if(TRIGDX_BUILD_TESTS)
|
||||||
|
include(CTest)
|
||||||
|
enable_testing()
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TRIGDX_BUILD_BENCHMARKS)
|
||||||
add_subdirectory(benchmarks)
|
add_subdirectory(benchmarks)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
catch2
|
catch2
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
@@ -9,30 +7,28 @@ FetchContent_MakeAvailable(catch2)
|
|||||||
# Lookup backend test
|
# Lookup backend test
|
||||||
add_executable(test_lookup test_lookup.cpp)
|
add_executable(test_lookup test_lookup.cpp)
|
||||||
target_link_libraries(test_lookup PRIVATE trigdx Catch2::Catch2WithMain)
|
target_link_libraries(test_lookup PRIVATE trigdx Catch2::Catch2WithMain)
|
||||||
|
add_test(NAME test_lookup COMMAND test_lookup)
|
||||||
|
|
||||||
# LookupAVX backend test
|
# LookupAVX backend test
|
||||||
add_executable(test_lookup_avx test_lookup_avx.cpp)
|
add_executable(test_lookup_avx test_lookup_avx.cpp)
|
||||||
target_link_libraries(test_lookup_avx PRIVATE trigdx Catch2::Catch2WithMain)
|
target_link_libraries(test_lookup_avx PRIVATE trigdx Catch2::Catch2WithMain)
|
||||||
|
add_test(NAME test_lookup_avx COMMAND test_lookup_avx)
|
||||||
|
|
||||||
# MKL backend test
|
# MKL backend test
|
||||||
if(TRIGDX_USE_MKL)
|
if(TRIGDX_USE_MKL)
|
||||||
add_executable(test_mkl test_mkl.cpp)
|
add_executable(test_mkl test_mkl.cpp)
|
||||||
target_link_libraries(test_mkl PRIVATE trigdx Catch2::Catch2WithMain)
|
target_link_libraries(test_mkl PRIVATE trigdx Catch2::Catch2WithMain)
|
||||||
endif()
|
|
||||||
|
|
||||||
include(CTest)
|
|
||||||
add_test(NAME test_lookup COMMAND test_lookup)
|
|
||||||
|
|
||||||
if(TRIGDX_USE_MKL)
|
|
||||||
add_test(NAME test_mkl COMMAND test_mkl)
|
add_test(NAME test_mkl COMMAND test_mkl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# GPU backend test
|
||||||
if(TRIGDX_USE_GPU)
|
if(TRIGDX_USE_GPU)
|
||||||
add_executable(test_gpu test_gpu.cpp)
|
add_executable(test_gpu test_gpu.cpp)
|
||||||
target_link_libraries(test_gpu PRIVATE trigdx Catch2::Catch2WithMain)
|
target_link_libraries(test_gpu PRIVATE trigdx Catch2::Catch2WithMain)
|
||||||
add_test(NAME test_gpu COMMAND test_gpu)
|
add_test(NAME test_gpu COMMAND test_gpu)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# XSIMD backend test
|
||||||
if(TRIGDX_USE_XSIMD)
|
if(TRIGDX_USE_XSIMD)
|
||||||
add_executable(test_lookup_xsimd test_lookup_xsimd.cpp)
|
add_executable(test_lookup_xsimd test_lookup_xsimd.cpp)
|
||||||
target_link_libraries(test_lookup_xsimd PRIVATE trigdx Catch2::Catch2WithMain)
|
target_link_libraries(test_lookup_xsimd PRIVATE trigdx Catch2::Catch2WithMain)
|
||||||
|
|||||||
Reference in New Issue
Block a user