Skip to content

Commit

Permalink
moved test main into separate library
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed May 28, 2020
1 parent fada7b2 commit 2791975
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,14 @@ alpaka_add_executable(VerifyHeap EXCLUDE_FROM_ALL tests/verify_heap.cpp tests/ve
target_include_directories(VerifyHeap PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(VerifyHeap PUBLIC alpaka::alpaka warnings)

alpaka_add_executable(tests EXCLUDE_FROM_ALL tests/main.cpp tests/dimensions.cpp)
# the catch2 main needs to be in a non-CUDA file before CUDA 10.2, because nvcc fails to compile the catch2 header
# TODO: merge the test_main back into the tests exe, once CUDA 10.2 is the minimum version
add_library(tests_main EXCLUDE_FROM_ALL tests/main.cpp)
target_include_directories(tests_main PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(tests_main PUBLIC Catch2::Catch2 warnings)

alpaka_add_executable(tests EXCLUDE_FROM_ALL tests/dimensions.cpp)
target_include_directories(tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(tests PUBLIC alpaka::alpaka Catch2::Catch2 warnings)
target_link_libraries(tests PUBLIC tests_main alpaka::alpaka Catch2::Catch2 warnings)

add_custom_target(examples DEPENDS mallocMC_Example01 mallocMC_Example03 VerifyHeap)
2 changes: 0 additions & 2 deletions tests/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#ifndef __NVCC__
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#endif

0 comments on commit 2791975

Please sign in to comment.