-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
180 lines (152 loc) · 5.55 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
# Copyright 2018-2023 Project Tsurugi.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.16)
project(jogasaki
VERSION 1.0.0
DESCRIPTION "Jogasaki SQL Execution Engine"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
option(ENABLE_SANITIZER "enable sanitizer on debug build" ON)
option(ENABLE_UB_SANITIZER "enable undefined behavior sanitizer on debug build" OFF)
option(ENABLE_COVERAGE "enable coverage on debug build" OFF)
option(BUILD_TESTS "Build test programs" ON)
option(BUILD_EXAMPLES "Build example programs" ON)
option(BUILD_DOCUMENTS "build documents" ON)
option(INSTALL_EXAMPLES "install examples" OFF)
option(BUILD_SHARED_LIBS "build shared libraries instead of static" ON)
option(ENABLE_GOOGLE_PERFTOOLS "Enable Google Perftools" OFF)
option(PERFORMANCE_TOOLS "Enable tooling to measure engine performance" OFF)
option(ENABLE_CACHE_ALIGN "enable optional cache align requirement" OFF)
option(TRACY_ENABLE "enable tracy profiler" OFF)
option(INSTALL_API_ONLY "configure cmake build dir. just to install public api files. No build runs. This is used to provide api files to components outside jogasaki" OFF)
option(LIKWID_ENABLE "enable likwid hardware counter profiling" OFF)
option(ENABLE_ALTIMETER "enable altimeter integration" OFF)
if (ENABLE_GOOGLE_PERFTOOLS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_GOOGLE_PERFTOOLS")
endif()
if(NOT DEFINED SHARKSFIN_IMPLEMENTATION)
set(
SHARKSFIN_IMPLEMENTATION "memory"
CACHE STRING
"sharksfin target name to link"
FORCE
)
endif()
set(tateyama_package "tateyama-${SHARKSFIN_IMPLEMENTATION}")
set(tateyama_engine "${tateyama_package}-engine")
set(ENGINE "engine")
if (NOT INSTALL_API_ONLY)
find_package(${tateyama_package} REQUIRED)
find_package(takatori REQUIRED)
find_package(yugawara REQUIRED)
find_package(mizugaki REQUIRED)
find_package(sharksfin REQUIRED)
find_package(tsl-hopscotch-map 2.2 REQUIRED)
find_package(moodycamel QUIET)
find_package(Doxygen)
find_package(glog REQUIRED)
find_package(gflags REQUIRED)
find_package(Threads REQUIRED)
find_package(Boost
COMPONENTS filesystem thread system container stacktrace_backtrace
REQUIRED
)
find_package(TBB REQUIRED)
if(PERFORMANCE_TOOLS)
find_package(performance-tools REQUIRED)
endif()
find_package(Protobuf REQUIRED)
find_package(mpdecpp REQUIRED)
find_package(likwid QUIET)
if(ENABLE_ALTIMETER)
find_package(fmt REQUIRED)
find_package(altimeter REQUIRED)
endif()
# to suppress not-found warnings
set(re2Alt_FIND_QUIETLY TRUE)
set(c-aresAlt_FIND_QUIETLY TRUE)
set(lz4Alt_FIND_QUIETLY TRUE)
set(ThriftAlt_FIND_QUIETLY TRUE)
set(zstdAlt_FIND_QUIETLY TRUE)
# Arrow/Parquet dependencies
find_package(Arrow REQUIRED)
# Be lenient for newer Arrow versions
# find_package version range selector ... is available on cmake 3.19 or newer
set(SUPPORTED_ARROW_VERSION 14)
if(NOT DEFINED Arrow_VERSION_MAJOR OR Arrow_VERSION_MAJOR LESS ${SUPPORTED_ARROW_VERSION})
message(FATAL_ERROR "Arrow_VERSION_MAJOR (${Arrow_VERSION_MAJOR}) is not defined or less than the supported version (${SUPPORTED_ARROW_VERSION}). Install Arrow version that is compatible with supported version.")
endif()
get_filename_component(MY_SEARCH_DIR ${Arrow_CONFIG} DIRECTORY)
find_package(Parquet REQUIRED HINTS ${MY_SEARCH_DIR})
add_subdirectory(third_party) # should be before enable_testing()
endif()
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(CompileOptions)
include(InstallOptions)
if (BUILD_TESTS OR BUILD_EXAMPLES)
enable_testing()
endif()
set(export_name "jogasaki-${SHARKSFIN_IMPLEMENTATION}")
set(package_name "jogasaki-${SHARKSFIN_IMPLEMENTATION}")
add_library(api INTERFACE)
target_include_directories(api
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/jogasaki>
)
target_link_libraries(api
INTERFACE takatori
INTERFACE yugawara
)
if (NOT INSTALL_API_ONLY)
add_subdirectory(src)
add_subdirectory(mock)
if(BUILD_TESTS)
add_subdirectory(test)
endif()
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if (BUILD_DOCUMENTS)
add_subdirectory(doxygen)
endif()
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${package_name}-config.cmake
@ONLY
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${package_name}-config-version.cmake"
COMPATIBILITY SameMajorVersion
)
install_custom(api ${export_name})
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${package_name}-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${package_name}-config-version.cmake
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}
)
install(
EXPORT ${package_name}
NAMESPACE ${package_name}-
FILE ${package_name}-targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}
EXPORT_LINK_INTERFACE_LIBRARIES
)