]> git.proxmox.com Git - ceph.git/blame - ceph/src/CMakeLists.txt
import ceph 12.2.12
[ceph.git] / ceph / src / CMakeLists.txt
CommitLineData
7c673cae
FG
1include(GetGitRevisionDescription)
2
3enable_language(C ASM)
4include(GNUInstallDirs)
5# for erasure and compressor plugins
6set(CMAKE_INSTALL_PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
7set(CMAKE_INSTALL_FULL_PKGLIBDIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME})
8# so libceph-common can be found
9set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
10if(NOT CMAKE_INSTALL_RPATH)
11 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_PKGLIBDIR}")
12endif()
13
14# to be compatible with configure_files shared with autoconfig
15set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
16set(sbindir ${CMAKE_INSTALL_FULL_SBINDIR})
17set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
18set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR})
19set(libexecdir ${CMAKE_INSTALL_FULL_LIBEXECDIR})
20set(pkgdatadir ${CMAKE_INSTALL_FULL_DATADIR})
21set(datadir ${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME})
22set(prefix ${CMAKE_INSTALL_PREFIX})
23
24add_definitions("-DCEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\"")
25add_definitions("-DCEPH_PKGLIBDIR=\"${CMAKE_INSTALL_FULL_PKGLIBDIR}\"")
26add_definitions("-DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS")
27add_definitions("-D_FILE_OFFSET_BITS=64")
28if(LINUX)
29 add_definitions("-D_GNU_SOURCE")
30endif()
31
32set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wtype-limits -Wignored-qualifiers -Winit-self")
33set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char")
34
35set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-1024 -Wno-invalid-offsetof")
36set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor")
37set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
38set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-pragmas")
39if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
40 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
41 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-null-sentinel -Woverloaded-virtual")
31f18b77
FG
42 if(NOT WITH_OSD_INSTRUMENT_FUNCTIONS)
43 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
44 endif()
7c673cae
FG
45elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
46 set(CMAKE_EXE_LINKER_FLAGS "-Wl,-export-dynamic")
47 set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -rdynamic -Wl,-export-dynamic -export-dynamic")
48 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override -Wno-mismatched-tags")
49 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
50 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
51 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-local-typedef")
52 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-varargs")
53 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-gnu-designator")
54 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register")
55endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
56set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
57
58if(NOT CMAKE_BUILD_TYPE)
d2e6a577 59 set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Default BUILD_TYPE is RelWithDebInfo, other options are: Debug, Release, and MinSizeRel." FORCE)
7c673cae
FG
60endif()
61
62if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
63 # we use assert(3) for testing, so scrub the -DNDEBUG defined by default
64 string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_upper)
65 foreach(flags
66 CMAKE_CXX_FLAGS_${build_type_upper}
67 CMAKE_C_FLAGS_${build_type_upper})
68 string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " " "${flags}" "${${flags}}")
69 endforeach()
70endif()
71
72include(CheckCCompilerFlag)
73if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
31f18b77 74 CHECK_C_COMPILER_FLAG("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" HAS_FORTIFY_SOURCE)
7c673cae
FG
75 if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
76 if(HAS_FORTIFY_SOURCE)
31f18b77
FG
77 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2")
78 set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2")
7c673cae
FG
79 endif()
80 endif()
81 CHECK_C_COMPILER_FLAG(-fstack-protector-strong HAS_STACK_PROTECT)
82 if (HAS_STACK_PROTECT)
83 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong")
84 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong")
85 endif()
86endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
87
88include(SIMDExt)
89if(HAVE_INTEL)
90 set(CMAKE_ASM_COMPILER ${PROJECT_SOURCE_DIR}/src/yasm-wrapper)
91 set(CMAKE_ASM_FLAGS "-f elf64")
92endif()
93
94execute_process(
31f18b77 95 COMMAND yasm -f elf64 ${CMAKE_SOURCE_DIR}/src/common/crc32c_intel_fast_asm.s -o /dev/null
7c673cae
FG
96 RESULT_VARIABLE no_yasm
97 OUTPUT_QUIET)
98if(no_yasm)
99 message(STATUS " we do not have a modern/working yasm")
100else(no_yasm)
101 message(STATUS " we have a modern and working yasm")
102 if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
103 message(STATUS " we are x84_64")
104 set(save_quiet ${CMAKE_REQUIRED_QUIET})
105 set(CMAKE_REQUIRED_QUIET true)
106 include(CheckCXXSourceCompiles)
107 check_cxx_source_compiles("
108 #if defined(__x86_64__) && defined(__ILP32__)
109 #error x32
110 #endif
111 int main() {}
112 " not_arch_x32)
113 set(CMAKE_REQUIRED_QUIET ${save_quiet})
114 if(not_arch_x32)
115 message(STATUS " we are not x32")
116 set(HAVE_GOOD_YASM_ELF64 1)
117 execute_process(COMMAND yasm -f elf64 -i
31f18b77
FG
118 ${CMAKE_SOURCE_DIR}/src/isa-l/include/
119 ${CMAKE_SOURCE_DIR}/src/isa-l/erasure_code/gf_vect_dot_prod_avx2.asm
7c673cae
FG
120 -o /dev/null
121 RESULT_VARIABLE rc
122 OUTPUT_QUIET)
123 if(NOT rc)
124 set(HAVE_BETTER_YASM_ELF64 1)
125 message(STATUS " yasm can also build the isa-l stuff")
126 endif(NOT rc)
127 else(not_arch_x32)
128 message(STATUS " we are x32; no yasm for you")
129 endif(not_arch_x32)
130 else(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
131 message(STATUS " we are not x86_64 && !x32")
132 endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
133endif(no_yasm)
134
135# require c++11
136if(CMAKE_VERSION VERSION_LESS "3.1")
137 include(CheckCXXCompilerFlag)
138 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
139 if(NOT COMPILER_SUPPORTS_CXX11)
140 message(FATAL_ERROR
141 "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
142 endif()
143 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
144 include(CheckCCompilerFlag)
145 CHECK_C_COMPILER_FLAG("-std=gnu99" COMPILER_SUPPORTS_GNU99)
146 if(NOT COMPILER_SUPPORTS_GNU99)
147 message(FATAL_ERROR
148 "The compiler ${CMAKE_C_COMPILER} has no GNU C99 support.")
149 endif()
150 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
151else()
152 set(CMAKE_CXX_STANDARD 11)
153 set(CMAKE_CXX_EXTENSIONS OFF)
154 set(CMAKE_CXX_STANDARD_REQUIRED ON)
155 set(CMAKE_C_STANDARD 99)
156 # we use `asm()` to inline assembly, so enable the GNU extension
157 set(CMAKE_C_EXTENSIONS ON)
158 set(C_STANDARD_REQUIRED ON)
159endif()
160
161## Handle diagnostics color if compiler supports them.
162CHECK_C_COMPILER_FLAG("-fdiagnostics-color=always"
163 COMPILER_SUPPORTS_DIAGNOSTICS_COLOR)
164
165set(DIAGNOSTICS_COLOR "auto"
166 CACHE STRING "Used if the C/C++ compiler supports the -fdiagnostics-color option. May have one of three values -- 'auto' (default), 'always', or 'never'. If set to 'always' and the compiler supports the option, 'make [...] | less -R' will make visible diagnostics colorization of compiler output.")
167
168if(COMPILER_SUPPORTS_DIAGNOSTICS_COLOR)
169 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=${DIAGNOSTICS_COLOR}")
170 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=${DIAGNOSTICS_COLOR}")
171endif()
172
173set(EXTRALIBS rt ${CMAKE_DL_LIBS} ${ATOMIC_OPS_LIBRARIES})
174if(LINUX)
175 set(LIB_RESOLV resolv)
176 list(APPEND EXTRALIBS ${LIB_RESOLV})
177endif(LINUX)
178
179option(WITH_PROFILER "build extra profiler binaries" OFF)
180if(WITH_PROFILER)
181 find_package(gperftools REQUIRED)
182 list(APPEND EXTRALIBS profiler)
183endif(WITH_PROFILER)
184
185if(${ENABLE_COVERAGE})
186 find_program(HAVE_GCOV gcov)
187 if(NOT HAVE_GCOV)
188 message(FATAL_ERROR "Coverage Enabled but gcov Not Found")
189 endif(NOT HAVE_GCOV)
190 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O0")
191 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
192 list(APPEND EXTRALIBS gcov)
193endif(${ENABLE_COVERAGE})
194
195if(USE_NSS)
196 if(NSS_FOUND)
197 if(NSPR_FOUND)
198 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${NSS_INCLUDE_DIR} -I${NSPR_INCLUDE_DIR}")
199 endif(NSPR_FOUND)
200 endif(NSS_FOUND)
201endif(USE_NSS)
202
203set(GCOV_PREFIX_STRIP 4)
204
31f18b77
FG
205# the src/.git_version file may be written out by make-dist; otherwise
206# we pull the git version from .git
7c673cae
FG
207option(ENABLE_GIT_VERSION "build Ceph with git version string" ON)
208if(${ENABLE_GIT_VERSION})
209 get_git_head_revision(GIT_REFSPEC CEPH_GIT_VER)
210 git_describe(CEPH_GIT_NICE_VER --always)
211 #if building from a source tarball via make-dist
212 if(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
213 message(STATUS "Ceph/.git directory not found, parsing ${CMAKE_CURRENT_SOURCE_DIR}/.git_version for CEPH_GIT_VER and CEPH_GIT_NICE_VER")
214 file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/.git_version CEPH_GIT_SHA_AND_TAG)
215 list(GET CEPH_GIT_SHA_AND_TAG 0 CEPH_GIT_VER)
216 list(GET CEPH_GIT_SHA_AND_TAG 1 CEPH_GIT_NICE_VER)
217 endif(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
218 # remove 'v' prefix from raw git version
219 string(SUBSTRING ${CEPH_GIT_NICE_VER} 1 -1 CEPH_GIT_NICE_VER)
220else(${ENABLE_GIT_VERSION})
221 set(CEPH_GIT_VER "no_version")
222 set(CEPH_GIT_NICE_VER "Development")
223endif(${ENABLE_GIT_VERSION})
224
31f18b77
FG
225# the src/ceph_release file is 3 lines,
226# <release number, e.g. '12' for luminous>
227# <release name, e.g. 'luminous'>
228# <release type: 'dev' for x.0.z, 'rc' or x.1.z, or 'stable' or x.2.z>
229# note that the release name is semi-redundant and must match CEPH_RELEASE_*
230# definitions in include/rados.h and common/ceph_strings.c.
231file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/ceph_release CEPH_RELEASE_FILE)
232list(GET CEPH_RELEASE_FILE 0 CEPH_RELEASE)
233list(GET CEPH_RELEASE_FILE 1 CEPH_RELEASE_NAME)
234list(GET CEPH_RELEASE_FILE 2 CEPH_RELEASE_TYPE)
235
7c673cae
FG
236option(WITH_OCF "build OCF-compliant cluster resource agent" OFF)
237if(WITH_OCF)
238 add_subdirectory(ocf)
239endif()
240
241option(WITH_CEPHFS_JAVA "build libcephfs Java bindings" OFF)
242if(WITH_CEPHFS_JAVA)
243 add_subdirectory(java)
244endif()
245
246# Python stuff
247find_package(PythonInterp 2 REQUIRED)
248find_package(PythonLibs 2 REQUIRED)
249
250option(WITH_PYTHON3 "build python3 bindings" "CHECK")
251if(WITH_PYTHON3 MATCHES "check|CHECK")
252 find_package(Python3Interp 3 QUIET)
253 find_package(Python3Libs 3 QUIET)
254 if(PYTHON3INTERP_FOUND AND PYTHON3LIBS_FOUND)
255 set(WITH_PYTHON3 ON)
256 else()
257 set(WITH_PYTHON3 OFF)
258 endif()
259elseif(WITH_PYTHON3)
260 find_package(Python3Interp 3 REQUIRED)
261 find_package(Python3Libs 3 REQUIRED)
262endif()
263
264if(HAVE_XIO)
265 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${XIO_INCLUDE_DIR}")
266 list(APPEND EXTRALIBS ${XIO_LIBRARY} pthread rt)
267endif(HAVE_XIO)
268
269if(HAVE_RDMA)
270 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${RDMA_INCLUDE_DIR}")
271 list(APPEND EXTRALIBS ${RDMA_LIBRARIES} pthread rt)
272endif(HAVE_RDMA)
273
274if(HAVE_DPDK)
275 set(CMAKE_CXX_FLAGS "-march=native ${CMAKE_CXX_FLAGS} -I${DPDK_INCLUDE_DIR}")
276 list(APPEND EXTRALIBS ${DPDK_LIBRARY})
277 if(NOT USE_CRYPTOPP)
278 message(FATAL_ERROR "CRYPTOPP must be supported when enable DPDK.")
279 endif(NOT USE_CRYPTOPP)
280 list(APPEND EXTRALIBS ${DPDK_LIBRARIES})
281endif(HAVE_DPDK)
282
283# sort out which allocator to use
284if(ALLOCATOR STREQUAL "tcmalloc")
285 set(ALLOC_LIBS ${GPERFTOOLS_TCMALLOC_LIBRARY})
286 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
287 set(TCMALLOC_srcs perfglue/heap_profiler.cc)
288elseif(ALLOCATOR STREQUAL "tcmalloc_minimal")
289 set(ALLOC_LIBS ${GPERFTOOLS_TCMALLOC_MINIMAL_LIBRARY})
290 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
291 set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc)
292elseif(ALLOCATOR STREQUAL "jemalloc")
293 set(ALLOC_LIBS ${JEMALLOC_LIBRARIES})
294 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
295 set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc)
296elseif(ALLOCATOR STREQUAL "libc")
297 set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc)
298endif()
299
300# tcmalloc heap profiler
301set(heap_profiler_files ${TCMALLOC_srcs})
302add_library(heap_profiler_objs OBJECT ${heap_profiler_files})
303
304if (WITH_BLKIN)
305 add_subdirectory(blkin/blkin-lib)
306endif(WITH_BLKIN)
307
308# Common infrastructure
309configure_file(
310 ${CMAKE_SOURCE_DIR}/src/ceph_ver.h.in.cmake
311 ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
312 @ONLY)
313
314set(auth_files
315 auth/AuthAuthorizeHandler.cc
316 auth/AuthClientHandler.cc
317 auth/AuthSessionHandler.cc
318 auth/AuthMethodList.cc
319 auth/cephx/CephxAuthorizeHandler.cc
320 auth/cephx/CephxClientHandler.cc
321 auth/cephx/CephxProtocol.cc
322 auth/cephx/CephxSessionHandler.cc
323 auth/none/AuthNoneAuthorizeHandler.cc
324 auth/unknown/AuthUnknownAuthorizeHandler.cc
325 auth/Crypto.cc
326 auth/KeyRing.cc
327 auth/RotatingKeyRing.cc)
328
329set(mds_files)
330list(APPEND mds_files
331 mds/MDSMap.cc
332 mds/FSMap.cc
333 mds/FSMapUser.cc
334 mds/inode_backtrace.cc
335 mds/mdstypes.cc
336 mds/flock.cc)
337
338set(crush_srcs
339 crush/builder.c
340 crush/mapper.c
341 crush/crush.c
342 crush/hash.c
343 crush/CrushWrapper.cc
344 crush/CrushCompiler.cc
345 crush/CrushTester.cc
346 crush/CrushLocation.cc)
347
348add_library(crush_objs OBJECT ${crush_srcs})
349
350add_subdirectory(json_spirit)
351
352include_directories("${CMAKE_SOURCE_DIR}/src/xxHash")
31f18b77 353include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/rapidjson/include")
7c673cae
FG
354
355set(GMOCK_INCLUDE_DIRS
356 "${CMAKE_SOURCE_DIR}/src/googletest/googletest/include/gmock")
357set(GTEST_INCLUDE_DIRS
358 "${CMAKE_SOURCE_DIR}/src/googletest/googletest/include/gtest")
359
360include_directories("${CMAKE_SOURCE_DIR}/src/dmclock/src")
361include_directories("${CMAKE_SOURCE_DIR}/src/dmclock/support/src")
362
363# needed for source files that friend unit tests (e.g., using FRIEND_TEST)
364include_directories("${CMAKE_SOURCE_DIR}/src/googletest/googletest/include")
365
366set(xio_common_srcs)
367if(HAVE_XIO)
368 list(APPEND xio_common_srcs
369 msg/xio/XioConnection.cc
370 msg/xio/XioMsg.cc
371 msg/xio/XioPool.cc
372 msg/xio/XioMessenger.cc
373 msg/xio/XioPortal.cc)
374endif(HAVE_XIO)
375
376set(async_rdma_common_srcs)
377if(HAVE_RDMA)
378 list(APPEND async_rdma_common_srcs
379 msg/async/rdma/Infiniband.cc
7c673cae 380 msg/async/rdma/RDMAConnectedSocketImpl.cc
7c673cae
FG
381 msg/async/rdma/RDMAServerSocketImpl.cc
382 msg/async/rdma/RDMAStack.cc)
383endif(HAVE_RDMA)
384
385set(dpdk_common_srcs)
386if(HAVE_DPDK)
387 list(APPEND dpdk_common_srcs
388 msg/async/dpdk/ARP.cc
389 msg/async/dpdk/DPDK.cc
390 msg/async/dpdk/dpdk_rte.cc
391 msg/async/dpdk/DPDKStack.cc
392 msg/async/dpdk/EventDPDK.cc
393 msg/async/dpdk/IP.cc
394 msg/async/dpdk/net.cc
395 msg/async/dpdk/IPChecksum.cc
396 msg/async/dpdk/Packet.cc
397 msg/async/dpdk/TCP.cc
398 msg/async/dpdk/UserspaceEvent.cc
399 msg/async/dpdk/ethernet.cc)
400 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${DPDK_INCLUDE_DIR}")
401endif(HAVE_DPDK)
402
403add_library(common_buffer_obj OBJECT
404 common/buffer.cc)
405
406add_library(common_texttable_obj OBJECT
407 common/TextTable.cc)
408
409set(libcommon_files
410 ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
411 ceph_ver.c
412 common/AsyncOpTracker.cc
413 common/DecayCounter.cc
414 common/LogClient.cc
415 common/LogEntry.cc
416 common/PrebufferedStreambuf.cc
417 common/BackTrace.cc
418 common/perf_counters.cc
419 common/perf_histogram.cc
420 common/mutex_debug.cc
421 common/Mutex.cc
422 common/OutputDataSocket.cc
423 common/admin_socket.cc
424 common/admin_socket_client.cc
425 common/bloom_filter.cc
426 common/Readahead.cc
427 common/cmdparse.cc
428 common/escape.c
429 common/url_escape.cc
430 common/io_priority.cc
431 common/Clock.cc
432 common/ceph_time.cc
433 common/mempool.cc
434 common/Throttle.cc
435 common/Timer.cc
436 common/Finisher.cc
437 common/environment.cc
438 common/sctp_crc32.c
439 common/crc32c.cc
440 common/crc32c_intel_baseline.c
441 xxHash/xxhash.c
442 common/assert.cc
443 common/run_cmd.cc
444 common/WorkQueue.cc
445 common/ConfUtils.cc
446 common/MemoryModel.cc
447 common/fd.cc
448 common/xattr.c
449 common/str_list.cc
450 common/str_map.cc
451 common/snap_types.cc
452 common/errno.cc
453 common/TrackedOp.cc
454 common/SloppyCRCMap.cc
455 common/types.cc
31f18b77 456 common/iso_8601.cc
7c673cae
FG
457 log/Log.cc
458 log/SubsystemMap.cc
459 mon/MonCap.cc
460 mon/MonClient.cc
461 mon/MonMap.cc
462 mgr/MgrClient.cc
463 msg/simple/Accepter.cc
464 msg/DispatchQueue.cc
465 msg/Message.cc
31f18b77 466 mon/PGMap.cc
224ce89b 467 mgr/ServiceMap.cc
7c673cae
FG
468 osd/ECMsgTypes.cc
469 osd/HitSet.cc
470 common/RefCountedObj.cc
471 msg/Messenger.cc
472 msg/simple/Pipe.cc
473 msg/simple/PipeConnection.cc
474 msg/simple/SimpleMessenger.cc
475 msg/async/AsyncConnection.cc
476 msg/async/AsyncMessenger.cc
477 msg/async/Event.cc
478 msg/async/EventSelect.cc
479 msg/async/Stack.cc
480 msg/async/PosixStack.cc
481 msg/async/net_handler.cc
482 msg/QueueStrategy.cc
483 ${xio_common_srcs}
484 ${async_rdma_common_srcs}
485 ${dpdk_common_srcs}
486 msg/msg_types.cc
31f18b77 487 common/reverse.c
7c673cae
FG
488 common/hobject.cc
489 osd/OSDMap.cc
490 osd/OSDMapMapping.cc
491 common/histogram.cc
492 osd/osd_types.cc
493 osd/OpRequest.cc
494 common/blkdev.cc
495 common/common_init.cc
7c673cae
FG
496 common/ceph_argparse.cc
497 common/ceph_context.cc
498 common/code_environment.cc
499 common/dout.cc
500 common/signal.cc
501 common/Thread.cc
502 common/Formatter.cc
503 common/HTMLFormatter.cc
504 common/HeartbeatMap.cc
505 common/PluginRegistry.cc
506 common/ceph_fs.cc
507 common/ceph_hash.cc
508 common/ceph_strings.cc
509 common/ceph_frag.cc
c07f9fc5 510 common/options.cc
7c673cae 511 common/config.cc
7c673cae
FG
512 common/utf8.c
513 common/mime.c
514 common/strtol.cc
515 common/page.cc
516 common/lockdep.cc
517 common/version.cc
518 common/hex.cc
519 common/entity_name.cc
520 common/ceph_crypto.cc
521 common/ceph_crypto_cms.cc
522 common/ceph_json.cc
523 common/ipaddr.cc
524 common/pick_address.cc
525 common/address_helper.cc
526 common/linux_version.c
527 common/TracepointProvider.cc
528 common/Cycles.cc
529 common/scrub_types.cc
530 common/bit_str.cc
531 osdc/Striper.cc
532 osdc/Objecter.cc
28e407b8 533 common/compat.cc
7c673cae
FG
534 common/Graylog.cc
535 common/fs_types.cc
536 common/dns_resolve.cc
537 common/hostname.cc
31f18b77 538 common/util.cc
91327a77 539 common/PriorityCache.cc
7c673cae
FG
540 arch/probe.cc
541 ${auth_files}
542 ${mds_files})
543
3efd9988 544CHECK_C_COMPILER_FLAG("-fvar-tracking-assignments" HAS_VTA)
c07f9fc5 545if(HAS_VTA)
3efd9988
FG
546 set_source_files_properties(
547 common/config.cc
548 common/options.cc
c07f9fc5
FG
549 PROPERTIES COMPILE_FLAGS -fno-var-tracking-assignments)
550endif()
551
31f18b77
FG
552if(FREEBSD)
553 list(APPEND libcommon_files common/freebsd_errno.cc)
554elseif(DARWIN)
555 list(APPEND libcommon_files common/darwin_errno.cc)
556elseif(SUN)
557 list(APPEND libcommon_files common/solaris_errno.cc)
558elseif(AIX)
559 list(APPEND libcommon_files common/aix_errno.cc)
560endif()
561
7c673cae
FG
562if(HAVE_ARM)
563 list(APPEND libcommon_files arch/arm.c)
564elseif(HAVE_INTEL)
565 list(APPEND libcommon_files arch/intel.c)
566elseif(HAVE_POWER8)
567 list(APPEND libcommon_files arch/ppc.c)
568endif()
569
570if(HAVE_INTEL)
571 list(APPEND libcommon_files
572 common/crc32c_intel_fast.c)
573 if(HAVE_GOOD_YASM_ELF64)
574 list(APPEND libcommon_files
31f18b77
FG
575 common/crc32c_intel_fast_asm.s
576 common/crc32c_intel_fast_zero_asm.s)
7c673cae
FG
577 endif(HAVE_GOOD_YASM_ELF64)
578elseif(HAVE_POWER8)
579 list(APPEND libcommon_files
580 common/crc32c_ppc.c
31f18b77
FG
581 common/crc32c_ppc_asm.S
582 common/crc32c_ppc_fast_zero_asm.S)
7c673cae
FG
583endif(HAVE_INTEL)
584
585if(LINUX)
586 list(APPEND libcommon_files msg/async/EventEpoll.cc)
587 message(STATUS " Using EventEpoll for events.")
588elseif(FREEBSD OR APPLE)
589 list(APPEND libcommon_files msg/async/EventKqueue.cc)
590 message(STATUS " Using EventKqueue for events.")
591endif(LINUX)
592
593if(WITH_LTTNG AND WITH_EVENTTRACE)
594 message(STATUS " Using EventTrace class.")
595 add_definitions("-DWITH_EVENTTRACE")
596 list(APPEND libcommon_files common/EventTrace.cc)
597endif()
598
7c673cae
FG
599set(common_mountcephfs_files
600 common/armor.c
601 common/safe_io.c
602 common/module.c
603 common/addr_parsing.c)
604add_library(common_mountcephfs_objs OBJECT
605 ${common_mountcephfs_files})
606
607if(WITH_PROFILER)
608 list(APPEND libcommon_files
609 perfglue/cpu_profiler.cc)
610else()
611 list(APPEND libcommon_files
612 perfglue/disabled_stubs.cc)
613endif()
614
615add_library(common-objs OBJECT ${libcommon_files})
616set(ceph_common_objs
617 $<TARGET_OBJECTS:common_buffer_obj>
618 $<TARGET_OBJECTS:common_texttable_obj>
619 $<TARGET_OBJECTS:compressor_objs>
620 $<TARGET_OBJECTS:common-objs>
621 $<TARGET_OBJECTS:common_mountcephfs_objs>
622 $<TARGET_OBJECTS:global_common_objs>
623 $<TARGET_OBJECTS:crush_objs>)
624set(ceph_common_deps
625 json_spirit erasure_code rt ${LIB_RESOLV}
31f18b77
FG
626 Boost::thread
627 Boost::system
628 Boost::regex
629 Boost::random
630 Boost::program_options
631 Boost::date_time
632 Boost::iostreams
7c673cae
FG
633 ${BLKID_LIBRARIES}
634 ${Backtrace_LIBRARIES}
635 ${BLKIN_LIBRARIES}
636 ${CRYPTO_LIBS}
637 ${CMAKE_THREAD_LIBS_INIT}
638 ${CMAKE_DL_LIBS})
639if(HAVE_RDMA)
640 list(APPEND ceph_common_deps ${RDMA_LIBRARY})
641endif()
642if(NOT WITH_SYSTEM_BOOST)
643 list(APPEND ceph_common_deps ${ZLIB_LIBRARIES})
644endif()
645
646set_source_files_properties(${CMAKE_SOURCE_DIR}/src/ceph_ver.c
647 ${CMAKE_SOURCE_DIR}/src/common/version.cc
648 ${CMAKE_SOURCE_DIR}/src/test/encoding/ceph_dencoder.cc
649 APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)
650
651if(HAVE_ARMV8_CRC)
652 add_library(common_crc_aarch64 STATIC common/crc32c_aarch64.c)
653 set_target_properties(common_crc_aarch64 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${ARMV8_CRC_COMPILE_FLAGS}")
654 list(APPEND ceph_common_deps common_crc_aarch64)
655endif(HAVE_ARMV8_CRC)
656
657add_library(common STATIC ${ceph_common_objs})
658target_link_libraries(common ${ceph_common_deps})
659
660add_library(ceph-common SHARED ${ceph_common_objs})
661target_link_libraries(ceph-common ${ceph_common_deps})
662# appease dpkg-shlibdeps
663set_target_properties(ceph-common PROPERTIES
664 SOVERSION 0
665 INSTALL_RPATH "")
91327a77
AA
666if(NOT APPLE)
667 # Apple uses Mach-O, not ELF. so this option does not apply to APPLE.
668 #
669 # prefer the local symbol definitions when binding references to global
670 # symbols. otherwise we could reference the symbols defined by the application
671 # with the same name, instead of using the one defined in libceph-common.
672 # in other words, we require libceph-common to use local symbols, even if redefined
673 # in application".
674 set_property(
675 TARGET ceph-common
676 APPEND APPEND_STRING
677 PROPERTY LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions")
678endif()
679
7c673cae
FG
680install(TARGETS ceph-common DESTINATION ${CMAKE_INSTALL_PKGLIBDIR})
681
682add_library(common_utf8 STATIC common/utf8.c)
683
7c673cae
FG
684if(${WITH_LTTNG})
685 add_subdirectory(tracing)
686 add_dependencies(common-objs oprequest-tp)
687endif(${WITH_LTTNG})
688
689add_subdirectory(global)
690
691add_subdirectory(lua)
692
693# rados object classes
694add_subdirectory(cls)
695
696# RADOS client/library
697add_subdirectory(osdc)
698
699add_library(rados_snap_set_diff_obj OBJECT librados/snap_set_diff.cc)
700
701add_subdirectory(include)
702add_subdirectory(librados)
703add_subdirectory(libradosstriper)
704
705if (WITH_MGR)
706 set(mgr_srcs
707 ceph_mgr.cc
708 mon/PGMap.cc
709 mgr/DaemonState.cc
710 mgr/DaemonServer.cc
711 mgr/ClusterState.cc
3efd9988 712 mgr/ActivePyModules.cc
b32b8144 713 mgr/OSDHealthMetricCollector.cc
3efd9988
FG
714 mgr/StandbyPyModules.cc
715 mgr/PyModuleRegistry.cc
716 mgr/PyModuleRunner.cc
7c673cae 717 mgr/PyFormatter.cc
3efd9988
FG
718 mgr/PyOSDMap.cc
719 mgr/BaseMgrModule.cc
720 mgr/BaseMgrStandbyModule.cc
721 mgr/ActivePyModule.cc
7c673cae 722 mgr/MgrStandby.cc
c07f9fc5 723 mgr/Mgr.cc
3efd9988 724 mgr/Gil.cc
c07f9fc5 725 mgr/mgr_commands.cc)
7c673cae
FG
726 add_executable(ceph-mgr ${mgr_srcs}
727 $<TARGET_OBJECTS:heap_profiler_objs>)
728 target_include_directories(ceph-mgr PRIVATE "${PYTHON_INCLUDE_DIRS}")
729 target_link_libraries(ceph-mgr osdc client global-static common
31f18b77 730 Boost::python ${PYTHON_LIBRARIES} ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS} ${ALLOC_LIBS})
7c673cae
FG
731 install(TARGETS ceph-mgr DESTINATION bin)
732endif (WITH_MGR)
733
734set(librados_config_srcs
735 librados-config.cc)
736add_executable(librados-config ${librados_config_srcs})
737target_link_libraries(librados-config librados global ${BLKID_LIBRARIES} ${RDMA_LIBRARIES}
738 ${CMAKE_DL_LIBS})
739
740install(TARGETS librados-config DESTINATION bin)
741
742# virtualenv base directory for ceph-disk and ceph-detect-init
743set(CEPH_BUILD_VIRTUALENV $ENV{TMPDIR})
744if(NOT CEPH_BUILD_VIRTUALENV)
a8e16298 745 set(CEPH_BUILD_VIRTUALENV ${CMAKE_BINARY_DIR})
7c673cae
FG
746endif()
747
748add_subdirectory(pybind)
749add_subdirectory(ceph-disk)
d2e6a577 750add_subdirectory(ceph-volume)
7c673cae
FG
751add_subdirectory(ceph-detect-init)
752
753## dencoder
7c673cae
FG
754if(HAS_VTA)
755 set_source_files_properties(test/encoding/ceph_dencoder.cc
756 PROPERTIES COMPILE_FLAGS -fno-var-tracking-assignments)
757endif()
758
759set(dencoder_srcs
760 test/encoding/ceph_dencoder.cc
761 $<TARGET_OBJECTS:common_texttable_obj>
762 )
763if(${WITH_RADOSGW})
764 list(APPEND dencoder_srcs
765 rgw/rgw_dencoder.cc
766 )
767 set(DENCODER_EXTRALIBS
768 rgw_a
769 cls_rgw_client
770 )
771endif(${WITH_RADOSGW})
772if(WITH_RBD)
773 set(DENCODER_EXTRALIBS
774 ${DENCODER_EXTRALIBS}
775 cls_rbd_client
776 rbd_mirror_types
777 rbd_types
778 rbd_replay_types)
779 if(WITH_KRBD)
780 set(DENCODER_EXTRALIBS
781 ${DENCODER_EXTRALIBS}
782 krbd)
783 endif()
784endif(WITH_RBD)
785
786add_executable(ceph-dencoder ${dencoder_srcs})
787target_link_libraries(ceph-dencoder
788 global
789 os
790 osd
791 mds
792 mon
793 journal
794 ${DENCODER_EXTRALIBS}
795 cls_lock_client
796 cls_refcount_client
797 cls_log_client
798 cls_statelog_client
799 cls_version_client
800 cls_replica_log_client
801 cls_user_client
802 cls_journal_client
803 cls_timeindex_client
804 ${EXTRALIBS}
805 ${CMAKE_DL_LIBS}
806 )
807install(TARGETS ceph-dencoder DESTINATION bin)
808
809# Monitor
7c673cae
FG
810add_subdirectory(mon)
811set(ceph_mon_srcs
812 ceph_mon.cc)
813add_executable(ceph-mon ${ceph_mon_srcs}
814 $<TARGET_OBJECTS:common_texttable_obj>)
815add_dependencies(ceph-mon erasure_code_plugins)
816target_link_libraries(ceph-mon mon common os global-static common
817 ${EXTRALIBS}
818 ${CMAKE_DL_LIBS})
819install(TARGETS ceph-mon DESTINATION bin)
820
821# OSD/ObjectStore
822# make rocksdb statically
823
824if (NOT WITH_SYSTEM_ROCKSDB)
825 set(ROCKSDB_CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON)
826
827 if(ALLOCATOR STREQUAL "jemalloc")
828 list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_JEMALLOC=ON)
829 endif()
830
831 if (WITH_CCACHE AND CCACHE_FOUND)
832 list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_CXX_COMPILER=ccache)
833 list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_CXX_COMPILER_ARG1=${CMAKE_CXX_COMPILER})
834 else(WITH_CCACHE AND CCACHE_FOUND)
835 list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
836 endif(WITH_CCACHE AND CCACHE_FOUND)
837
28e407b8
AA
838 list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_SNAPPY=${SNAPPY_FOUND})
839 list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_LZ4=${LZ4_FOUND})
840 list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_ZLIB=${ZLIB_FOUND})
841
181888fb
FG
842 # SSE 4.2 is enabled by default in rocksdb's crc32c. For details refer to
843 # rocksdb/util/crc32c.cc.
7c673cae
FG
844 list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_AR=${CMAKE_AR})
845 list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
28e407b8 846 list(APPEND ROCKSDB_CMAKE_ARGS -DFAIL_ON_WARNINGS=OFF)
7c673cae
FG
847
848 # we use an external project and copy the sources to bin directory to ensure
849 # that object files are built outside of the source tree.
850 include(ExternalProject)
851 ExternalProject_Add(rocksdb_ext
852 SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb
853 CMAKE_ARGS ${ROCKSDB_CMAKE_ARGS}
854 BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/rocksdb
855 BUILD_COMMAND $(MAKE) rocksdb
856 INSTALL_COMMAND "true")
857
858 # force rocksdb make to be called on each time
859 ExternalProject_Add_Step(rocksdb_ext forcebuild
860 DEPENDEES configure
861 DEPENDERS build
862 COMMAND "true"
863 ALWAYS 1)
864
865 set(ROCKSDB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/include)
866
867 add_library(rocksdb STATIC IMPORTED)
868 add_dependencies(rocksdb rocksdb_ext)
869 set_property(TARGET rocksdb PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rocksdb/librocksdb.a")
870 set(ROCKSDB_LIBRARIES rocksdb)
871
872endif(NOT WITH_SYSTEM_ROCKSDB)
873
874include(TestBigEndian)
875test_big_endian(CEPH_BIG_ENDIAN)
876if(NOT CEPH_BIG_ENDIAN)
877 set(CEPH_LITTLE_ENDIAN 1)
878endif()
879
880add_subdirectory(kv)
881add_subdirectory(os)
882
883set(cls_references_files objclass/class_api.cc)
884add_library(cls_references_objs OBJECT ${cls_references_files})
885
886add_subdirectory(osd)
887
888set(ceph_osd_srcs
889 ceph_osd.cc)
31f18b77 890add_executable(ceph-osd ${ceph_osd_srcs})
7c673cae
FG
891add_dependencies(ceph-osd erasure_code_plugins)
892target_link_libraries(ceph-osd osd os global-static common
893 ${BLKID_LIBRARIES} ${RDMA_LIBRARIES})
894if(WITH_FUSE)
895 target_link_libraries(ceph-osd ${FUSE_LIBRARIES})
896endif()
897install(TARGETS ceph-osd DESTINATION bin)
898
899add_subdirectory(mds)
900set(ceph_mds_srcs
901 ceph_mds.cc)
31f18b77 902add_executable(ceph-mds ${ceph_mds_srcs})
7c673cae 903target_link_libraries(ceph-mds mds ${CMAKE_DL_LIBS} global-static common
31f18b77 904 Boost::thread)
7c673cae
FG
905install(TARGETS ceph-mds DESTINATION bin)
906
907add_subdirectory(erasure-code)
908
909# Support/Tools
910if(WITH_TESTS)
911add_subdirectory(googletest/googlemock)
912add_subdirectory(test)
913endif(WITH_TESTS)
914
915add_subdirectory(compressor)
916
917add_subdirectory(tools)
918
31f18b77 919# dmClock (after gmock)
7c673cae 920
31f18b77 921add_subdirectory(dmclock/src)
7c673cae 922
31f18b77
FG
923option(WITH_DMCLOCK_TESTS
924 "enable the build of dmclock-tests and dmclock-data-struct tests binaries"
925 OFF)
926if(WITH_TESTS AND WITH_DMCLOCK_TESTS)
927 # note: add_test is not being called, so dmclock tests aren't part
928 # of ceph tests
929 add_subdirectory(dmclock/test)
930 add_subdirectory(dmclock/support/test)
931endif(WITH_TESTS AND WITH_DMCLOCK_TESTS)
7c673cae 932
31f18b77 933if(HAVE_INTEL AND HAVE_BETTER_YASM_ELF64)
7c673cae 934 add_subdirectory(crypto/isa-l)
31f18b77 935endif(HAVE_INTEL AND HAVE_BETTER_YASM_ELF64)
7c673cae
FG
936
937if(WITH_TESTS)
938
939configure_file(${CMAKE_SOURCE_DIR}/src/ceph-coverage.in
940 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-coverage @ONLY)
941
942configure_file(${CMAKE_SOURCE_DIR}/src/ceph-debugpack.in
943 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-debugpack @ONLY)
944endif(WITH_TESTS)
945
946configure_file(${CMAKE_SOURCE_DIR}/src/ceph.in
947 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph @ONLY)
948
949configure_file(${CMAKE_SOURCE_DIR}/src/ceph-crush-location.in
950 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crush-location @ONLY)
951
952configure_file(${CMAKE_SOURCE_DIR}/src/init-ceph.in
953 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/init-ceph @ONLY)
954
955configure_file(ceph-post-file.in
956 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-post-file @ONLY)
957
958if(WITH_TESTS)
959install(PROGRAMS
960 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-debugpack
961 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-coverage
962 DESTINATION bin)
963endif(WITH_TESTS)
964
965install(PROGRAMS
966 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph
967 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crush-location
968 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-post-file
969 ${CMAKE_SOURCE_DIR}/src/ceph-run
970 ${CMAKE_SOURCE_DIR}/src/ceph-rest-api
971 ${CMAKE_SOURCE_DIR}/src/ceph-clsinfo
972 DESTINATION bin)
973install(PROGRAMS
974 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/init-ceph
975 DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/init.d
976 RENAME ceph)
977
978install(FILES
979 ${CMAKE_SOURCE_DIR}/share/id_rsa_drop.ceph.com
980 ${CMAKE_SOURCE_DIR}/share/id_rsa_drop.ceph.com.pub
981 ${CMAKE_SOURCE_DIR}/share/known_hosts_drop.ceph.com
982 DESTINATION ${CMAKE_INSTALL_DATADIR}/ceph)
983
984install(PROGRAMS
985 ceph_common.sh
986 ceph-osd-prestart.sh
987 DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/ceph)
988
989install(PROGRAMS
990 ${CMAKE_SOURCE_DIR}/src/ceph-create-keys
991# ${CMAKE_SOURCE_DIR}/src/ceph-disk
7c673cae
FG
992 DESTINATION sbin)
993
994add_subdirectory(bash_completion)
995
996if(WITH_LIBCEPHFS OR WITH_KRBD)
997 set(parse_secret_files
998 common/secret.c)
999 add_library(parse_secret_objs OBJECT ${parse_secret_files})
1000endif()
1001
1002add_subdirectory(client)
1003
1004if(WITH_LIBCEPHFS)
1005 set(libcephfs_srcs libcephfs.cc)
1006 add_library(cephfs ${CEPH_SHARED} ${libcephfs_srcs})
1007 target_link_libraries(cephfs LINK_PRIVATE client ceph-common
1008 ${CRYPTO_LIBS} ${EXTRALIBS})
1009 if(ENABLE_SHARED)
1010 foreach(name ceph-common client osdc)
1011 set(CEPHFS_LINK_FLAGS "${CEPHFS_LINK_FLAGS} -Wl,--exclude-libs,lib${name}.a")
1012 endforeach()
1013 set_target_properties(cephfs PROPERTIES
1014 OUTPUT_NAME cephfs
1015 VERSION 2.0.0
1016 SOVERSION 2
1017 LINK_FLAGS ${CEPHFS_LINK_FLAGS})
1018 endif(ENABLE_SHARED)
1019 install(TARGETS cephfs DESTINATION ${CMAKE_INSTALL_LIBDIR})
1020 install(DIRECTORY
1021 "${CMAKE_SOURCE_DIR}/src/include/cephfs"
c07f9fc5 1022 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
7c673cae
FG
1023 set(ceph_syn_srcs
1024 ceph_syn.cc
1025 client/SyntheticClient.cc)
1026 add_executable(ceph-syn ${ceph_syn_srcs})
1027 target_link_libraries(ceph-syn client global-static common)
1028
1029 set(mount_ceph_srcs
1030 mount/mount.ceph.c)
1031 add_executable(mount.ceph ${mount_ceph_srcs}
1032 $<TARGET_OBJECTS:parse_secret_objs>
1033 $<TARGET_OBJECTS:common_mountcephfs_objs>)
1034 set_target_properties(mount.ceph PROPERTIES
1035 INSTALL_RPATH "")
1036 target_link_libraries(mount.ceph ${KEYUTILS_LIBRARIES})
1037
1038 install(TARGETS ceph-syn DESTINATION bin)
1039 install(TARGETS mount.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
1040endif(WITH_LIBCEPHFS)
1041
1042if(WITH_FUSE)
1043 set(ceph_fuse_srcs
1044 ceph_fuse.cc
1045 client/fuse_ll.cc)
1046 add_executable(ceph-fuse ${ceph_fuse_srcs})
1047 target_link_libraries(ceph-fuse ${ALLOC_LIBS} ${FUSE_LIBRARIES}
1048 client common global-static)
1049 set_target_properties(ceph-fuse PROPERTIES COMPILE_FLAGS "-I${FUSE_INCLUDE_DIRS}")
1050 install(TARGETS ceph-fuse DESTINATION bin)
1051 install(PROGRAMS mount.fuse.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
1052endif(WITH_FUSE)
1053
1054add_subdirectory(journal)
1055
1056if(WITH_RBD)
1057 if(WITH_KRBD)
1058 add_library(krbd STATIC krbd.cc
1059 $<TARGET_OBJECTS:parse_secret_objs>)
1060 target_link_libraries(krbd ${KEYUTILS_LIBRARIES} ${UDEV_LIBRARIES})
1061 endif()
1062 add_subdirectory(librbd)
1063 if(WITH_FUSE)
1064 add_subdirectory(rbd_fuse)
1065 endif()
1066
1067 install(PROGRAMS
1068 ${CMAKE_SOURCE_DIR}/src/ceph-rbdnamer
1069 ${CMAKE_SOURCE_DIR}/src/rbd-replay-many
1070 ${CMAKE_SOURCE_DIR}/src/rbdmap
1071 DESTINATION ${CMAKE_INSTALL_BINDIR})
1072 add_subdirectory(rbd_replay)
1073endif(WITH_RBD)
1074
1075# RadosGW
1076if(WITH_KVS)
1077 add_subdirectory(key_value_store)
1078endif(WITH_KVS)
1079
1080if(WITH_RADOSGW)
1081 set(civetweb_common_files civetweb/src/civetweb.c)
1082 add_library(civetweb_common_objs OBJECT ${civetweb_common_files})
1083 target_include_directories(civetweb_common_objs PRIVATE
1084 "${CMAKE_SOURCE_DIR}/src/civetweb/include")
1085 set_property(TARGET civetweb_common_objs
1086 APPEND PROPERTY COMPILE_DEFINITIONS USE_IPV6=1)
1087 if(USE_OPENSSL)
1088 set_property(TARGET civetweb_common_objs
1089 APPEND PROPERTY COMPILE_DEFINITIONS NO_SSL_DL=1)
1090 target_include_directories(civetweb_common_objs PRIVATE
1091 "${SSL_INCLUDE_DIR}")
1092 endif(USE_OPENSSL)
1093 if (LIBSSL_SONAME)
1094 set_property(TARGET civetweb_common_objs
1095 APPEND PROPERTY COMPILE_DEFINITIONS SSL_LIB="${LIBSSL_SONAME}")
1096 set_property(TARGET civetweb_common_objs
1097 APPEND PROPERTY COMPILE_DEFINITIONS CRYPTO_LIB="${LIBCRYPTO_SONAME}")
1098 endif()
1099
1100 add_subdirectory(rgw)
1101
1102endif(WITH_RADOSGW)
1103
1104install(FILES
1105 sample.ceph.conf
1106 DESTINATION ${CMAKE_INSTALL_DOCDIR})
7c673cae
FG
1107
1108# Now create a useable config.h
1109configure_file(
1110 ${CMAKE_SOURCE_DIR}/src/include/config-h.in.cmake
1111 ${CMAKE_BINARY_DIR}/include/acconfig.h
1112)
1113
1114add_subdirectory(brag)
1115
1116# Everything you need to spin up a cluster with vstart.sh
1117add_custom_target(vstart-base DEPENDS
1118 ceph-osd
1119 ceph-mon
1120 ceph-mgr
1121 ceph-authtool
1122 ceph-conf
1123 monmaptool
1124 crushtool
1125 rados
1126 cython_rados
1127 )
1128
1129add_custom_target(vstart DEPENDS
1130 vstart-base
1131 ceph-mds)
1132if(WITH_RADOSGW)
1133 add_dependencies(vstart radosgw radosgw-admin)
1134endif(WITH_RADOSGW)
1135
1136if(WITH_LTTNG)
1137 add_dependencies(vstart tracepoint_libraries)
1138endif(WITH_LTTNG)
1139
1140# Everything you need to run CephFS tests
1141add_custom_target(cephfs_testing DEPENDS
1142 vstart
1143 rados
1144 cython_modules
1145 cephfs
1146 cls_cephfs
1147 ceph-fuse
1148 ceph-dencoder
1149 cephfs-journal-tool
1150 cephfs-data-scan
1151 cephfs-table-tool)
1152
1153if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
1154 add_custom_target(
1155 git-update
1156 COMMAND git submodule sync
1157 COMMAND git submodule update --force --init --recursive
1158 WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
1159endif()
1160
1161add_subdirectory(script)