-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
258 lines (209 loc) · 8.43 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
cmake_minimum_required(VERSION 3.17.3)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
# Compilers are found/set here
include(proteus-prolog)
#-----------------------------------------------------------------------
# Which binaries to build:
#-----------------------------------------------------------------------
# Tests
# not too sure if we should build "main", it looks like it has the same
# test cases as the gtests
set(UNIT_TESTS TRUE)
set(DUNIT_TESTS FALSE)
#-----------------------------------------------------------------------
# Setup environment for the project
#-----------------------------------------------------------------------
# Whether to build with CUDA or not
# Note that most of Proteus heavily relies on CUDA, and this is primarily used to enable
# building platform without cuda
set(USE_CUDA TRUE)
# Only build the platform library
set(PLATFORM_ONLY FALSE)
# Flag to control whether we should build the dependencies
option(STANDALONE "If ON, installs required subprojects. Otherwise the parent project should provide them" ON)
# Whether to enable or not VTune support, if available
set(VTUNE_ENABLE TRUE)
# FIXME: Next command is used until we move the binaries to the bin folder
set(CMAKE_INSTALL_BINDIR pelago)
# Generates only a few package, one per group, named:
set(PROTEUS_CPACK_COMP_SUFFIX_DEV "dev")
set(PROTEUS_CPACK_COMP_SUFFIX_BINARIES "bin")
set(PROTEUS_CPACK_COMP_SUFFIX_TESTS "tests")
set(PROTEUS_CPACK_COMP_SUFFIX_BENCHMARKS "bench")
set(PROTEUS_CPACK_COMP_SUFFIX_EXPERIMENTS "bench")
# Main packages shared between multiple components.
set(PROTEUS_CPACK_COMP_DEV "proteus-${PROTEUS_CPACK_COMP_SUFFIX_DEV}")
set(PROTEUS_CPACK_COMP_BINARIES "proteus-${PROTEUS_CPACK_COMP_SUFFIX_BINARIES}")
set(PROTEUS_CPACK_COMP_TESTS "proteus-${PROTEUS_CPACK_COMP_SUFFIX_TESTS}")
set(PROTEUS_CPACK_COMP_BENCHMARKS "proteus-${PROTEUS_CPACK_COMP_SUFFIX_BENCHMARKS}")
set(PROTEUS_CPACK_COMP_EXPERIMENTS "proteus-${PROTEUS_CPACK_COMP_SUFFIX_EXPERIMENTS}")
#-----------------------------------------------------------------------
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)
#-----------------------------------------------------------------------
# Now that the compilers are set, define project name and version
project(proteus VERSION 2.0 LANGUAGES C CXX)
# This has to be done after enabling languages
include(GNUInstallDirs)
include(GetPrerequisites)
#-----------------------------------------------------------------------
# Setup link flags
#-----------------------------------------------------------------------
# Manage correctly Library path
# Per https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling#always-full-rpath
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if ("${isSystemDir}" STREQUAL "-1")
# LSC: Make path relative to executable, so it works from build
# or install directories, without having to set
# LD_LIBRARY_PATH.
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
endif ("${isSystemDir}" STREQUAL "-1")
#-----------------------------------------------------------------------
# Setup Compilation flags
#-----------------------------------------------------------------------
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_CXX_STANDARD 20)
# Otherwise the -std=gnu++XX is used instead of the -std=c++XX, as one
# would expect from the property above
set(CMAKE_CXX_EXTENSIONS FALSE)
set(CXX_STANDARD_REQUIRED TRUE)
#-----------------------------------------------------------------------
# Sanitize to comply with CMP0004
# For CMAKE variables, we can use string(STRIP "" var) for this
# Place each function and data in its own section
string(STRIP "${COMPILER_FLAGS} -ffunction-sections -fdata-sections" COMPILER_FLAGS)
# By default, tune for the local machine architecture
string(STRIP "${COMPILER_FLAGS} -march=native -mtune=native" COMPILER_FLAGS)
# Hide inline methods by default
string(STRIP "${COMPILER_FLAGS} -fvisibility-inlines-hidden" COMPILER_FLAGS)
# Currently our code fails to link for -O0, -O1
string(STRIP "${COMPILER_FLAGS} -O3" COMPILER_FLAGS)
string(STRIP "${COMPILER_FLAGS} -gdwarf-4" COMPILER_FLAGS)
#-----------------------------------------------------------------------
# Add the compiler flags
string(STRIP "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS}" CMAKE_CXX_FLAGS)
string(STRIP "${CMAKE_C_FLAGS} ${COMPILER_FLAGS}" CMAKE_C_FLAGS)
# Add utilities to enable the warning flags
include(warning-flags)
#-----------------------------------------------------------------------
# Various dependencies
# Note the USE_CUDA flag is used in our cuda.cmake module
include(llvm-virtual)
include(cuda)
include(gflags)
include(glog)
include(gtest)
include(googlebenchmark)
include(magic-enum)
include(vtune)
include(tests)
include(perftests)
if (NOT PLATFORM_ONLY)
include(rapidjson)
include(cuckoo)
include(grpc)
endif()
#-----------------------------------------------------------------------
# Build Documentation
#-----------------------------------------------------------------------
find_package(Doxygen)
if (DOXYGEN_FOUND)
doxygen_add_docs(
doxygen
${CMAKE_CURRENT_SOURCE_DIR}/apps
${CMAKE_CURRENT_SOURCE_DIR}/core
${CMAKE_CURRENT_SOURCE_DIR}/runtime
COMMENT "Generate doxygen pages"
)
endif ()
install(DIRECTORY "frontends/R/" DESTINATION ${CMAKE_INSTALL_PREFIX}/pelago/frontends/R/) # Creates <..>/pelago/frontends/R
#-----------------------------------------------------------------------
# Build our libraries
#-----------------------------------------------------------------------
# build libjsmn
if (NOT PLATFORM_ONLY)
add_subdirectory(external/jsmn)
endif()
# code generation library
add_subdirectory(core/platform)
if (NOT PLATFORM_ONLY)
add_subdirectory(core/storage)
add_subdirectory(core/planner)
add_subdirectory(core/olap)
add_subdirectory(core/oltp)
add_subdirectory(core/htap)
add_subdirectory(runtime)
endif()
#-----------------------------------------------------------------------
# Build our executables
#-----------------------------------------------------------------------
add_subdirectory(apps)
if (NOT PLATFORM_ONLY)
# tests/ are integration tests, does not contain platform unit tests
add_subdirectory(tests)
endif()
#-----------------------------------------------------------------------
# Package definitions
#-----------------------------------------------------------------------
include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "${${PROJECT_NAME}_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${${PROJECT_NAME}_VERSION_MINOR}")
# Build separate package by default
set(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP)
#set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
set(CPACK_ARCHIVE_THREADS 0) # Use all cpu threads for compression, when supported
include(CPack)
cpack_add_component(${PROTEUS_CPACK_COMP_BINARIES}
DISPLAY_NAME Binaries
DESCRIPTION "Main daemon and tools"
REQUIRED
BOLD_TITLE
)
cpack_add_component(${PROTEUS_CPACK_COMP_DEV}
DISPLAY_NAME Development
DESCRIPTION "Header files, library archives"
DISABLED
BOLD_TITLE
)
cpack_add_component(${PROTEUS_CPACK_COMP_TESTS}
DISPLAY_NAME Tests
DESCRIPTION "Tests"
DISABLED
BOLD_TITLE
)
cpack_add_component(${PROTEUS_CPACK_COMP_BENCHMARKS}
DISPLAY_NAME Benchmarks
DESCRIPTION "Benchmarks"
DISABLED
BOLD_TITLE
)
#cpack_add_component(${PROTEUS_CPACK_COMP_EXPERIMENTS}
# DISPLAY_NAME Experiments
# DESCRIPTION "Experiments"
# DISABLED
# BOLD_TITLE
#)
include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEB_COMPONENT_INSTALL ON)
#cpack_add_component(${PROTEUS_DEVELOPMENT_COMPONENT})
#cpack_add_component(${PROTEUS_RUNTIME_COMPONENT})