Skip to content

Commit

Permalink
creating a single unit test executable if CUDA version is 10.2 or higher
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed May 28, 2020
1 parent 2791975 commit 1816979
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,20 @@ 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)

# 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)
if (CUDA_VERSION VERSION_LESS 10.2) # TODO(bgruber): I do not know exactly where it breaks. 9.1 does not work, 10.2 works
# 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 tests_main alpaka::alpaka 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 tests_main alpaka::alpaka Catch2::Catch2 warnings)
else()
alpaka_add_executable(tests EXCLUDE_FROM_ALL tests/main.cpp tests/dimensions.cpp)
target_include_directories(tests PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/include)
target_link_libraries(tests PUBLIC alpaka::alpaka Catch2::Catch2 warnings)
endif()

add_custom_target(examples DEPENDS mallocMC_Example01 mallocMC_Example03 VerifyHeap)

0 comments on commit 1816979

Please sign in to comment.