1 cmake_minimum_required(VERSION 3.16)
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 foreach(policy CMP0127 CMP0135)
19 cmake_policy(SET ${policy} NEW)
23 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
25 if(NOT CMAKE_BUILD_TYPE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
26 set(default_build_type "Debug")
27 set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
28 STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE)
31 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
34 elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
37 endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
40 # The Windows headers (e.g. coming from mingw or the Windows SDK) check
41 # the targeted Windows version. The availability of certain functions and
42 # structures will depend on it.
43 set(WIN32_WINNT "0x0A00" CACHE STRING "Targeted Windows version.")
44 # In order to avoid known winpthread issues, we're using the boost
45 # shared mutex implementation.
46 # https://github.com/msys2/MINGW-packages/issues/3319
48 -D_WIN32_WINNT=${WIN32_WINNT}
49 -DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
50 -DBOOST_THREAD_V2_SHARED_MUTEX
52 set(Boost_THREADAPI "win32")
56 string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,-allow-multiple-definition")
57 string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-allow-multiple-definition")
59 # By default, cmake generates import libs for executables. The issue is that
60 # for rados and rbd, the executable import lib overrides the library import lib.
61 # For example, for rados.exe, it will end up generating a librados.dll.a import lib.
62 # We're providing custom rules to disable import libs for executables.
63 set(CMAKE_C_LINK_EXECUTABLE
64 "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
65 set(CMAKE_CXX_LINK_EXECUTABLE
66 "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
68 link_directories(${MINGW_LINK_DIRECTORIES})
71 option(WITH_CCACHE "Build with ccache.")
73 if(CMAKE_C_COMPILER_LAUNCHER OR CMAKE_CXX_COMPILER_LAUNCHER)
74 message(WARNING "Compiler launcher already set. stop configuring ccache")
76 find_program(CCACHE_EXECUTABLE ccache)
77 if(NOT CCACHE_EXECUTABLE)
78 message(FATAL_ERROR "Can't find ccache. Is it installed?")
80 message(STATUS "Building with ccache: ${CCACHE_EXECUTABLE}, CCACHE_DIR=$ENV{CCACHE_DIR}")
81 set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
82 set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
86 option(WITH_MANPAGE "Build man pages." ON)
88 find_program(SPHINX_BUILD
89 NAMES sphinx-build sphinx-build-3)
91 message(FATAL_ERROR "Can't find sphinx-build.")
92 endif(NOT SPHINX_BUILD)
96 ${PROJECT_BINARY_DIR}/src/include
97 ${PROJECT_SOURCE_DIR}/src)
101 ${PROJECT_SOURCE_DIR}/src/include/win32)
102 # Boost complains if winsock2.h (or windows.h) is included before asio.hpp.
103 add_compile_options("SHELL:-include winsock_wrapper.h")
104 # Boost is also defining some of the errno values, we'll have
105 # to avoid mismatches.
106 add_compile_options("SHELL:-include win32_errno.h")
110 include_directories(SYSTEM /usr/local/include)
111 link_directories(/usr/local/lib)
112 list(APPEND CMAKE_REQUIRED_INCLUDES /usr/local/include)
116 #put all the libs and binaries in one place
117 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
118 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
119 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
121 include(GNUInstallDirs)
123 if(CMAKE_GENERATOR MATCHES Ninja)
127 set(CEPH_MAN_DIR "share/man" CACHE STRING "Install location for man pages (relative to prefix).")
129 option(ENABLE_SHARED "build shared libraries" ON)
131 set(CEPH_SHARED SHARED)
133 set(CEPH_SHARED STATIC)
135 set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_SHARED})
137 option(WITH_STATIC_LIBSTDCXX "Link against libstdc++ statically" OFF)
138 if(WITH_STATIC_LIBSTDCXX)
139 if(NOT CMAKE_COMPILER_IS_GNUCXX)
140 message(FATAL_ERROR "Please use GCC to enable WITH_STATIC_LIBSTDCXX")
142 set(static_linker_flags "-static-libstdc++ -static-libgcc")
143 string(APPEND CMAKE_SHARED_LINKER_FLAGS " ${static_linker_flags}")
144 string(APPEND CMAKE_EXE_LINKER_FLAGS " ${static_linker_flags}")
145 unset(static_linker_flags)
146 set(GPERFTOOLS_USE_STATIC_LIBS TRUE)
148 include(CheckCxxAtomic)
149 if(NOT HAVE_CXX11_ATOMIC)
150 string(APPEND CMAKE_CXX_STANDARD_LIBRARIES
151 " ${LIBATOMIC_LINK_FLAGS}")
154 option(WITH_RDMA "Enable RDMA in async messenger" ON)
156 find_package(verbs REQUIRED)
157 set(HAVE_VERBS ${VERBS_FOUND})
158 find_package(rdmacm REQUIRED)
159 set(HAVE_RDMACM ${RDMACM_FOUND})
163 find_package(Backtrace)
165 option(WITH_RBD "Enable RADOS Block Device related targets" ON)
168 find_package(udev REQUIRED)
169 set(HAVE_UDEV ${UDEV_FOUND})
170 find_package(blkid REQUIRED)
171 set(HAVE_BLKID ${BLKID_FOUND})
172 find_package(keyutils REQUIRED)
173 set(HAVE_KEYUTILS ${KEYUTILS_FOUND})
179 set(HAVE_KEYUTILS OFF)
185 option(WITH_OPENLDAP "OPENLDAP is here" ON)
187 find_package(OpenLDAP REQUIRED)
188 set(HAVE_OPENLDAP ${OpenLDAP_FOUND})
191 option(WITH_GSSAPI "GSSAPI/KRB5 is here" OFF)
193 find_package(GSSApi REQUIRED)
194 set(HAVE_GSSAPI ${GSSApi_FOUND})
197 option(WITH_FUSE "Fuse is here" ON)
199 find_package(FUSE REQUIRED)
200 set(HAVE_LIBFUSE ${FUSE_FOUND})
203 option(WITH_DOKAN "Dokan is here" OFF)
205 option(WITH_XFS "XFS is here" ON)
208 set(HAVE_LIBXFS ${XFS_FOUND})
211 option(WITH_ZFS "enable LibZFS if found" OFF)
214 set(HAVE_LIBZFS ${ZFS_FOUND})
217 option(WITH_BLUESTORE "Bluestore OSD backend" ON)
221 set(HAVE_LIBAIO ${AIO_FOUND})
223 # POSIX AIO is integrated into FreeBSD kernel, and exposed by libc.
224 set(HAVE_POSIXAIO ON)
228 # libcryptsetup is only available on linux
229 if(WITH_RBD AND LINUX)
230 find_package(libcryptsetup 2.0.5 REQUIRED)
231 set(HAVE_LIBCRYPTSETUP ${LIBCRYPTSETUP_FOUND})
234 include(CMakeDependentOption)
236 CMAKE_DEPENDENT_OPTION(WITH_ZBD "Enable libzbd bluestore backend" OFF
237 "WITH_BLUESTORE" OFF)
239 find_package(zbd REQUIRED)
240 set(HAVE_LIBZBD ${ZBD_FOUND})
243 CMAKE_DEPENDENT_OPTION(WITH_LIBURING "Enable io_uring bluestore backend" ON
244 "WITH_BLUESTORE;HAVE_LIBAIO" OFF)
245 set(HAVE_LIBURING ${WITH_LIBURING})
247 CMAKE_DEPENDENT_OPTION(WITH_SYSTEM_LIBURING "Require and build with system liburing" OFF
248 "HAVE_LIBAIO;WITH_BLUESTORE" OFF)
250 CMAKE_DEPENDENT_OPTION(WITH_BLUESTORE_PMEM "Enable PMDK libraries" OFF
251 "WITH_BLUESTORE" OFF)
252 if(WITH_BLUESTORE_PMEM)
254 set(HAVE_LIBDML ${DML_FOUND})
257 CMAKE_DEPENDENT_OPTION(WITH_RBD_MIRROR "Enable build for rbd-mirror daemon executable" OFF
260 CMAKE_DEPENDENT_OPTION(WITH_RBD_MIGRATION_FORMAT_QCOW_V1
261 "Enable librbd QCOW v1 migration format support" ON
264 CMAKE_DEPENDENT_OPTION(WITH_RBD_RWL "Enable librbd persistent write back cache" OFF
267 CMAKE_DEPENDENT_OPTION(WITH_RBD_SSD_CACHE "Enable librbd persistent write back cache for SSDs" OFF
270 CMAKE_DEPENDENT_OPTION(WITH_SYSTEM_PMDK "Require and build with system PMDK" OFF
271 "WITH_RBD_RWL OR WITH_BLUESTORE_PMEM" OFF)
273 if(WITH_BLUESTORE_PMEM)
274 set(HAVE_BLUESTORE_PMEM ON)
277 CMAKE_DEPENDENT_OPTION(WITH_SPDK "Enable SPDK" OFF
278 "CMAKE_SYSTEM_PROCESSOR MATCHES i386|i686|amd64|x86_64|AMD64|aarch64" OFF)
280 if(NOT WITH_BLUESTORE)
281 message(SEND_ERROR "Please enable WITH_BLUESTORE for using SPDK")
289 if(NOT AIO_FOUND AND NOT HAVE_POSIXAIO AND NOT WITH_SPDK AND NOT WITH_BLUESTORE_PMEM)
290 message(SEND_ERROR "WITH_BLUESTORE is ON, "
291 "but none of the bluestore backends is enabled. "
292 "Please install libaio, or enable WITH_SPDK or WITH_BLUESTORE_PMEM (experimental)")
296 option(WITH_BLUEFS "libbluefs library" OFF)
298 option(WITH_QAT "Enable Qat driver" OFF)
300 find_package(QatDrv REQUIRED COMPONENTS qat_s usdm_drv_s)
301 set(HAVE_QATDRV $(QatDrv_FOUND))
304 option(WITH_QATZIP "Enable QATZIP" OFF)
306 find_package(qatzip REQUIRED)
307 set(HAVE_QATZIP ${qatzip_FOUND})
311 option(WITH_LIBCEPHFS "libcephfs client library" ON)
313 option(WITH_LIBCEPHSQLITE "libcephsqlite client library" ON)
314 if(WITH_LIBCEPHSQLITE)
315 find_package(SQLite3 REQUIRED)
319 option(WITH_KVS "Key value store is here" OFF)
321 option(WITH_KRBD "Enable Linux krbd support of 'rbd' utility" ON)
323 if(WITH_KRBD AND NOT WITH_RBD)
324 message(FATAL_ERROR "Cannot have WITH_KRBD without WITH_RBD.")
327 if(WITH_LIBCEPHFS OR WITH_KRBD)
328 # keyutils is only used when talking to the Linux Kernel key store
329 find_package(keyutils REQUIRED)
330 set(HAVE_KEYUTILS ${KEYUTILS_FOUND})
334 find_package(snappy REQUIRED)
336 option(WITH_BROTLI "Brotli compression support" OFF)
338 set(HAVE_BROTLI TRUE)
341 option(WITH_LZ4 "LZ4 compression support" ON)
343 find_package(LZ4 1.7 REQUIRED)
344 set(HAVE_LZ4 ${LZ4_FOUND})
347 CMAKE_DEPENDENT_OPTION(WITH_CEPH_DEBUG_MUTEX "Use debug ceph::mutex with lockdep" ON
348 "CMAKE_BUILD_TYPE STREQUAL Debug" OFF)
350 #if allocator is set on command line make sure it matches below strings
351 set(ALLOCATOR "" CACHE STRING
352 "specify memory allocator to use. currently tcmalloc, tcmalloc_minimal, \
353 jemalloc, and libc is supported. if not specified, will try to find tcmalloc, \
354 and then jemalloc. If neither of then is found. use the one in libc.")
356 if(${ALLOCATOR} MATCHES "tcmalloc(_minimal)?")
357 find_package(gperftools 2.6.2 REQUIRED)
358 set(ALLOC_LIBS gperftools::${ALLOCATOR})
359 set(HAVE_LIBTCMALLOC ON)
360 elseif(${ALLOCATOR} STREQUAL "jemalloc")
361 find_package(JeMalloc REQUIRED)
362 set(ALLOC_LIBS JeMalloc::JeMalloc)
364 elseif(NOT ALLOCATOR STREQUAL "libc")
365 message(FATAL_ERROR "Unsupported allocator selected: ${ALLOCATOR}")
368 find_package(gperftools 2.6.2)
369 set(HAVE_LIBTCMALLOC ${gperftools_FOUND})
370 if(NOT gperftools_FOUND)
371 find_package(JeMalloc)
374 set(ALLOCATOR tcmalloc)
375 set(ALLOC_LIBS gperftools::tcmalloc)
376 elseif(JeMalloc_FOUND)
377 set(ALLOCATOR jemalloc)
378 set(ALLOC_LIBS JeMalloc::JeMalloc)
381 # FreeBSD already has jemalloc as its default allocator
382 message(WARNING "tcmalloc and jemalloc not found, falling back to libc")
384 set(ALLOCATOR "libc")
385 endif(gperftools_FOUND)
387 if(NOT ALLOCATOR STREQUAL "libc")
389 $<$<COMPILE_LANGUAGE:CXX>:-fno-builtin-malloc>
390 $<$<COMPILE_LANGUAGE:CXX>:-fno-builtin-calloc>
391 $<$<COMPILE_LANGUAGE:CXX>:-fno-builtin-realloc>
392 $<$<COMPILE_LANGUAGE:CXX>:-fno-builtin-free>)
395 # Mingw generates incorrect entry points when using "-pie".
396 if(WIN32 OR (HAVE_LIBTCMALLOC AND WITH_STATIC_LIBSTDCXX))
397 set(EXE_LINKER_USE_PIE FALSE)
399 set(EXE_LINKER_USE_PIE ${ENABLE_SHARED})
403 # require libcurl with good curl_multi_wait(), see https://tracker.ceph.com/issues/15915
404 find_package(CURL 7.32 REQUIRED)
407 find_package(OpenSSL REQUIRED)
408 set(CRYPTO_LIBS OpenSSL::Crypto)
410 option(WITH_DPDK "Enable DPDK messaging" OFF)
415 build_dpdk(${CMAKE_BINARY_DIR}/src/dpdk)
420 option(WITH_BLKIN "Use blkin to emit LTTng tracepoints for Zipkin" OFF)
422 find_package(LTTngUST REQUIRED)
423 set(BLKIN_LIBRARIES blkin ${LTTNGUST_LIBRARIES} lttng-ust-fork)
424 include_directories(SYSTEM src/blkin/blkin-lib)
427 option(WITH_JAEGER "Enable jaegertracing and it's dependent libraries" ON)
429 set(HAVE_JAEGER TRUE)
433 option(WITH_RADOSGW "Rados Gateway is enabled" ON)
434 option(WITH_RADOSGW_BEAST_OPENSSL "Rados Gateway's Beast frontend uses OpenSSL" ON)
435 option(WITH_RADOSGW_AMQP_ENDPOINT "Rados Gateway's pubsub support for AMQP push endpoint" ON)
436 option(WITH_RADOSGW_KAFKA_ENDPOINT "Rados Gateway's pubsub support for Kafka push endpoint" ON)
437 option(WITH_RADOSGW_LUA_PACKAGES "Rados Gateway's support for dynamically adding lua packagess" ON)
438 option(WITH_RADOSGW_DBSTORE "DBStore backend for Rados Gateway" ON)
439 option(WITH_RADOSGW_MOTR "CORTX-Motr backend for Rados Gateway" OFF)
440 option(WITH_RADOSGW_DAOS "DAOS backend for RADOS Gateway" OFF)
441 option(WITH_RADOSGW_SELECT_PARQUET "Support for s3 select on parquet objects" ON)
442 option(WITH_RADOSGW_ARROW_FLIGHT "Build arrow flight when not using system-provided arrow" OFF)
443 option(WITH_RADOSGW_BACKTRACE_LOGGING "Enable backtraces in rgw logs" OFF)
445 option(WITH_SYSTEM_ARROW "Use system-provided arrow" OFF)
446 option(WITH_SYSTEM_UTF8PROC "Use system-provided utf8proc" OFF)
449 find_package(EXPAT REQUIRED)
450 find_package(OATH REQUIRED)
452 # https://curl.haxx.se/docs/install.html mentions the
453 # configure flags for various ssl backends
457 "curl-config --configure | grep with-ssl"
458 RESULT_VARIABLE NO_CURL_SSL_LINK
459 ERROR_VARIABLE CURL_CONFIG_ERRORS
461 if (CURL_CONFIG_ERRORS)
462 message(WARNING "unable to run curl-config; rgw cannot make ssl requests to external systems reliably")
465 if (NOT NO_CURL_SSL_LINK)
466 message(STATUS "libcurl is linked with openssl: explicitly setting locks")
467 set(WITH_CURL_OPENSSL ON)
468 endif() # CURL_SSL_LINK
472 "objdump -p ${OPENSSL_SSL_LIBRARY} | sed -n 's/^ SONAME *//p'"
473 OUTPUT_VARIABLE LIBSSL_SONAME
474 ERROR_VARIABLE OBJDUMP_ERRORS
475 RESULT_VARIABLE OBJDUMP_RESULTS
476 OUTPUT_STRIP_TRAILING_WHITESPACE)
478 message(FATAL_ERROR "can't run objdump: ${OBJDUMP_RESULTS}")
480 if (NOT OBJDUMP_ERRORS STREQUAL "")
481 message(WARNING "message from objdump: ${OBJDUMP_ERRORS}")
486 "objdump -p ${OPENSSL_CRYPTO_LIBRARY} | sed -n 's/^ SONAME *//p'"
487 OUTPUT_VARIABLE LIBCRYPTO_SONAME
488 ERROR_VARIABLE OBJDUMP_ERRORS
489 RESULT_VARIABLE OBJDUMP_RESULTS
490 OUTPUT_STRIP_TRAILING_WHITESPACE)
492 message(FATAL_ERROR "can't run objdump: ${OBJDUMP_RESULTS}")
494 if (NOT OBJDUMP_ERRORS STREQUAL "")
495 message(WARNING "message from objdump: ${OBJDUMP_ERRORS}")
497 message(STATUS "ssl soname: ${LIBSSL_SONAME}")
498 message(STATUS "crypto soname: ${LIBCRYPTO_SONAME}")
502 option(WITH_CEPHFS "CephFS is enabled" ON)
505 # Please specify 3.[0-7] if you want to build with a certain version of python3.
506 set(WITH_PYTHON3 "3" CACHE STRING "build with specified python3 version")
507 find_package(Python3 ${WITH_PYTHON3} EXACT REQUIRED
508 COMPONENTS Interpreter Development)
510 option(WITH_MGR "ceph-mgr is enabled" ON)
512 set(MGR_PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
513 set(MGR_PYTHON_LIBRARIES ${Python3_LIBRARIES})
514 set(MGR_PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR})
515 set(MGR_PYTHON_VERSION_MINOR ${Python3_VERSION_MINOR})
516 # Boost dependency check deferred to Boost section
520 option(WITH_THREAD_SAFE_RES_QUERY "res_query is thread safe" OFF)
521 if(WITH_THREAD_SAFE_RES_QUERY)
522 set(HAVE_THREAD_SAFE_RES_QUERY 1 CACHE INTERNAL "Thread safe res_query supported.")
525 option(WITH_REENTRANT_STRSIGNAL "strsignal is reentrant" OFF)
526 if(WITH_REENTRANT_STRSIGNAL)
527 set(HAVE_REENTRANT_STRSIGNAL 1 CACHE INTERNAL "Reentrant strsignal is supported.")
531 find_package(ZLIB REQUIRED)
533 #option for EventTrace
534 CMAKE_DEPENDENT_OPTION(
535 WITH_EVENTTRACE "Event tracing support, requires WITH_LTTNG"
539 option(WITH_LTTNG "LTTng tracing is enabled" ON)
541 find_package(LTTngUST REQUIRED)
542 find_program(LTTNG_GEN_TP
545 message(FATAL_ERROR "Can't find lttng-gen-tp.")
549 option(WITH_OSD_INSTRUMENT_FUNCTIONS OFF)
551 #option for Babeltrace
552 option(WITH_BABELTRACE "Babeltrace libraries are enabled" ON)
554 set(HAVE_BABELTRACE ON)
555 find_package(babeltrace REQUIRED)
556 set(HAVE_BABELTRACE_BABELTRACE_H ${BABELTRACE_FOUND})
557 set(HAVE_BABELTRACE_CTF_EVENTS_H ${BABELTRACE_FOUND})
558 set(HAVE_BABELTRACE_CTF_ITERATOR_H ${BABELTRACE_FOUND})
559 endif(WITH_BABELTRACE)
561 option(DEBUG_GATHER "C_Gather debugging is enabled" ON)
562 option(ENABLE_COVERAGE "Coverage is enabled" OFF)
563 option(PG_DEBUG_REFS "PG Ref debugging is enabled" OFF)
565 option(WITH_TESTS "enable the build of ceph-test package scripts/binaries" ON)
566 set(UNIT_TESTS_BUILT ${WITH_TESTS})
567 set(CEPH_TEST_TIMEOUT 3600 CACHE STRING
568 "Maximum time before a CTest gets killed" )
571 option(WITH_FIO "build with fio plugin enabled" OFF)
578 add_definitions(-D__linux__)
582 option(WITH_ASAN "build with ASAN" OFF)
584 list(APPEND sanitizers "address")
587 option(WITH_ASAN_LEAK "explicitly enable ASAN leak detection" OFF)
589 list(APPEND sanitizers "leak")
592 option(WITH_TSAN "build with TSAN" OFF)
594 list(APPEND sanitizers "thread")
597 option(WITH_UBSAN "build with UBSAN" OFF)
599 list(APPEND sanitizers "undefined_behavior")
603 find_package(Sanitizers REQUIRED ${sanitizers})
604 add_compile_options(${Sanitizers_COMPILE_OPTIONS})
605 string(REPLACE ";" " " sanitiers_compile_flags "${Sanitizers_COMPILE_OPTIONS}")
606 string(APPEND CMAKE_EXE_LINKER_FLAGS " ${sanitiers_compile_flags}")
607 string(APPEND CMAKE_SHARED_LINKER_FLAGS " ${sanitiers_compile_flags}")
611 option(WITH_SYSTEM_ROCKSDB "require and build with system rocksdb" OFF)
612 if (WITH_SYSTEM_ROCKSDB)
613 find_package(RocksDB 5.14 REQUIRED)
616 option(WITH_SEASTAR "Build seastar components")
617 set(HAVE_SEASTAR ${WITH_SEASTAR})
620 option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF)
622 # Boost::thread depends on Boost::atomic, so list it explicitly.
624 atomic chrono thread system regex random program_options date_time
625 iostreams context coroutine)
626 set(BOOST_HEADER_COMPONENTS container)
629 list(APPEND BOOST_COMPONENTS
630 python${MGR_PYTHON_VERSION_MAJOR}${MGR_PYTHON_VERSION_MINOR})
633 list(APPEND BOOST_COMPONENTS timer)
636 if(WITH_RADOSGW AND WITH_RADOSGW_LUA_PACKAGES)
637 list(APPEND BOOST_COMPONENTS filesystem)
640 set(Boost_USE_MULTITHREADED ON)
642 CMAKE_DEPENDENT_OPTION(WITH_BOOST_VALGRIND "Boost support for valgrind" OFF
643 "NOT WITH_SYSTEM_BOOST" OFF)
644 # require minimally the bundled version
645 if(WITH_SYSTEM_BOOST)
647 set(Boost_USE_STATIC_LIBS OFF)
649 set(Boost_USE_STATIC_LIBS ON)
651 if(BOOST_ROOT AND CMAKE_LIBRARY_ARCHITECTURE)
652 set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
654 find_package(Boost 1.79 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
655 if(NOT ENABLE_SHARED)
656 set_property(TARGET Boost::iostreams APPEND PROPERTY
657 INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
660 include(ProcessorCount)
661 ProcessorCount(DEFAULT_BOOST_J)
662 if(DEFAULT_BOOST_J EQUAL 0)
663 set(DEFAULT_BOOST_J 1)
665 set(BOOST_J ${DEFAULT_BOOST_J} CACHE STRING "max jobs for Boost build") # override w/-DBOOST_J=<n>
666 set(Boost_USE_STATIC_LIBS ON)
669 COMPONENTS ${BOOST_COMPONENTS} ${BOOST_HEADER_COMPONENTS})
671 include_directories(BEFORE SYSTEM ${Boost_INCLUDE_DIRS})
673 # dashboard angular2 frontend
674 option(WITH_MGR_DASHBOARD_FRONTEND "Build the mgr/dashboard frontend using `npm`" ON)
675 option(WITH_SYSTEM_NPM "Assume that dashboard build tools already installed through packages" OFF)
677 find_program(NPM_EXECUTABLE npm)
678 if(NOT NPM_EXECUTABLE)
679 message(FATAL_ERROR "Can't find npm.")
682 set(DASHBOARD_FRONTEND_LANGS "" CACHE STRING
683 "List of comma separated ceph-dashboard frontend languages to build. \
684 Use value `ALL` to build all languages")
685 CMAKE_DEPENDENT_OPTION(WITH_MGR_ROOK_CLIENT "Enable the mgr's Rook support" ON
688 include_directories(SYSTEM ${PROJECT_BINARY_DIR}/include)
690 find_package(Threads REQUIRED)
691 find_package(StdFilesystem REQUIRED)
693 option(WITH_SELINUX "build SELinux policy" OFF)
695 find_file(SELINUX_MAKEFILE selinux/devel/Makefile
697 if(NOT SELINUX_MAKEFILE)
698 message(FATAL_ERROR "Can't find selinux's Makefile")
700 add_subdirectory(selinux)
703 # enables testing and creates Make check command
704 add_custom_target(tests
705 COMMENT "Building tests")
707 set(CMAKE_CTEST_COMMAND ctest)
708 add_custom_target(check
709 COMMAND ${CMAKE_CTEST_COMMAND}
712 option(WITH_SYSTEMD "build with systemd support" ON)
714 add_subdirectory(src)
717 add_subdirectory(doc)
719 add_subdirectory(man)
723 add_subdirectory(systemd)
727 add_subdirectory(etc/sysctl)
730 option(WITH_GRAFANA "install grafana dashboards" OFF)
731 add_subdirectory(monitoring/ceph-mixin)
734 option(CTAG_EXCLUDES "Exclude files/directories when running ctag.")
738 EXCLUDE_OPTS ${CTAG_EXCLUDES}
739 EXCLUDES "*.js" "*.css" ".tox" "python-common/build")
740 add_custom_target(tags DEPENDS ctags)