-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (61 loc) · 1.92 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
76
77
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.10)
project(icp LANGUAGES CUDA CXX)
# -------------------- benchmark -----------------------
include(FetchContent)
FetchContent_Declare(
googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG origin/master
)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "FromGtest")
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "FromGtest")
FetchContent_MakeAvailable(googlebenchmark)
# -------------------- Eigen -----------------------
add_subdirectory(lib)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
# -------------------- Flags -----------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "-std=c++17")
set(CMAKE_CXX_FLAGS_DEBUG "-g3 -Werror")
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
# -------------------- Policies -----------------------
find_package(CUDA REQUIRED)
cmake_policy(SET CMP0104 OLD)
# -------------------- CPU -----------------------
set(SRCS
src/main.cc
src/load.cc
src/cpu.cc
)
set(HEADERS
src/cpu.hh
)
# -------------------- GPU -----------------------
set(SRCS_GPU
src/GPU/main.cc
src/GPU/gpu.cc
src/load.cc
)
set(HEADERS_GPU
src/load.hh
src/GPU/gpu.hh
)
# -------------------- GPU Compute -----------------------
set(SRCS_COMPUTE
src/GPU/compute.cu
)
set(HEADERS_COMPUTE
src/GPU/gpu.hh
)
add_library(compute)
target_compile_features(compute PUBLIC cxx_std_14)
target_sources(compute PRIVATE ${SRCS_GPU} ${HEADERS_GPU})
set_target_properties(compute PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_link_libraries(compute Eigen3::Eigen)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../)
add_executable(icp ${SRCS} ${HEADERS})
add_executable(icp-gpu ${SRCS_COMPUTE} ${HEADERS_COMPUTE})
add_executable(bench src/bench.cc src/load.cc src/cpu.cc src/GPU/compute.cu src/GPU/gpu.cc ${HEADERS_GPU} ${HEADERS})
target_link_libraries(icp Eigen3::Eigen)
target_link_libraries(icp-gpu compute)
target_link_libraries(bench Eigen3::Eigen benchmark::benchmark)