-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
63 lines (49 loc) · 1.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
cmake_minimum_required(VERSION 3.0.0)
project(CuCAMASim_runner VERSION 0.1.0 LANGUAGES C CXX CUDA)
find_package(CUDAToolkit)
include(CTest)
enable_testing()
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
# Set C++ standard to C++17 or later for std::filesystem support
set(CMAKE_CXX_STANDARD 17)
# set debug build type
# set(CMAKE_BUILD_TYPE Debug)
# add debug symbols and disable optimizations for debug builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Check if the compiler is GNU or Clang
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Add debug symbols and disable optimizations
add_compile_options(-g -O0)
endif()
endif()
# Include header files from specific directories
include_directories(
${CMAKE_SOURCE_DIR}/CuCAMASim/include/
${CMAKE_SOURCE_DIR}/applications/DecisionTree/
)
add_subdirectory(./CuCAMASim)
add_subdirectory(./applications/DecisionTree)
add_executable(CuCAMASim_runner main.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
# Adjusting CUDA flags
set_target_properties(CuCAMASim_runner PROPERTIES CUDA_ARCHITECTURES 61)
# Linking libraries
target_link_libraries(CuCAMASim_runner PRIVATE CUDA::cudart)
target_link_libraries(CuCAMASim_runner PUBLIC CuCAMASim DecisionTree)
# Link against filesystem library if using GCC version < 9
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
target_link_libraries(CuCAMASim_runner PRIVATE stdc++fs)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(CuCAMASim_runner PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-G>)
endif()
set_target_properties(CuCAMASim_runner PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
# Treat warnings as errors for C and C++ files
if(MSVC)
target_compile_options(CuCAMASim_runner PRIVATE /W4 /WX)
else()
target_compile_options(CuCAMASim_runner PRIVATE -Wall -Wextra -Werror)
endif()