]>
Commit | Line | Data |
---|---|---|
1 | cmake_minimum_required(VERSION 3.16) | |
2 | ||
3 | project(ceph | |
4 | VERSION 17.2.6 | |
5 | LANGUAGES CXX C ASM) | |
6 | ||
7 | cmake_policy(SET CMP0028 NEW) | |
8 | cmake_policy(SET CMP0046 NEW) | |
9 | cmake_policy(SET CMP0048 NEW) | |
10 | cmake_policy(SET CMP0051 NEW) | |
11 | cmake_policy(SET CMP0054 NEW) | |
12 | cmake_policy(SET CMP0056 NEW) | |
13 | cmake_policy(SET CMP0065 NEW) | |
14 | cmake_policy(SET CMP0074 NEW) | |
15 | cmake_policy(SET CMP0075 NEW) | |
16 | cmake_policy(SET CMP0093 NEW) | |
17 | if(POLICY CMP0127) | |
18 | cmake_policy(SET CMP0127 NEW) | |
19 | endif() | |
20 | ||
21 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") | |
22 | ||
23 | if(NOT CMAKE_BUILD_TYPE AND EXISTS "${CMAKE_SOURCE_DIR}/.git") | |
24 | set(default_build_type "Debug") | |
25 | set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE | |
26 | STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE) | |
27 | endif() | |
28 | ||
29 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") | |
30 | set(LINUX ON) | |
31 | FIND_PACKAGE(Threads) | |
32 | elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") | |
33 | set(FREEBSD ON) | |
34 | FIND_PACKAGE(Threads) | |
35 | endif(CMAKE_SYSTEM_NAME MATCHES "Linux") | |
36 | ||
37 | if(WIN32) | |
38 | # The Windows headers (e.g. coming from mingw or the Windows SDK) check | |
39 | # the targeted Windows version. The availability of certain functions and | |
40 | # structures will depend on it. | |
41 | set(WIN32_WINNT "0x0A00" CACHE STRING "Targeted Windows version.") | |
42 | # In order to avoid known winpthread issues, we're using the boost | |
43 | # shared mutex implementation. | |
44 | # https://github.com/msys2/MINGW-packages/issues/3319 | |
45 | add_definitions( | |
46 | -D_WIN32_WINNT=${WIN32_WINNT} | |
47 | -DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN | |
48 | -DBOOST_THREAD_V2_SHARED_MUTEX | |
49 | ) | |
50 | set(Boost_THREADAPI "win32") | |
51 | endif() | |
52 | ||
53 | if(MINGW) | |
54 | string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,-allow-multiple-definition") | |
55 | string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-allow-multiple-definition") | |
56 | ||
57 | # By default, cmake generates import libs for executables. The issue is that | |
58 | # for rados and rbd, the executable import lib overrides the library import lib. | |
59 | # For example, for rados.exe, it will end up generating a librados.dll.a import lib. | |
60 | # We're providing custom rules to disable import libs for executables. | |
61 | set(CMAKE_C_LINK_EXECUTABLE | |
62 | "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") | |
63 | set(CMAKE_CXX_LINK_EXECUTABLE | |
64 | "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") | |
65 | ||
66 | link_directories(${MINGW_LINK_DIRECTORIES}) | |
67 | endif() | |
68 | ||
69 | option(WITH_CCACHE "Build with ccache.") | |
70 | if(WITH_CCACHE) | |
71 | find_program(CCACHE_EXECUTABLE ccache) | |
72 | if(NOT CCACHE_EXECUTABLE) | |
73 | message(FATAL_ERROR "Can't find ccache. Is it installed?") | |
74 | endif() | |
75 | message(STATUS "Building with ccache: ${CCACHE_EXECUTABLE}, CCACHE_DIR=$ENV{CCACHE_DIR}") | |
76 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_EXECUTABLE}") | |
77 | # ccache does not accelerate link (ld), but let it handle it. by passing it | |
78 | # along with cc to python's distutils, we are able to workaround | |
79 | # https://bugs.python.org/issue8027. | |
80 | set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_EXECUTABLE}") | |
81 | endif(WITH_CCACHE) | |
82 | ||
83 | option(WITH_MANPAGE "Build man pages." ON) | |
84 | if(WITH_MANPAGE) | |
85 | find_program(SPHINX_BUILD | |
86 | NAMES sphinx-build sphinx-build-3) | |
87 | if(NOT SPHINX_BUILD) | |
88 | message(FATAL_ERROR "Can't find sphinx-build.") | |
89 | endif(NOT SPHINX_BUILD) | |
90 | endif(WITH_MANPAGE) | |
91 | ||
92 | include_directories( | |
93 | ${PROJECT_BINARY_DIR}/src/include | |
94 | ${PROJECT_SOURCE_DIR}/src) | |
95 | ||
96 | if(WIN32) | |
97 | include_directories( | |
98 | ${PROJECT_SOURCE_DIR}/src/include/win32) | |
99 | # Boost complains if winsock2.h (or windows.h) is included before asio.hpp. | |
100 | add_compile_options("SHELL:-include winsock_wrapper.h") | |
101 | # Boost is also defining some of the errno values, we'll have | |
102 | # to avoid mismatches. | |
103 | add_compile_options("SHELL:-include win32_errno.h") | |
104 | endif() | |
105 | ||
106 | if(FREEBSD) | |
107 | include_directories(SYSTEM /usr/local/include) | |
108 | link_directories(/usr/local/lib) | |
109 | list(APPEND CMAKE_REQUIRED_INCLUDES /usr/local/include) | |
110 | endif(FREEBSD) | |
111 | ||
112 | ||
113 | #put all the libs and binaries in one place | |
114 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | |
115 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | |
116 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | |
117 | ||
118 | include(GNUInstallDirs) | |
119 | include(CephChecks) | |
120 | if(CMAKE_GENERATOR MATCHES Ninja) | |
121 | include(LimitJobs) | |
122 | endif() | |
123 | ||
124 | set(CEPH_MAN_DIR "share/man" CACHE STRING "Install location for man pages (relative to prefix).") | |
125 | ||
126 | option(ENABLE_SHARED "build shared libraries" ON) | |
127 | if(ENABLE_SHARED) | |
128 | set(CEPH_SHARED SHARED) | |
129 | else(ENABLE_SHARED) | |
130 | set(CEPH_SHARED STATIC) | |
131 | endif(ENABLE_SHARED) | |
132 | set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_SHARED}) | |
133 | ||
134 | option(WITH_STATIC_LIBSTDCXX "Link against libstdc++ statically" OFF) | |
135 | if(WITH_STATIC_LIBSTDCXX) | |
136 | if(NOT CMAKE_COMPILER_IS_GNUCXX) | |
137 | message(FATAL_ERROR "Please use GCC to enable WITH_STATIC_LIBSTDCXX") | |
138 | endif() | |
139 | set(static_linker_flags "-static-libstdc++ -static-libgcc") | |
140 | string(APPEND CMAKE_SHARED_LINKER_FLAGS " ${static_linker_flags}") | |
141 | string(APPEND CMAKE_EXE_LINKER_FLAGS " ${static_linker_flags}") | |
142 | unset(static_linker_flags) | |
143 | set(GPERFTOOLS_USE_STATIC_LIBS TRUE) | |
144 | endif() | |
145 | include(CheckCxxAtomic) | |
146 | if(NOT HAVE_CXX11_ATOMIC) | |
147 | string(APPEND CMAKE_CXX_STANDARD_LIBRARIES | |
148 | " ${LIBATOMIC_LINK_FLAGS}") | |
149 | endif() | |
150 | ||
151 | option(WITH_RDMA "Enable RDMA in async messenger" ON) | |
152 | if(WITH_RDMA) | |
153 | find_package(verbs REQUIRED) | |
154 | set(HAVE_VERBS ${VERBS_FOUND}) | |
155 | find_package(rdmacm REQUIRED) | |
156 | set(HAVE_RDMACM ${RDMACM_FOUND}) | |
157 | set(HAVE_RDMA TRUE) | |
158 | endif() | |
159 | ||
160 | find_package(Backtrace) | |
161 | ||
162 | option(WITH_RBD "Enable RADOS Block Device related targets" ON) | |
163 | ||
164 | if(LINUX) | |
165 | find_package(udev REQUIRED) | |
166 | set(HAVE_UDEV ${UDEV_FOUND}) | |
167 | find_package(blkid REQUIRED) | |
168 | set(HAVE_BLKID ${BLKID_FOUND}) | |
169 | find_package(keyutils REQUIRED) | |
170 | set(HAVE_KEYUTILS ${KEYUTILS_FOUND}) | |
171 | elseif(FREEBSD) | |
172 | set(HAVE_UDEV OFF) | |
173 | set(HAVE_LIBAIO OFF) | |
174 | set(HAVE_BLKID OFF) | |
175 | set(HAVE_KEYUTILS OFF) | |
176 | else() | |
177 | set(HAVE_UDEV OFF) | |
178 | set(HAVE_BLKID OFF) | |
179 | endif(LINUX) | |
180 | ||
181 | option(WITH_OPENLDAP "OPENLDAP is here" ON) | |
182 | if(WITH_OPENLDAP) | |
183 | find_package(OpenLDAP REQUIRED) | |
184 | set(HAVE_OPENLDAP ${OpenLDAP_FOUND}) | |
185 | endif() | |
186 | ||
187 | option(WITH_GSSAPI "GSSAPI/KRB5 is here" OFF) | |
188 | if(WITH_GSSAPI) | |
189 | find_package(GSSApi REQUIRED) | |
190 | set(HAVE_GSSAPI ${GSSApi_FOUND}) | |
191 | endif() | |
192 | ||
193 | option(WITH_FUSE "Fuse is here" ON) | |
194 | if(WITH_FUSE) | |
195 | find_package(FUSE) | |
196 | set(HAVE_LIBFUSE ${FUSE_FOUND}) | |
197 | endif() | |
198 | ||
199 | option(WITH_DOKAN "Dokan is here" OFF) | |
200 | ||
201 | option(WITH_XFS "XFS is here" ON) | |
202 | if(WITH_XFS) | |
203 | find_package(xfs) | |
204 | set(HAVE_LIBXFS ${XFS_FOUND}) | |
205 | endif() | |
206 | ||
207 | option(WITH_ZFS "enable LibZFS if found" OFF) | |
208 | if(WITH_ZFS) | |
209 | find_package(zfs) | |
210 | set(HAVE_LIBZFS ${ZFS_FOUND}) | |
211 | endif() | |
212 | ||
213 | option(WITH_BLUESTORE "Bluestore OSD backend" ON) | |
214 | if(WITH_BLUESTORE) | |
215 | if(LINUX) | |
216 | find_package(aio) | |
217 | set(HAVE_LIBAIO ${AIO_FOUND}) | |
218 | elseif(FREEBSD) | |
219 | # POSIX AIO is integrated into FreeBSD kernel, and exposed by libc. | |
220 | set(HAVE_POSIXAIO ON) | |
221 | endif() | |
222 | endif() | |
223 | ||
224 | # libcryptsetup is only available on linux | |
225 | if(WITH_RBD AND LINUX) | |
226 | find_package(libcryptsetup 2.0.5 REQUIRED) | |
227 | set(HAVE_LIBCRYPTSETUP ${LIBCRYPTSETUP_FOUND}) | |
228 | endif() | |
229 | ||
230 | include(CMakeDependentOption) | |
231 | ||
232 | CMAKE_DEPENDENT_OPTION(WITH_ZBD "Enable libzbd bluestore backend" OFF | |
233 | "WITH_BLUESTORE" OFF) | |
234 | if(WITH_ZBD) | |
235 | find_package(zbd REQUIRED) | |
236 | set(HAVE_LIBZBD ${ZBD_FOUND}) | |
237 | endif() | |
238 | ||
239 | CMAKE_DEPENDENT_OPTION(WITH_LIBURING "Enable io_uring bluestore backend" ON | |
240 | "WITH_BLUESTORE;HAVE_LIBAIO" OFF) | |
241 | set(HAVE_LIBURING ${WITH_LIBURING}) | |
242 | ||
243 | CMAKE_DEPENDENT_OPTION(WITH_SYSTEM_LIBURING "Require and build with system liburing" OFF | |
244 | "HAVE_LIBAIO;WITH_BLUESTORE" OFF) | |
245 | ||
246 | CMAKE_DEPENDENT_OPTION(WITH_BLUESTORE_PMEM "Enable PMDK libraries" OFF | |
247 | "WITH_BLUESTORE" OFF) | |
248 | ||
249 | CMAKE_DEPENDENT_OPTION(WITH_RBD_MIGRATION_FORMAT_QCOW_V1 | |
250 | "Enable librbd QCOW v1 migration format support" ON | |
251 | "WITH_RBD" OFF) | |
252 | ||
253 | CMAKE_DEPENDENT_OPTION(WITH_RBD_RWL "Enable librbd persistent write back cache" OFF | |
254 | "WITH_RBD" OFF) | |
255 | ||
256 | CMAKE_DEPENDENT_OPTION(WITH_RBD_SSD_CACHE "Enable librbd persistent write back cache for SSDs" OFF | |
257 | "WITH_RBD" OFF) | |
258 | ||
259 | CMAKE_DEPENDENT_OPTION(WITH_SYSTEM_PMDK "Require and build with system PMDK" OFF | |
260 | "WITH_RBD_RWL OR WITH_BLUESTORE_PMEM" OFF) | |
261 | ||
262 | if(WITH_BLUESTORE_PMEM) | |
263 | set(HAVE_BLUESTORE_PMEM ON) | |
264 | endif() | |
265 | ||
266 | CMAKE_DEPENDENT_OPTION(WITH_SPDK "Enable SPDK" OFF | |
267 | "CMAKE_SYSTEM_PROCESSOR MATCHES i386|i686|amd64|x86_64|AMD64|aarch64" OFF) | |
268 | if(WITH_SPDK) | |
269 | if(NOT WITH_BLUESTORE) | |
270 | message(SEND_ERROR "Please enable WITH_BLUESTORE for using SPDK") | |
271 | endif() | |
272 | include(BuildSPDK) | |
273 | build_spdk() | |
274 | set(HAVE_SPDK TRUE) | |
275 | endif(WITH_SPDK) | |
276 | ||
277 | if(WITH_BLUESTORE) | |
278 | if(NOT AIO_FOUND AND NOT HAVE_POSIXAIO AND NOT WITH_SPDK AND NOT WITH_BLUESTORE_PMEM) | |
279 | message(SEND_ERROR "WITH_BLUESTORE is ON, " | |
280 | "but none of the bluestore backends is enabled. " | |
281 | "Please install libaio, or enable WITH_SPDK or WITH_BLUESTORE_PMEM (experimental)") | |
282 | endif() | |
283 | endif() | |
284 | ||
285 | option(WITH_BLUEFS "libbluefs library" OFF) | |
286 | ||
287 | option(WITH_QAT "Enable Qat driver" OFF) | |
288 | if(WITH_QAT) | |
289 | find_package(QatDrv REQUIRED COMPONENTS qat_s usdm_drv_s) | |
290 | set(HAVE_QATDRV $(QatDrv_FOUND)) | |
291 | endif() | |
292 | ||
293 | option(WITH_QATZIP "Enable QATZIP" OFF) | |
294 | if(WITH_QATZIP) | |
295 | find_package(qatzip REQUIRED) | |
296 | set(HAVE_QATZIP ${qatzip_FOUND}) | |
297 | endif(WITH_QATZIP) | |
298 | ||
299 | # needs mds and? XXX | |
300 | option(WITH_LIBCEPHFS "libcephfs client library" ON) | |
301 | ||
302 | option(WITH_LIBCEPHSQLITE "libcephsqlite client library" ON) | |
303 | if(WITH_LIBCEPHSQLITE) | |
304 | find_package(SQLite3 REQUIRED) | |
305 | endif() | |
306 | ||
307 | # key-value store | |
308 | option(WITH_KVS "Key value store is here" OFF) | |
309 | ||
310 | option(WITH_KRBD "Enable Linux krbd support of 'rbd' utility" ON) | |
311 | ||
312 | if(WITH_KRBD AND NOT WITH_RBD) | |
313 | message(FATAL_ERROR "Cannot have WITH_KRBD without WITH_RBD.") | |
314 | endif() | |
315 | if(LINUX) | |
316 | if(WITH_LIBCEPHFS OR WITH_KRBD) | |
317 | # keyutils is only used when talking to the Linux Kernel key store | |
318 | find_package(keyutils REQUIRED) | |
319 | set(HAVE_KEYUTILS ${KEYUTILS_FOUND}) | |
320 | endif() | |
321 | endif() | |
322 | ||
323 | find_package(snappy REQUIRED) | |
324 | ||
325 | option(WITH_BROTLI "Brotli compression support" OFF) | |
326 | if(WITH_BROTLI) | |
327 | set(HAVE_BROTLI TRUE) | |
328 | endif() | |
329 | ||
330 | option(WITH_LZ4 "LZ4 compression support" ON) | |
331 | if(WITH_LZ4) | |
332 | find_package(LZ4 1.7 REQUIRED) | |
333 | set(HAVE_LZ4 ${LZ4_FOUND}) | |
334 | endif(WITH_LZ4) | |
335 | ||
336 | CMAKE_DEPENDENT_OPTION(WITH_CEPH_DEBUG_MUTEX "Use debug ceph::mutex with lockdep" ON | |
337 | "CMAKE_BUILD_TYPE STREQUAL Debug" OFF) | |
338 | ||
339 | #if allocator is set on command line make sure it matches below strings | |
340 | set(ALLOCATOR "" CACHE STRING | |
341 | "specify memory allocator to use. currently tcmalloc, tcmalloc_minimal, \ | |
342 | jemalloc, and libc is supported. if not specified, will try to find tcmalloc, \ | |
343 | and then jemalloc. If neither of then is found. use the one in libc.") | |
344 | if(ALLOCATOR) | |
345 | if(${ALLOCATOR} MATCHES "tcmalloc(_minimal)?") | |
346 | find_package(gperftools 2.6.2 REQUIRED) | |
347 | set(ALLOC_LIBS gperftools::${ALLOCATOR}) | |
348 | set(HAVE_LIBTCMALLOC ON) | |
349 | elseif(${ALLOCATOR} STREQUAL "jemalloc") | |
350 | find_package(JeMalloc REQUIRED) | |
351 | set(ALLOC_LIBS JeMalloc::JeMalloc) | |
352 | set(HAVE_JEMALLOC 1) | |
353 | elseif(NOT ALLOCATOR STREQUAL "libc") | |
354 | message(FATAL_ERROR "Unsupported allocator selected: ${ALLOCATOR}") | |
355 | endif() | |
356 | else(ALLOCATOR) | |
357 | find_package(gperftools 2.6.2) | |
358 | set(HAVE_LIBTCMALLOC ${gperftools_FOUND}) | |
359 | if(NOT gperftools_FOUND) | |
360 | find_package(JeMalloc) | |
361 | endif() | |
362 | if(gperftools_FOUND) | |
363 | set(ALLOCATOR tcmalloc) | |
364 | set(ALLOC_LIBS gperftools::tcmalloc) | |
365 | elseif(JeMalloc_FOUND) | |
366 | set(ALLOCATOR jemalloc) | |
367 | set(ALLOC_LIBS JeMalloc::JeMalloc) | |
368 | else() | |
369 | if(NOT FREEBSD) | |
370 | # FreeBSD already has jemalloc as its default allocator | |
371 | message(WARNING "tcmalloc and jemalloc not found, falling back to libc") | |
372 | endif() | |
373 | set(ALLOCATOR "libc") | |
374 | endif(gperftools_FOUND) | |
375 | endif(ALLOCATOR) | |
376 | if(NOT ALLOCATOR STREQUAL "libc") | |
377 | add_compile_options( | |
378 | $<$<COMPILE_LANGUAGE:CXX>:-fno-builtin-malloc> | |
379 | $<$<COMPILE_LANGUAGE:CXX>:-fno-builtin-calloc> | |
380 | $<$<COMPILE_LANGUAGE:CXX>:-fno-builtin-realloc> | |
381 | $<$<COMPILE_LANGUAGE:CXX>:-fno-builtin-free>) | |
382 | endif() | |
383 | ||
384 | # Mingw generates incorrect entry points when using "-pie". | |
385 | if(WIN32 OR (HAVE_LIBTCMALLOC AND WITH_STATIC_LIBSTDCXX)) | |
386 | set(EXE_LINKER_USE_PIE FALSE) | |
387 | else() | |
388 | set(EXE_LINKER_USE_PIE ${ENABLE_SHARED}) | |
389 | endif() | |
390 | ||
391 | find_package(CURL REQUIRED) | |
392 | set(CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS}) | |
393 | set(CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARIES}) | |
394 | CHECK_SYMBOL_EXISTS(curl_multi_wait curl/curl.h HAVE_CURL_MULTI_WAIT) | |
395 | ||
396 | find_package(OpenSSL REQUIRED) | |
397 | set(CRYPTO_LIBS OpenSSL::Crypto) | |
398 | ||
399 | option(WITH_DPDK "Enable DPDK messaging" OFF) | |
400 | if(WITH_DPDK) | |
401 | find_package(dpdk) | |
402 | if(NOT DPDK_FOUND) | |
403 | include(BuildDPDK) | |
404 | build_dpdk(${CMAKE_BINARY_DIR}/src/dpdk) | |
405 | endif() | |
406 | set(HAVE_DPDK TRUE) | |
407 | endif() | |
408 | ||
409 | option(WITH_BLKIN "Use blkin to emit LTTng tracepoints for Zipkin" OFF) | |
410 | if(WITH_BLKIN) | |
411 | find_package(LTTngUST REQUIRED) | |
412 | set(BLKIN_LIBRARIES blkin ${LTTNGUST_LIBRARIES} lttng-ust-fork) | |
413 | include_directories(SYSTEM src/blkin/blkin-lib) | |
414 | endif(WITH_BLKIN) | |
415 | ||
416 | option(WITH_JAEGER "Enable jaegertracing and it's dependent libraries" OFF) | |
417 | if(WITH_JAEGER) | |
418 | set(HAVE_JAEGER TRUE) | |
419 | endif() | |
420 | ||
421 | #option for RGW | |
422 | option(WITH_RADOSGW "Rados Gateway is enabled" ON) | |
423 | option(WITH_RADOSGW_BEAST_OPENSSL "Rados Gateway's Beast frontend uses OpenSSL" ON) | |
424 | option(WITH_RADOSGW_AMQP_ENDPOINT "Rados Gateway's pubsub support for AMQP push endpoint" ON) | |
425 | option(WITH_RADOSGW_KAFKA_ENDPOINT "Rados Gateway's pubsub support for Kafka push endpoint" ON) | |
426 | option(WITH_RADOSGW_LUA_PACKAGES "Rados Gateway's support for dynamically adding lua packagess" ON) | |
427 | option(WITH_RADOSGW_DBSTORE "DBStore backend for Rados Gateway" ON) | |
428 | option(WITH_RADOSGW_SELECT_PARQUET "Support for s3 select on parquet objects" ON) | |
429 | ||
430 | option(WITH_SYSTEM_ARROW "Use system-provided arrow" OFF) | |
431 | option(WITH_SYSTEM_UTF8PROC "Use system-provided utf8proc" OFF) | |
432 | ||
433 | if(WITH_RADOSGW) | |
434 | find_package(EXPAT REQUIRED) | |
435 | find_package(OATH REQUIRED) | |
436 | ||
437 | # https://curl.haxx.se/docs/install.html mentions the | |
438 | # configure flags for various ssl backends | |
439 | execute_process( | |
440 | COMMAND | |
441 | "sh" "-c" | |
442 | "curl-config --configure | grep with-ssl" | |
443 | RESULT_VARIABLE NO_CURL_SSL_LINK | |
444 | ERROR_VARIABLE CURL_CONFIG_ERRORS | |
445 | ) | |
446 | if (CURL_CONFIG_ERRORS) | |
447 | message(WARNING "unable to run curl-config; rgw cannot make ssl requests to external systems reliably") | |
448 | endif() | |
449 | ||
450 | if (NOT NO_CURL_SSL_LINK) | |
451 | message(STATUS "libcurl is linked with openssl: explicitly setting locks") | |
452 | set(WITH_CURL_OPENSSL ON) | |
453 | endif() # CURL_SSL_LINK | |
454 | execute_process( | |
455 | COMMAND | |
456 | "sh" "-c" | |
457 | "objdump -p ${OPENSSL_SSL_LIBRARY} | sed -n 's/^ SONAME *//p'" | |
458 | OUTPUT_VARIABLE LIBSSL_SONAME | |
459 | ERROR_VARIABLE OBJDUMP_ERRORS | |
460 | RESULT_VARIABLE OBJDUMP_RESULTS | |
461 | OUTPUT_STRIP_TRAILING_WHITESPACE) | |
462 | if (OBJDUMP_RESULTS) | |
463 | message(FATAL_ERROR "can't run objdump: ${OBJDUMP_RESULTS}") | |
464 | endif() | |
465 | if (NOT OBJDUMP_ERRORS STREQUAL "") | |
466 | message(WARNING "message from objdump: ${OBJDUMP_ERRORS}") | |
467 | endif() | |
468 | execute_process( | |
469 | COMMAND | |
470 | "sh" "-c" | |
471 | "objdump -p ${OPENSSL_CRYPTO_LIBRARY} | sed -n 's/^ SONAME *//p'" | |
472 | OUTPUT_VARIABLE LIBCRYPTO_SONAME | |
473 | ERROR_VARIABLE OBJDUMP_ERRORS | |
474 | RESULT_VARIABLE OBJDUMP_RESULTS | |
475 | OUTPUT_STRIP_TRAILING_WHITESPACE) | |
476 | if (OBJDUMP_RESULTS) | |
477 | message(FATAL_ERROR "can't run objdump: ${OBJDUMP_RESULTS}") | |
478 | endif() | |
479 | if (NOT OBJDUMP_ERRORS STREQUAL "") | |
480 | message(WARNING "message from objdump: ${OBJDUMP_ERRORS}") | |
481 | endif() | |
482 | message(STATUS "ssl soname: ${LIBSSL_SONAME}") | |
483 | message(STATUS "crypto soname: ${LIBCRYPTO_SONAME}") | |
484 | endif (WITH_RADOSGW) | |
485 | ||
486 | #option for CephFS | |
487 | option(WITH_CEPHFS "CephFS is enabled" ON) | |
488 | ||
489 | if(NOT WIN32) | |
490 | # Please specify 3.[0-7] if you want to build with a certain version of python3. | |
491 | set(WITH_PYTHON3 "3" CACHE STRING "build with specified python3 version") | |
492 | find_package(Python3 ${WITH_PYTHON3} EXACT REQUIRED | |
493 | COMPONENTS Interpreter Development) | |
494 | ||
495 | option(WITH_MGR "ceph-mgr is enabled" ON) | |
496 | if(WITH_MGR) | |
497 | set(MGR_PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) | |
498 | set(MGR_PYTHON_LIBRARIES ${Python3_LIBRARIES}) | |
499 | set(MGR_PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR}) | |
500 | set(MGR_PYTHON_VERSION_MINOR ${Python3_VERSION_MINOR}) | |
501 | # Boost dependency check deferred to Boost section | |
502 | endif(WITH_MGR) | |
503 | endif(NOT WIN32) | |
504 | ||
505 | option(WITH_THREAD_SAFE_RES_QUERY "res_query is thread safe" OFF) | |
506 | if(WITH_THREAD_SAFE_RES_QUERY) | |
507 | set(HAVE_THREAD_SAFE_RES_QUERY 1 CACHE INTERNAL "Thread safe res_query supported.") | |
508 | endif() | |
509 | ||
510 | option(WITH_REENTRANT_STRSIGNAL "strsignal is reentrant" OFF) | |
511 | if(WITH_REENTRANT_STRSIGNAL) | |
512 | set(HAVE_REENTRANT_STRSIGNAL 1 CACHE INTERNAL "Reentrant strsignal is supported.") | |
513 | endif() | |
514 | ||
515 | # -lz link into kv | |
516 | find_package(ZLIB REQUIRED) | |
517 | ||
518 | #option for EventTrace | |
519 | CMAKE_DEPENDENT_OPTION( | |
520 | WITH_EVENTTRACE "Event tracing support, requires WITH_LTTNG" | |
521 | OFF "USE_LTTNG" OFF) | |
522 | ||
523 | #option for LTTng | |
524 | option(WITH_LTTNG "LTTng tracing is enabled" ON) | |
525 | if(${WITH_LTTNG}) | |
526 | find_package(LTTngUST REQUIRED) | |
527 | find_program(LTTNG_GEN_TP | |
528 | lttng-gen-tp) | |
529 | if(NOT LTTNG_GEN_TP) | |
530 | message(FATAL_ERROR "Can't find lttng-gen-tp.") | |
531 | endif() | |
532 | endif(${WITH_LTTNG}) | |
533 | ||
534 | option(WITH_OSD_INSTRUMENT_FUNCTIONS OFF) | |
535 | ||
536 | #option for Babeltrace | |
537 | option(WITH_BABELTRACE "Babeltrace libraries are enabled" ON) | |
538 | if(WITH_BABELTRACE) | |
539 | set(HAVE_BABELTRACE ON) | |
540 | find_package(babeltrace REQUIRED) | |
541 | set(HAVE_BABELTRACE_BABELTRACE_H ${BABELTRACE_FOUND}) | |
542 | set(HAVE_BABELTRACE_CTF_EVENTS_H ${BABELTRACE_FOUND}) | |
543 | set(HAVE_BABELTRACE_CTF_ITERATOR_H ${BABELTRACE_FOUND}) | |
544 | endif(WITH_BABELTRACE) | |
545 | ||
546 | option(DEBUG_GATHER "C_Gather debugging is enabled" ON) | |
547 | option(ENABLE_COVERAGE "Coverage is enabled" OFF) | |
548 | option(PG_DEBUG_REFS "PG Ref debugging is enabled" OFF) | |
549 | ||
550 | option(WITH_TESTS "enable the build of ceph-test package scripts/binaries" ON) | |
551 | set(UNIT_TESTS_BUILT ${WITH_TESTS}) | |
552 | set(CEPH_TEST_TIMEOUT 3600 CACHE STRING | |
553 | "Maximum time before a CTest gets killed" ) | |
554 | ||
555 | # fio | |
556 | option(WITH_FIO "build with fio plugin enabled" OFF) | |
557 | if(WITH_FIO) | |
558 | include(BuildFIO) | |
559 | build_fio() | |
560 | endif() | |
561 | ||
562 | if(LINUX) | |
563 | add_definitions(-D__linux__) | |
564 | endif(LINUX) | |
565 | ||
566 | # ASAN and friends | |
567 | option(WITH_ASAN "build with ASAN" OFF) | |
568 | if(WITH_ASAN) | |
569 | list(APPEND sanitizers "address") | |
570 | endif() | |
571 | ||
572 | option(WITH_ASAN_LEAK "explicitly enable ASAN leak detection" OFF) | |
573 | if(WITH_ASAN_LEAK) | |
574 | list(APPEND sanitizers "leak") | |
575 | endif() | |
576 | ||
577 | option(WITH_TSAN "build with TSAN" OFF) | |
578 | if(WITH_TSAN) | |
579 | list(APPEND sanitizers "thread") | |
580 | endif() | |
581 | ||
582 | option(WITH_UBSAN "build with UBSAN" OFF) | |
583 | if(WITH_UBSAN) | |
584 | list(APPEND sanitizers "undefined_behavior") | |
585 | endif() | |
586 | ||
587 | if(sanitizers) | |
588 | find_package(Sanitizers REQUIRED ${sanitizers}) | |
589 | add_compile_options(${Sanitizers_COMPILE_OPTIONS}) | |
590 | string(REPLACE ";" " " sanitiers_compile_flags "${Sanitizers_COMPILE_OPTIONS}") | |
591 | string(APPEND CMAKE_EXE_LINKER_FLAGS " ${sanitiers_compile_flags}") | |
592 | string(APPEND CMAKE_SHARED_LINKER_FLAGS " ${sanitiers_compile_flags}") | |
593 | endif() | |
594 | ||
595 | # Rocksdb | |
596 | option(WITH_SYSTEM_ROCKSDB "require and build with system rocksdb" OFF) | |
597 | if (WITH_SYSTEM_ROCKSDB) | |
598 | find_package(RocksDB 5.14 REQUIRED) | |
599 | endif() | |
600 | ||
601 | option(WITH_SEASTAR "Build seastar components") | |
602 | set(HAVE_SEASTAR ${WITH_SEASTAR}) | |
603 | ||
604 | # Boost | |
605 | option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF) | |
606 | ||
607 | # Boost::thread depends on Boost::atomic, so list it explicitly. | |
608 | set(BOOST_COMPONENTS | |
609 | atomic chrono thread system regex random program_options date_time | |
610 | iostreams context coroutine) | |
611 | set(BOOST_HEADER_COMPONENTS container) | |
612 | ||
613 | if(WITH_MGR) | |
614 | list(APPEND BOOST_COMPONENTS | |
615 | python${MGR_PYTHON_VERSION_MAJOR}${MGR_PYTHON_VERSION_MINOR}) | |
616 | endif() | |
617 | if(WITH_SEASTAR) | |
618 | list(APPEND BOOST_COMPONENTS timer) | |
619 | endif() | |
620 | ||
621 | if(WITH_RADOSGW AND WITH_RADOSGW_LUA_PACKAGES) | |
622 | list(APPEND BOOST_COMPONENTS filesystem) | |
623 | endif() | |
624 | ||
625 | set(Boost_USE_MULTITHREADED ON) | |
626 | # require minimally the bundled version | |
627 | if(WITH_SYSTEM_BOOST) | |
628 | if(ENABLE_SHARED) | |
629 | set(Boost_USE_STATIC_LIBS OFF) | |
630 | else() | |
631 | set(Boost_USE_STATIC_LIBS ON) | |
632 | endif() | |
633 | if(BOOST_ROOT AND CMAKE_LIBRARY_ARCHITECTURE) | |
634 | set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE}") | |
635 | endif() | |
636 | find_package(Boost 1.73 COMPONENTS ${BOOST_COMPONENTS} REQUIRED) | |
637 | if(NOT ENABLE_SHARED) | |
638 | set_property(TARGET Boost::iostreams APPEND PROPERTY | |
639 | INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) | |
640 | endif() | |
641 | else() | |
642 | set(BOOST_J 1 CACHE STRING | |
643 | "max jobs for Boost build") # override w/-DBOOST_J=<n> | |
644 | set(Boost_USE_STATIC_LIBS ON) | |
645 | include(BuildBoost) | |
646 | build_boost(1.75 | |
647 | COMPONENTS ${BOOST_COMPONENTS} ${BOOST_HEADER_COMPONENTS}) | |
648 | endif() | |
649 | include_directories(BEFORE SYSTEM ${Boost_INCLUDE_DIRS}) | |
650 | ||
651 | # dashboard angular2 frontend | |
652 | option(WITH_MGR_DASHBOARD_FRONTEND "Build the mgr/dashboard frontend using `npm`" ON) | |
653 | option(WITH_SYSTEM_NPM "Assume that dashboard build tools already installed through packages" OFF) | |
654 | if(WITH_SYSTEM_NPM) | |
655 | find_program(NPM_EXECUTABLE npm) | |
656 | if(NOT NPM_EXECUTABLE) | |
657 | message(FATAL_ERROR "Can't find npm.") | |
658 | endif() | |
659 | endif() | |
660 | set(DASHBOARD_FRONTEND_LANGS "" CACHE STRING | |
661 | "List of comma separated ceph-dashboard frontend languages to build. \ | |
662 | Use value `ALL` to build all languages") | |
663 | CMAKE_DEPENDENT_OPTION(WITH_MGR_ROOK_CLIENT "Enable the mgr's Rook support" ON | |
664 | "WITH_MGR" OFF) | |
665 | ||
666 | include_directories(SYSTEM ${PROJECT_BINARY_DIR}/include) | |
667 | ||
668 | find_package(Threads REQUIRED) | |
669 | find_package(StdFilesystem REQUIRED) | |
670 | ||
671 | option(WITH_SELINUX "build SELinux policy" OFF) | |
672 | if(WITH_SELINUX) | |
673 | find_file(SELINUX_MAKEFILE selinux/devel/Makefile | |
674 | PATH /usr/share) | |
675 | if(NOT SELINUX_MAKEFILE) | |
676 | message(FATAL_ERROR "Can't find selinux's Makefile") | |
677 | endif() | |
678 | add_subdirectory(selinux) | |
679 | endif(WITH_SELINUX) | |
680 | ||
681 | # enables testing and creates Make check command | |
682 | add_custom_target(tests | |
683 | COMMENT "Building tests") | |
684 | enable_testing() | |
685 | set(CMAKE_CTEST_COMMAND ctest) | |
686 | add_custom_target(check | |
687 | COMMAND ${CMAKE_CTEST_COMMAND} | |
688 | DEPENDS tests) | |
689 | ||
690 | option(WITH_SYSTEMD "build with systemd support" ON) | |
691 | ||
692 | add_subdirectory(src) | |
693 | ||
694 | add_subdirectory(qa) | |
695 | add_subdirectory(doc) | |
696 | if(WITH_MANPAGE) | |
697 | add_subdirectory(man) | |
698 | endif(WITH_MANPAGE) | |
699 | ||
700 | if(WITH_SYSTEMD) | |
701 | add_subdirectory(systemd) | |
702 | endif() | |
703 | ||
704 | if(LINUX) | |
705 | add_subdirectory(etc/sysctl) | |
706 | endif() | |
707 | ||
708 | option(WITH_GRAFANA "install grafana dashboards" OFF) | |
709 | add_subdirectory(monitoring/ceph-mixin) | |
710 | ||
711 | CMAKE_DEPENDENT_OPTION(WITH_BOOST_VALGRIND "Boost support for valgrind" OFF | |
712 | "NOT WITH_SYSTEM_BOOST" OFF) | |
713 | ||
714 | include(CTags) | |
715 | option(CTAG_EXCLUDES "Exclude files/directories when running ctag.") | |
716 | add_tags(ctags | |
717 | SRC_DIR src | |
718 | TAG_FILE tags | |
719 | EXCLUDE_OPTS ${CTAG_EXCLUDES} | |
720 | EXCLUDES "*.js" "*.css" ".tox" "python-common/build") | |
721 | add_custom_target(tags DEPENDS ctags) |