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