File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 4.0 )
22project (memlayout LANGUAGES CXX )
33
4- # option(ENABLE_CPU "Build CPU tests" ON )
5- # option(ENABLE_CUDA "Build CUDA tests" ON )
4+ option (BUILD_TESTING "Build unit tests" OFF )
5+ option (BUILD_DOCS "Build documentation" OFF )
66
77add_subdirectory (memlayout )
88
9- add_subdirectory (tests EXCLUDE_FROM_ALL )
9+ if (BUILD_TESTING)
10+ add_subdirectory (tests )
11+ endif ()
1012
11- add_subdirectory (docs EXCLUDE_FROM_ALL )
13+ if (BUILD_DOCS)
14+ add_subdirectory (docs )
15+ endif ()
Original file line number Diff line number Diff line change 1+ set (CMAKE_CXX_STANDARD 20)
2+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
3+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -O3" )
4+
15include (FetchContent )
26FetchContent_Declare (
37 googletest
@@ -10,4 +14,9 @@ include(GoogleTest)
1014
1115add_subdirectory (cpu )
1216
13- add_subdirectory (gpu )
17+ find_package (CUDAToolkit QUIET )
18+ if (CUDAToolkit_FOUND OR CMAKE_CUDA_COMPILER)
19+ add_subdirectory (gpu )
20+ else ()
21+ message (STATUS "CUDA not found - skipping GPU tests" )
22+ endif ()
Original file line number Diff line number Diff line change 1- set (CMAKE_CXX_STANDARD 20)
2- set (CMAKE_CXX_STANDARD_REQUIRED ON )
3- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -O3" )
4-
51add_executable (test_cpu test_cpu.cpp )
62target_include_directories (test_cpu PUBLIC ${CMAKE_SOURCE_DIR } /tests/include )
73target_link_libraries (test_cpu PRIVATE memlayout::Wrapper GTest::gtest_main )
You can’t perform that action at this time.
0 commit comments