Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / CMakeLists.txt
1 include(GetGitRevisionDescription)
2
3 enable_language(C ASM)
4 include(GNUInstallDirs)
5 # for erasure and compressor plugins
6 set(CMAKE_INSTALL_PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
7 set(CMAKE_INSTALL_FULL_PKGLIBDIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME})
8 # so libceph-common can be found
9 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
10 if(NOT CMAKE_INSTALL_RPATH)
11   set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_PKGLIBDIR}")
12 endif()
13
14 # to be compatible with configure_files shared with autoconfig
15 set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
16 set(sbindir ${CMAKE_INSTALL_FULL_SBINDIR})
17 set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
18 set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR})
19 set(libexecdir ${CMAKE_INSTALL_FULL_LIBEXECDIR})
20 set(pkgdatadir ${CMAKE_INSTALL_FULL_DATADIR})
21 set(datadir ${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME})
22 set(prefix ${CMAKE_INSTALL_PREFIX})
23
24 add_definitions("-DCEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\"")
25 add_definitions("-DCEPH_PKGLIBDIR=\"${CMAKE_INSTALL_FULL_PKGLIBDIR}\"")
26 add_definitions("-DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS")
27 add_definitions("-D_FILE_OFFSET_BITS=64")
28 if(LINUX)
29   add_definitions("-D_GNU_SOURCE")
30 endif()
31
32 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wtype-limits -Wignored-qualifiers -Winit-self")
33 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char")
34
35 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-1024 -Wno-invalid-offsetof")
36 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor")
37 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
38 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-pragmas")
39 if(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")
42   if(NOT WITH_OSD_INSTRUMENT_FUNCTIONS)
43     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
44   endif()
45 elseif(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")
55 endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
56 set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
57
58 if(NOT CMAKE_BUILD_TYPE)
59   set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Default BUILD_TYPE is RelWithDebInfo, other options are: Debug, Release, and MinSizeRel." FORCE)
60 endif()
61
62 if(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()
70 endif()
71
72 include(CheckCCompilerFlag)
73 if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
74   CHECK_C_COMPILER_FLAG("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" HAS_FORTIFY_SOURCE)
75   if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
76     if(HAS_FORTIFY_SOURCE)
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")
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()
86 endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
87
88 include(SIMDExt)
89 if(HAVE_INTEL)
90   set(CMAKE_ASM_COMPILER  ${PROJECT_SOURCE_DIR}/src/yasm-wrapper)
91   set(CMAKE_ASM_FLAGS "-f elf64")
92 endif()
93
94 execute_process(
95   COMMAND yasm -f elf64 ${CMAKE_SOURCE_DIR}/src/common/crc32c_intel_fast_asm.s -o /dev/null
96   RESULT_VARIABLE no_yasm
97   OUTPUT_QUIET)
98 if(no_yasm)
99   message(STATUS " we do not have a modern/working yasm")
100 else(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
118         ${CMAKE_SOURCE_DIR}/src/isa-l/include/
119         ${CMAKE_SOURCE_DIR}/src/isa-l/erasure_code/gf_vect_dot_prod_avx2.asm
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")
133 endif(no_yasm)
134
135 # require c++11
136 if(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")
151 else()
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)
159 endif()
160
161 ## Handle diagnostics color if compiler supports them.
162 CHECK_C_COMPILER_FLAG("-fdiagnostics-color=always"
163   COMPILER_SUPPORTS_DIAGNOSTICS_COLOR)
164
165 set(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
168 if(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}")
171 endif()
172
173 set(EXTRALIBS rt ${CMAKE_DL_LIBS} ${ATOMIC_OPS_LIBRARIES})
174 if(LINUX)
175   set(LIB_RESOLV resolv)
176   list(APPEND EXTRALIBS ${LIB_RESOLV})
177 endif(LINUX)
178
179 option(WITH_PROFILER "build extra profiler binaries" OFF)
180 if(WITH_PROFILER)
181   find_package(gperftools REQUIRED)
182   list(APPEND EXTRALIBS profiler)
183 endif(WITH_PROFILER)
184
185 if(${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)
193 endif(${ENABLE_COVERAGE})
194
195 if(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)
201 endif(USE_NSS)
202
203 set(GCOV_PREFIX_STRIP 4)
204
205 # the src/.git_version file may be written out by make-dist; otherwise
206 # we pull the git version from .git
207 option(ENABLE_GIT_VERSION "build Ceph with git version string" ON)
208 if(${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)
220 else(${ENABLE_GIT_VERSION})
221   set(CEPH_GIT_VER "no_version")
222   set(CEPH_GIT_NICE_VER "Development")
223 endif(${ENABLE_GIT_VERSION})
224
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.
231 file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/ceph_release CEPH_RELEASE_FILE)
232 list(GET CEPH_RELEASE_FILE 0 CEPH_RELEASE)
233 list(GET CEPH_RELEASE_FILE 1 CEPH_RELEASE_NAME)
234 list(GET CEPH_RELEASE_FILE 2 CEPH_RELEASE_TYPE)
235
236 option(WITH_OCF "build OCF-compliant cluster resource agent" OFF)
237 if(WITH_OCF)
238   add_subdirectory(ocf)
239 endif()
240
241 option(WITH_CEPHFS_JAVA "build libcephfs Java bindings" OFF)
242 if(WITH_CEPHFS_JAVA)
243   add_subdirectory(java)
244 endif()
245
246 # Python stuff
247 find_package(PythonInterp 2 REQUIRED)
248 find_package(PythonLibs 2 REQUIRED)
249
250 option(WITH_PYTHON3 "build python3 bindings" "CHECK")
251 if(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()
259 elseif(WITH_PYTHON3)
260   find_package(Python3Interp 3 REQUIRED)
261   find_package(Python3Libs 3 REQUIRED)
262 endif()
263
264 if(HAVE_XIO)
265   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${XIO_INCLUDE_DIR}")
266   list(APPEND EXTRALIBS ${XIO_LIBRARY} pthread rt)
267 endif(HAVE_XIO)
268
269 if(HAVE_RDMA)
270   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${RDMA_INCLUDE_DIR}")
271   list(APPEND EXTRALIBS ${RDMA_LIBRARIES} pthread rt)
272 endif(HAVE_RDMA)
273
274 if(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})
281 endif(HAVE_DPDK)
282
283 # sort out which allocator to use
284 if(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)
288 elseif(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)
292 elseif(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)
296 elseif(ALLOCATOR STREQUAL "libc")
297   set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc)
298 endif()
299
300 # tcmalloc heap profiler
301 set(heap_profiler_files ${TCMALLOC_srcs})
302 add_library(heap_profiler_objs OBJECT ${heap_profiler_files})
303
304 if (WITH_BLKIN)
305   add_subdirectory(blkin/blkin-lib)
306 endif(WITH_BLKIN)
307
308 # Common infrastructure
309 configure_file(
310   ${CMAKE_SOURCE_DIR}/src/ceph_ver.h.in.cmake
311   ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
312   @ONLY)
313
314 set(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
329 set(mds_files)
330 list(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
338 set(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
348 add_library(crush_objs OBJECT ${crush_srcs})
349
350 add_subdirectory(json_spirit)
351
352 include_directories("${CMAKE_SOURCE_DIR}/src/xxHash")
353 include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/rapidjson/include")
354
355 set(GMOCK_INCLUDE_DIRS
356   "${CMAKE_SOURCE_DIR}/src/googletest/googletest/include/gmock")
357 set(GTEST_INCLUDE_DIRS
358   "${CMAKE_SOURCE_DIR}/src/googletest/googletest/include/gtest")
359
360 include_directories("${CMAKE_SOURCE_DIR}/src/dmclock/src")
361 include_directories("${CMAKE_SOURCE_DIR}/src/dmclock/support/src")
362
363 # needed for source files that friend unit tests (e.g., using FRIEND_TEST)
364 include_directories("${CMAKE_SOURCE_DIR}/src/googletest/googletest/include")
365
366 set(xio_common_srcs)
367 if(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)
374 endif(HAVE_XIO)
375
376 set(async_rdma_common_srcs)
377 if(HAVE_RDMA)
378   list(APPEND async_rdma_common_srcs
379     msg/async/rdma/Infiniband.cc
380     msg/async/rdma/RDMAConnectedSocketImpl.cc
381     msg/async/rdma/RDMAServerSocketImpl.cc
382     msg/async/rdma/RDMAStack.cc)
383 endif(HAVE_RDMA)
384
385 set(dpdk_common_srcs)
386 if(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}")
401 endif(HAVE_DPDK)
402
403 add_library(common_buffer_obj OBJECT
404   common/buffer.cc)
405
406 add_library(common_texttable_obj OBJECT
407   common/TextTable.cc)
408
409 set(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
456   common/iso_8601.cc
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
466   mon/PGMap.cc
467   mgr/ServiceMap.cc
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
487   common/reverse.c
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
496   common/pipe.c
497   common/ceph_argparse.cc
498   common/ceph_context.cc
499   common/code_environment.cc
500   common/dout.cc
501   common/signal.cc
502   common/Thread.cc
503   common/Formatter.cc
504   common/HTMLFormatter.cc
505   common/HeartbeatMap.cc
506   common/PluginRegistry.cc
507   common/ceph_fs.cc
508   common/ceph_hash.cc
509   common/ceph_strings.cc
510   common/ceph_frag.cc
511   common/options.cc
512   common/config.cc
513   common/utf8.c
514   common/mime.c
515   common/strtol.cc
516   common/page.cc
517   common/lockdep.cc
518   common/version.cc
519   common/hex.cc
520   common/entity_name.cc
521   common/ceph_crypto.cc
522   common/ceph_crypto_cms.cc
523   common/ceph_json.cc
524   common/ipaddr.cc
525   common/pick_address.cc
526   common/address_helper.cc
527   common/linux_version.c
528   common/TracepointProvider.cc
529   common/Cycles.cc
530   common/scrub_types.cc
531   common/bit_str.cc
532   osdc/Striper.cc
533   osdc/Objecter.cc
534   common/Graylog.cc
535   common/fs_types.cc
536   common/dns_resolve.cc
537   common/hostname.cc
538   common/util.cc
539   arch/probe.cc
540   ${auth_files}
541   ${mds_files})
542
543 CHECK_C_COMPILER_FLAG("-fvar-tracking-assignments" HAS_VTA)
544 if(HAS_VTA)
545   set_source_files_properties(
546     common/config.cc
547     common/options.cc
548     PROPERTIES COMPILE_FLAGS -fno-var-tracking-assignments)
549 endif()
550
551 if(FREEBSD)
552   list(APPEND libcommon_files common/freebsd_errno.cc)
553 elseif(DARWIN)
554   list(APPEND libcommon_files common/darwin_errno.cc)
555 elseif(SUN)
556   list(APPEND libcommon_files common/solaris_errno.cc)
557 elseif(AIX)
558   list(APPEND libcommon_files common/aix_errno.cc)
559 endif()
560
561 if(HAVE_ARM)
562   list(APPEND libcommon_files arch/arm.c)
563 elseif(HAVE_INTEL)
564   list(APPEND libcommon_files arch/intel.c)
565 elseif(HAVE_POWER8)
566   list(APPEND libcommon_files arch/ppc.c)
567 endif()
568
569 if(HAVE_INTEL)
570   list(APPEND libcommon_files
571     common/crc32c_intel_fast.c)
572   if(HAVE_GOOD_YASM_ELF64)
573     list(APPEND libcommon_files
574       common/crc32c_intel_fast_asm.s
575       common/crc32c_intel_fast_zero_asm.s)
576   endif(HAVE_GOOD_YASM_ELF64)
577 elseif(HAVE_POWER8)
578   list(APPEND libcommon_files
579     common/crc32c_ppc.c
580     common/crc32c_ppc_asm.S
581     common/crc32c_ppc_fast_zero_asm.S)
582 endif(HAVE_INTEL)
583
584 if(LINUX)
585   list(APPEND libcommon_files msg/async/EventEpoll.cc)
586   message(STATUS " Using EventEpoll for events.")
587 elseif(FREEBSD OR APPLE)
588   list(APPEND libcommon_files msg/async/EventKqueue.cc)
589   message(STATUS " Using EventKqueue for events.")
590 endif(LINUX)
591
592 if(WITH_LTTNG AND WITH_EVENTTRACE)
593   message(STATUS " Using EventTrace class.")
594   add_definitions("-DWITH_EVENTTRACE")
595   list(APPEND libcommon_files common/EventTrace.cc)
596 endif()
597
598 set(common_mountcephfs_files
599   common/armor.c
600   common/safe_io.c
601   common/module.c
602   common/addr_parsing.c)
603 add_library(common_mountcephfs_objs OBJECT
604   ${common_mountcephfs_files})
605
606 if(WITH_PROFILER)
607   list(APPEND libcommon_files
608     perfglue/cpu_profiler.cc)
609 else()
610   list(APPEND libcommon_files
611     perfglue/disabled_stubs.cc)
612 endif()
613
614 add_library(common-objs OBJECT ${libcommon_files})
615 set(ceph_common_objs
616   $<TARGET_OBJECTS:common_buffer_obj>
617   $<TARGET_OBJECTS:common_texttable_obj>
618   $<TARGET_OBJECTS:compressor_objs>
619   $<TARGET_OBJECTS:common-objs>
620   $<TARGET_OBJECTS:common_mountcephfs_objs>
621   $<TARGET_OBJECTS:global_common_objs>
622   $<TARGET_OBJECTS:crush_objs>)
623 set(ceph_common_deps
624   json_spirit erasure_code rt ${LIB_RESOLV}
625   Boost::thread
626   Boost::system
627   Boost::regex
628   Boost::random
629   Boost::program_options
630   Boost::date_time
631   Boost::iostreams
632   ${BLKID_LIBRARIES}
633   ${Backtrace_LIBRARIES}
634   ${BLKIN_LIBRARIES}
635   ${CRYPTO_LIBS}
636   ${CMAKE_THREAD_LIBS_INIT}
637   ${CMAKE_DL_LIBS})
638 if(HAVE_RDMA)
639   list(APPEND ceph_common_deps ${RDMA_LIBRARY})
640 endif()
641 if(NOT WITH_SYSTEM_BOOST)
642   list(APPEND ceph_common_deps ${ZLIB_LIBRARIES})
643 endif()
644
645 set_source_files_properties(${CMAKE_SOURCE_DIR}/src/ceph_ver.c
646   ${CMAKE_SOURCE_DIR}/src/common/version.cc
647   ${CMAKE_SOURCE_DIR}/src/test/encoding/ceph_dencoder.cc
648   APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)
649
650 if(HAVE_ARMV8_CRC)
651   add_library(common_crc_aarch64 STATIC common/crc32c_aarch64.c)
652   set_target_properties(common_crc_aarch64 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${ARMV8_CRC_COMPILE_FLAGS}")
653   list(APPEND ceph_common_deps common_crc_aarch64)
654 endif(HAVE_ARMV8_CRC)
655
656 add_library(common STATIC ${ceph_common_objs})
657 target_link_libraries(common ${ceph_common_deps})
658
659 add_library(ceph-common SHARED ${ceph_common_objs})
660 target_link_libraries(ceph-common ${ceph_common_deps})
661 # appease dpkg-shlibdeps
662 set_target_properties(ceph-common PROPERTIES
663   SOVERSION 0
664   INSTALL_RPATH "")
665 install(TARGETS ceph-common DESTINATION ${CMAKE_INSTALL_PKGLIBDIR})
666
667 add_library(common_utf8 STATIC common/utf8.c)
668
669 if(${WITH_LTTNG})
670   add_subdirectory(tracing)
671   add_dependencies(common-objs oprequest-tp)
672 endif(${WITH_LTTNG})
673
674 add_subdirectory(global)
675
676 add_subdirectory(lua)
677
678 # rados object classes
679 add_subdirectory(cls)
680
681 # RADOS client/library
682 add_subdirectory(osdc)
683
684 add_library(rados_snap_set_diff_obj OBJECT librados/snap_set_diff.cc)
685
686 add_subdirectory(include)
687 add_subdirectory(librados)
688 add_subdirectory(libradosstriper)
689
690 if (WITH_MGR)
691   set(mgr_srcs
692       ceph_mgr.cc
693       mon/PGMap.cc
694       mgr/DaemonState.cc
695       mgr/DaemonServer.cc
696       mgr/ClusterState.cc
697       mgr/ActivePyModules.cc
698       mgr/StandbyPyModules.cc
699       mgr/PyModuleRegistry.cc
700       mgr/PyModuleRunner.cc
701       mgr/PyFormatter.cc
702       mgr/PyOSDMap.cc
703       mgr/BaseMgrModule.cc
704       mgr/BaseMgrStandbyModule.cc
705       mgr/ActivePyModule.cc
706       mgr/MgrStandby.cc
707       mgr/Mgr.cc
708       mgr/Gil.cc
709       mgr/mgr_commands.cc)
710   add_executable(ceph-mgr ${mgr_srcs}
711                  $<TARGET_OBJECTS:heap_profiler_objs>)
712   target_include_directories(ceph-mgr PRIVATE "${PYTHON_INCLUDE_DIRS}")
713   target_link_libraries(ceph-mgr osdc client global-static common
714       Boost::python ${PYTHON_LIBRARIES} ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS} ${ALLOC_LIBS})
715   install(TARGETS ceph-mgr DESTINATION bin)
716 endif (WITH_MGR)
717
718 set(librados_config_srcs
719   librados-config.cc)
720 add_executable(librados-config ${librados_config_srcs})
721 target_link_libraries(librados-config librados global ${BLKID_LIBRARIES} ${RDMA_LIBRARIES}
722   ${CMAKE_DL_LIBS})
723
724 install(TARGETS librados-config DESTINATION bin)
725
726 # virtualenv base directory for ceph-disk and ceph-detect-init
727 set(CEPH_BUILD_VIRTUALENV $ENV{TMPDIR})
728 if(NOT CEPH_BUILD_VIRTUALENV)
729   set(CEPH_BUILD_VIRTUALENV /tmp)
730 endif()
731
732 add_subdirectory(pybind)
733 add_subdirectory(ceph-disk)
734 add_subdirectory(ceph-volume)
735 add_subdirectory(ceph-detect-init)
736
737 ## dencoder
738 if(HAS_VTA)
739   set_source_files_properties(test/encoding/ceph_dencoder.cc
740     PROPERTIES COMPILE_FLAGS -fno-var-tracking-assignments)
741 endif()
742
743 set(dencoder_srcs
744   test/encoding/ceph_dencoder.cc
745   $<TARGET_OBJECTS:common_texttable_obj>
746   )
747 if(${WITH_RADOSGW})
748   list(APPEND dencoder_srcs
749     rgw/rgw_dencoder.cc
750   )
751   set(DENCODER_EXTRALIBS
752     rgw_a
753     cls_rgw_client
754   )
755 endif(${WITH_RADOSGW})
756 if(WITH_RBD)
757   set(DENCODER_EXTRALIBS
758     ${DENCODER_EXTRALIBS}
759     cls_rbd_client
760     rbd_mirror_types
761     rbd_types
762     rbd_replay_types)
763   if(WITH_KRBD)
764     set(DENCODER_EXTRALIBS
765       ${DENCODER_EXTRALIBS}
766       krbd)
767   endif()
768 endif(WITH_RBD)
769
770 add_executable(ceph-dencoder ${dencoder_srcs})
771 target_link_libraries(ceph-dencoder
772   global
773   os
774   osd
775   mds
776   mon
777   journal
778   ${DENCODER_EXTRALIBS}
779   cls_lock_client
780   cls_refcount_client
781   cls_log_client
782   cls_statelog_client
783   cls_version_client
784   cls_replica_log_client
785   cls_user_client
786   cls_journal_client
787   cls_timeindex_client
788   ${EXTRALIBS}
789   ${CMAKE_DL_LIBS}
790   )
791 install(TARGETS ceph-dencoder DESTINATION bin)
792
793 # Monitor
794 add_subdirectory(mon)
795 set(ceph_mon_srcs
796   ceph_mon.cc)
797 add_executable(ceph-mon ${ceph_mon_srcs}
798   $<TARGET_OBJECTS:common_texttable_obj>)
799 add_dependencies(ceph-mon erasure_code_plugins)
800 target_link_libraries(ceph-mon mon common os global-static common
801   ${EXTRALIBS}
802   ${CMAKE_DL_LIBS})
803 install(TARGETS ceph-mon DESTINATION bin)
804
805 # OSD/ObjectStore
806 # make rocksdb statically
807
808 if (NOT WITH_SYSTEM_ROCKSDB)
809   set(ROCKSDB_CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON)
810
811   if(ALLOCATOR STREQUAL "jemalloc")
812     list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_JEMALLOC=ON)
813   endif()
814
815   if (WITH_CCACHE AND CCACHE_FOUND)
816     list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_CXX_COMPILER=ccache)
817     list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_CXX_COMPILER_ARG1=${CMAKE_CXX_COMPILER})
818   else(WITH_CCACHE AND CCACHE_FOUND)
819     list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
820   endif(WITH_CCACHE AND CCACHE_FOUND)
821
822   # SSE 4.2 is enabled by default in rocksdb's crc32c. For details refer to
823   # rocksdb/util/crc32c.cc.
824   list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_AR=${CMAKE_AR})
825   list(APPEND ROCKSDB_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
826
827   if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
828     list(APPEND ROCKSDB_CMAKE_ARGS -DFAIL_ON_WARNINGS=OFF)
829   endif()
830
831   # we use an external project and copy the sources to bin directory to ensure
832   # that object files are built outside of the source tree.
833   include(ExternalProject)
834   ExternalProject_Add(rocksdb_ext
835     SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb
836     CMAKE_ARGS ${ROCKSDB_CMAKE_ARGS}
837     BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/rocksdb
838     BUILD_COMMAND $(MAKE) rocksdb
839     INSTALL_COMMAND "true")
840
841   # force rocksdb make to be called on each time
842   ExternalProject_Add_Step(rocksdb_ext forcebuild
843     DEPENDEES configure
844     DEPENDERS build
845     COMMAND "true"
846     ALWAYS 1)
847
848   set(ROCKSDB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/include)
849
850   add_library(rocksdb STATIC IMPORTED)
851   add_dependencies(rocksdb rocksdb_ext)
852   set_property(TARGET rocksdb PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rocksdb/librocksdb.a")
853   set(ROCKSDB_LIBRARIES rocksdb)
854
855 endif(NOT WITH_SYSTEM_ROCKSDB)
856
857 include(TestBigEndian)
858 test_big_endian(CEPH_BIG_ENDIAN)
859 if(NOT CEPH_BIG_ENDIAN)
860   set(CEPH_LITTLE_ENDIAN 1)
861 endif()
862
863 add_subdirectory(kv)
864 add_subdirectory(os)
865
866 set(cls_references_files objclass/class_api.cc)
867 add_library(cls_references_objs OBJECT ${cls_references_files})
868
869 add_subdirectory(osd)
870
871 set(ceph_osd_srcs
872   ceph_osd.cc)
873 add_executable(ceph-osd ${ceph_osd_srcs})
874 add_dependencies(ceph-osd erasure_code_plugins)
875 target_link_libraries(ceph-osd osd os global-static common
876   ${BLKID_LIBRARIES} ${RDMA_LIBRARIES})
877 if(WITH_FUSE)
878   target_link_libraries(ceph-osd ${FUSE_LIBRARIES})
879 endif()
880 install(TARGETS ceph-osd DESTINATION bin)
881
882 add_subdirectory(mds)
883 set(ceph_mds_srcs
884   ceph_mds.cc)
885 add_executable(ceph-mds ${ceph_mds_srcs})
886 target_link_libraries(ceph-mds mds ${CMAKE_DL_LIBS} global-static common
887   Boost::thread)
888 install(TARGETS ceph-mds DESTINATION bin)
889
890 add_subdirectory(erasure-code)
891
892 # Support/Tools
893 if(WITH_TESTS)
894 add_subdirectory(googletest/googlemock)
895 add_subdirectory(test)
896 endif(WITH_TESTS)
897
898 add_subdirectory(compressor)
899
900 add_subdirectory(tools)
901
902 # dmClock (after gmock)
903
904 add_subdirectory(dmclock/src)
905
906 option(WITH_DMCLOCK_TESTS
907   "enable the build of dmclock-tests and dmclock-data-struct tests binaries"
908   OFF)
909 if(WITH_TESTS AND WITH_DMCLOCK_TESTS)
910   # note: add_test is not being called, so dmclock tests aren't part
911   # of ceph tests
912   add_subdirectory(dmclock/test)
913   add_subdirectory(dmclock/support/test)
914 endif(WITH_TESTS AND WITH_DMCLOCK_TESTS)
915
916 if(HAVE_INTEL AND HAVE_BETTER_YASM_ELF64)
917   add_subdirectory(crypto/isa-l)
918 endif(HAVE_INTEL AND HAVE_BETTER_YASM_ELF64)
919
920 if(WITH_TESTS)
921
922 configure_file(${CMAKE_SOURCE_DIR}/src/ceph-coverage.in
923   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-coverage @ONLY)
924
925 configure_file(${CMAKE_SOURCE_DIR}/src/ceph-debugpack.in
926   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-debugpack @ONLY)
927 endif(WITH_TESTS)
928
929 configure_file(${CMAKE_SOURCE_DIR}/src/ceph.in
930   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph @ONLY)
931
932 configure_file(${CMAKE_SOURCE_DIR}/src/ceph-crush-location.in
933   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crush-location @ONLY)
934
935 configure_file(${CMAKE_SOURCE_DIR}/src/init-ceph.in
936   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/init-ceph @ONLY)
937
938 configure_file(ceph-post-file.in
939   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-post-file @ONLY)
940
941 if(WITH_TESTS)
942 install(PROGRAMS
943   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-debugpack
944   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-coverage
945   DESTINATION bin)
946 endif(WITH_TESTS)
947
948 install(PROGRAMS
949   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph
950   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crush-location
951   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-post-file
952   ${CMAKE_SOURCE_DIR}/src/ceph-run
953   ${CMAKE_SOURCE_DIR}/src/ceph-rest-api
954   ${CMAKE_SOURCE_DIR}/src/ceph-clsinfo
955   DESTINATION bin)
956 install(PROGRAMS
957   ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/init-ceph
958   DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/init.d
959   RENAME ceph)
960
961 install(FILES
962   ${CMAKE_SOURCE_DIR}/share/id_rsa_drop.ceph.com
963   ${CMAKE_SOURCE_DIR}/share/id_rsa_drop.ceph.com.pub
964   ${CMAKE_SOURCE_DIR}/share/known_hosts_drop.ceph.com
965   DESTINATION ${CMAKE_INSTALL_DATADIR}/ceph)
966
967 install(PROGRAMS
968   ceph_common.sh
969   ceph-osd-prestart.sh
970   DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/ceph)
971
972 install(PROGRAMS
973   ${CMAKE_SOURCE_DIR}/src/ceph-create-keys
974 #  ${CMAKE_SOURCE_DIR}/src/ceph-disk
975   DESTINATION sbin)
976
977 add_subdirectory(bash_completion)
978
979 if(WITH_LIBCEPHFS OR WITH_KRBD)
980   set(parse_secret_files
981     common/secret.c)
982   add_library(parse_secret_objs OBJECT ${parse_secret_files})
983 endif()
984
985 add_subdirectory(client)
986
987 if(WITH_LIBCEPHFS)
988   set(libcephfs_srcs libcephfs.cc)
989   add_library(cephfs ${CEPH_SHARED} ${libcephfs_srcs})
990   target_link_libraries(cephfs LINK_PRIVATE client ceph-common
991     ${CRYPTO_LIBS} ${EXTRALIBS})
992   if(ENABLE_SHARED)
993     foreach(name ceph-common client osdc)
994       set(CEPHFS_LINK_FLAGS "${CEPHFS_LINK_FLAGS} -Wl,--exclude-libs,lib${name}.a")
995     endforeach()
996     set_target_properties(cephfs PROPERTIES
997       OUTPUT_NAME cephfs
998       VERSION 2.0.0
999       SOVERSION 2
1000       LINK_FLAGS ${CEPHFS_LINK_FLAGS})
1001   endif(ENABLE_SHARED)
1002   install(TARGETS cephfs DESTINATION ${CMAKE_INSTALL_LIBDIR})
1003   install(DIRECTORY
1004     "${CMAKE_SOURCE_DIR}/src/include/cephfs"
1005     DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
1006   set(ceph_syn_srcs
1007     ceph_syn.cc
1008     client/SyntheticClient.cc)
1009   add_executable(ceph-syn ${ceph_syn_srcs})
1010   target_link_libraries(ceph-syn client global-static common)
1011
1012   set(mount_ceph_srcs
1013     mount/mount.ceph.c)
1014   add_executable(mount.ceph ${mount_ceph_srcs}
1015     $<TARGET_OBJECTS:parse_secret_objs>
1016     $<TARGET_OBJECTS:common_mountcephfs_objs>)
1017   set_target_properties(mount.ceph PROPERTIES
1018     INSTALL_RPATH "")
1019   target_link_libraries(mount.ceph ${KEYUTILS_LIBRARIES})
1020
1021   install(TARGETS ceph-syn DESTINATION bin)
1022   install(TARGETS mount.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
1023 endif(WITH_LIBCEPHFS)
1024
1025 if(WITH_FUSE)
1026   set(ceph_fuse_srcs
1027     ceph_fuse.cc
1028     client/fuse_ll.cc)
1029   add_executable(ceph-fuse ${ceph_fuse_srcs})
1030   target_link_libraries(ceph-fuse ${ALLOC_LIBS} ${FUSE_LIBRARIES}
1031     client common global-static)
1032   set_target_properties(ceph-fuse PROPERTIES COMPILE_FLAGS "-I${FUSE_INCLUDE_DIRS}")
1033   install(TARGETS ceph-fuse DESTINATION bin)
1034   install(PROGRAMS mount.fuse.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
1035 endif(WITH_FUSE)
1036
1037 add_subdirectory(journal)
1038
1039 if(WITH_RBD)
1040   if(WITH_KRBD)
1041     add_library(krbd STATIC krbd.cc
1042       $<TARGET_OBJECTS:parse_secret_objs>)
1043     target_link_libraries(krbd ${KEYUTILS_LIBRARIES} ${UDEV_LIBRARIES})
1044   endif()
1045   add_subdirectory(librbd)
1046   if(WITH_FUSE)
1047     add_subdirectory(rbd_fuse)
1048   endif()
1049
1050   install(PROGRAMS
1051     ${CMAKE_SOURCE_DIR}/src/ceph-rbdnamer
1052     ${CMAKE_SOURCE_DIR}/src/rbd-replay-many
1053     ${CMAKE_SOURCE_DIR}/src/rbdmap
1054     DESTINATION ${CMAKE_INSTALL_BINDIR})
1055   add_subdirectory(rbd_replay)
1056 endif(WITH_RBD)
1057
1058 # RadosGW
1059 if(WITH_KVS)
1060   add_subdirectory(key_value_store)
1061 endif(WITH_KVS)
1062
1063 if(WITH_RADOSGW)
1064   set(civetweb_common_files civetweb/src/civetweb.c)
1065   add_library(civetweb_common_objs OBJECT ${civetweb_common_files})
1066   target_include_directories(civetweb_common_objs PRIVATE
1067         "${CMAKE_SOURCE_DIR}/src/civetweb/include")
1068   set_property(TARGET civetweb_common_objs
1069     APPEND PROPERTY COMPILE_DEFINITIONS USE_IPV6=1)
1070   if(USE_OPENSSL)
1071     set_property(TARGET civetweb_common_objs
1072       APPEND PROPERTY COMPILE_DEFINITIONS NO_SSL_DL=1)
1073     target_include_directories(civetweb_common_objs PRIVATE
1074       "${SSL_INCLUDE_DIR}")
1075   endif(USE_OPENSSL)
1076   if (LIBSSL_SONAME)
1077     set_property(TARGET civetweb_common_objs
1078       APPEND PROPERTY COMPILE_DEFINITIONS SSL_LIB="${LIBSSL_SONAME}")
1079     set_property(TARGET civetweb_common_objs
1080       APPEND PROPERTY COMPILE_DEFINITIONS CRYPTO_LIB="${LIBCRYPTO_SONAME}")
1081   endif()
1082
1083   add_subdirectory(rgw)
1084
1085 endif(WITH_RADOSGW)
1086
1087 install(FILES
1088   sample.ceph.conf
1089   DESTINATION ${CMAKE_INSTALL_DOCDIR})
1090
1091 # Now create a useable config.h
1092 configure_file(
1093   ${CMAKE_SOURCE_DIR}/src/include/config-h.in.cmake
1094   ${CMAKE_BINARY_DIR}/include/acconfig.h
1095 )
1096
1097 add_subdirectory(brag)
1098
1099 # Everything you need to spin up a cluster with vstart.sh
1100 add_custom_target(vstart-base DEPENDS
1101     ceph-osd
1102     ceph-mon
1103     ceph-mgr
1104     ceph-authtool
1105     ceph-conf
1106     monmaptool
1107     crushtool
1108     rados
1109     cython_rados
1110     )
1111
1112 add_custom_target(vstart DEPENDS
1113     vstart-base
1114     ceph-mds)
1115 if(WITH_RADOSGW)
1116   add_dependencies(vstart radosgw radosgw-admin)
1117 endif(WITH_RADOSGW)
1118
1119 if(WITH_LTTNG)
1120   add_dependencies(vstart tracepoint_libraries)
1121 endif(WITH_LTTNG)
1122
1123 # Everything you need to run CephFS tests
1124 add_custom_target(cephfs_testing DEPENDS
1125     vstart
1126     rados
1127     cython_modules
1128     cephfs
1129     cls_cephfs
1130     ceph-fuse
1131     ceph-dencoder
1132     cephfs-journal-tool
1133     cephfs-data-scan
1134     cephfs-table-tool)
1135
1136 if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
1137   add_custom_target(
1138     git-update
1139     COMMAND git submodule sync
1140     COMMAND git submodule update --force --init --recursive
1141     WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
1142 endif()
1143
1144 add_subdirectory(script)
1145
1146 if(WITH_EMBEDDED)
1147   add_subdirectory(libcephd)
1148 endif()