-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (65 loc) · 1.85 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
64
65
66
67
68
69
70
71
72
73
74
75
cmake_minimum_required(VERSION 3.16)
set_property(GLOBAL PROPERTY CXX_STANDARD 20)
##### GENERAL #####
project(global) # required to enable findpackage
find_package(CUDAToolkit REQUIRED)
find_package(CUDA REQUIRED)
find_package(spdlog CONFIG REQUIRED)
include_directories("/opt/cuda/include/")
include_directories("/opt/cuda/lib64/")
##### GENERAL #####
##### PROJECT 1 #####
project(cuda-1 VERSION 0.0.1)
file(GLOB SOURCE_FILES
${PROJECT_SOURCE_DIR}/test1/src/*.cpp
)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
# libraries
target_link_libraries(${PROJECT_NAME}
CUDA::cudart
"cuda"
"cudnn"
spdlog::spdlog_header_only
)
##### PROJECT 1 #####
##### PROJECT 2 #####
project(cuda-2 VERSION 0.0.1)
file(GLOB SOURCE_FILES
${PROJECT_SOURCE_DIR}/test2/src/*.cpp
${PROJECT_SOURCE_DIR}/test2/src/*.cu
)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode arch=compute_75,code=sm_75)
cuda_add_executable(${PROJECT_NAME} ${SOURCE_FILES})
# add_executable(${PROJECT_NAME} ${SOURCE_FILES})
# libraries
target_link_libraries(${PROJECT_NAME}
CUDA::cudart
"cuda"
"cudnn"
spdlog::spdlog_header_only
)
##### PROJECT 2 #####
##### PROJECT 3 #####
project(cuda-3 VERSION 0.0.1)
file(GLOB SOURCE_FILES
${PROJECT_SOURCE_DIR}/test3/src/*.cpp
${PROJECT_SOURCE_DIR}/test3/src/*.cu
)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode arch=compute_75,code=sm_75)
cuda_add_executable(${PROJECT_NAME} ${SOURCE_FILES})
# add_executable(${PROJECT_NAME} ${SOURCE_FILES})
# libraries
include_directories("${PROJECT_SOURCE_DIR}/test3/vendor/csv-parser")
target_link_libraries(${PROJECT_NAME}
CUDA::cudart
"cuda"
"cudnn"
spdlog::spdlog_header_only
)
##### PROJECT 3 #####
# set warning level 4 and warnings treated as errors
if (MSVC)
add_compile_options(/W4 /WX)
else()
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif()