-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
110 lines (85 loc) · 3.28 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
cmake_policy(SET CMP0104 OLD)
endif()
project(GpuBTree LANGUAGES CXX CUDA)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
# options
option(build_benchmarks "Build benchmarks" ON)
option(build_tests "Build tests" ON)
# Auto-detect GPU architecture, sets ${CUDA_ARCHS}
include("cmake/AutoDetectCudaArch.cmake")
# Direct all output to /bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(json_output_directory "${CMAKE_CURRENT_SOURCE_DIR}/outputs")
# B-Tree lib
add_library(gpu_btrees INTERFACE)
# CUDA and C++ compiler flags
set(CXX_FLAGS
$<IF:$<CXX_COMPILER_ID:MSVC>,
/std:c++17,
--std=c++17
>)
set(CUDA_FLAGS
$<IF:$<CXX_COMPILER_ID:MSVC>,
-Xcompiler=/std:c++17,
-Xcompiler=-std=c++17 -Wextra>
$<IF:$<CXX_COMPILER_ID:MSVC>,
-Xcompiler=/W4,
-Xcompiler=-Wall -W -Wcast-qual -Wuninitialized>
$<IF:$<CONFIG:Debug>,
-G -src-in-ptx,
-lineinfo>
${CUDA_ARCHS}
-maxrregcount=70
--expt-extended-lambda
--expt-relaxed-constexpr
-Wno-deprecated-gpu-targets #silence deprecated architectures
# $<$<CONFIG:Release>:-Xptxas -warn-spills -res-usage>
-Xptxas -warn-spills
-res-usage
)
set(external_includes "${CMAKE_CURRENT_SOURCE_DIR}/external")
set(rapidjson_includes "${rapidjson_SOURCE_DIR}/include")
set(btree_includes "${CMAKE_CURRENT_SOURCE_DIR}/include")
add_library(developer_flags INTERFACE)
target_include_directories( developer_flags
INTERFACE ${external_includes}
INTERFACE ${rapidjson_includes})
target_compile_options(developer_flags INTERFACE
$<$<COMPILE_LANGUAGE:CXX>:${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:CUDA>:${CUDA_FLAGS}>)
target_link_libraries(gpu_btrees
INTERFACE $<BUILD_INTERFACE:developer_flags>
INTERFACE $<IF:$<CXX_COMPILER_ID:MSVC>,,-lstdc++fs>)
# Visual studio setup
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
## Fix includes in visual studio for intellisense
# set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT insert_blink_custom_alloc)
# set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT insert_versioned_test)
# set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT find_versioned_test)
# set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT find_versioned_bench)
# set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT concurrent_blink_custom_alloc)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT concurrent_insert_rq_vtree)
# set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT reclaimation_test)
#set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT test_slab_alloc)
file(TO_NATIVE_PATH ${external_includes} external_includes_native)
file(TO_NATIVE_PATH ${btree_includes} btree_includes_native)
file(TO_NATIVE_PATH ${rapidjson_includes} rapidjson_includes_native)
set(CMAKE_VS_SDK_INCLUDE_DIRECTORIES
$(VC_IncludePath)
$(WindowsSDK_IncludePath)
${external_includes_native}
${btree_includes_native}
${rapidjson_includes_native}
)
add_subdirectory(include)
if(build_tests)
add_subdirectory(test)
endif(build_tests)
if(build_benchmarks)
add_subdirectory(benchmarks)
endif(build_benchmarks)