set(datadir ${CEPH_INSTALL_DATADIR})
set(prefix ${CMAKE_INSTALL_PREFIX})
+configure_file(${CMAKE_SOURCE_DIR}/src/init-ceph.in
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/init-ceph @ONLY)
+
+configure_file(ceph-post-file.in
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-post-file @ONLY)
+
+configure_file(ceph-crash.in
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crash @ONLY)
+
+# the src/.git_version file may be written out by make-dist; otherwise
+# we pull the git version from .git
+option(ENABLE_GIT_VERSION "build Ceph with git version string" ON)
+if(ENABLE_GIT_VERSION)
+ get_git_head_revision(GIT_REFSPEC CEPH_GIT_VER)
+ git_describe(CEPH_GIT_NICE_VER_WITH_V --always)
+ # remove leading 'v'
+ string(SUBSTRING ${CEPH_GIT_NICE_VER_WITH_V} 1 -1 CEPH_GIT_NICE_VER)
+ #if building from a source tarball via make-dist
+ if(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
+ message(STATUS "Ceph/.git directory not found, parsing ${CMAKE_CURRENT_SOURCE_DIR}/.git_version for CEPH_GIT_VER and CEPH_GIT_NICE_VER")
+ file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/.git_version CEPH_GIT_SHA_AND_TAG)
+ list(GET CEPH_GIT_SHA_AND_TAG 0 CEPH_GIT_VER)
+ list(GET CEPH_GIT_SHA_AND_TAG 1 CEPH_GIT_NICE_VER)
+ endif(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
+else(ENABLE_GIT_VERSION)
+ set(CEPH_GIT_VER "no_version")
+ set(CEPH_GIT_NICE_VER "Development")
+endif(ENABLE_GIT_VERSION)
+
+# the src/ceph_release file is 3 lines,
+# <release number, e.g. '12' for luminous>
+# <release name, e.g. 'luminous'>
+# <release type: 'dev' for x.0.z, 'rc' or x.1.z, or 'stable' or x.2.z>
+# note that the release name is semi-redundant and must match CEPH_RELEASE_*
+# definitions in include/rados.h and common/ceph_strings.c.
+file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/ceph_release CEPH_RELEASE_FILE)
+list(GET CEPH_RELEASE_FILE 0 CEPH_RELEASE)
+list(GET CEPH_RELEASE_FILE 1 CEPH_RELEASE_NAME)
+list(GET CEPH_RELEASE_FILE 2 CEPH_RELEASE_TYPE)
+
+configure_file(${CMAKE_SOURCE_DIR}/src/ceph.in
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph @ONLY)
+
+# Common infrastructure
+configure_file(
+ ${CMAKE_SOURCE_DIR}/src/ceph_ver.h.in.cmake
+ ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
+ @ONLY)
+
add_definitions(
-DHAVE_CONFIG_H
-D__CEPH__
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
if(MINGW)
# The MINGW headers are missing some "const" qualifiers.
- add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fpermissive>)
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
else()
string(APPEND CMAKE_EXE_LINKER_FLAGS " -rdynamic")
endif()
+ string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Og")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wstrict-null-sentinel>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-new-ttp-matching>)
# CMAKE_POSITION_INDEPENDENT_CODE is TRUE.
if(EXE_LINKER_USE_PIE)
if (NOT WITH_OSD_INSTRUMENT_FUNCTIONS AND NOT HAVE_SEASTAR)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS " -pie")
endif()
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_EXPORTS_C_FLAG}")
string(APPEND CMAKE_LINKER_FLAGS " -rdynamic -export-dynamic ${CMAKE_EXE_EXPORTS_C_FLAG}")
+ string(APPEND CMAKE_CXX_FLAGS_DEBUG " -g")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-inconsistent-missing-override>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-mismatched-tags>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-unused-private-field>)
endif()
endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
-if(NOT CMAKE_BUILD_TYPE)
- if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
- set(default_build_type "Debug")
- else()
- set(default_build_type "RelWithDebInfo")
- endif()
+if(NOT CMAKE_BUILD_TYPE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
+ set(default_build_type "Debug")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE)
endif()
-if(WITH_CEPH_DEBUG_MUTEX OR CMAKE_BUILD_TYPE STREQUAL Debug)
+if(WITH_CEPH_DEBUG_MUTEX)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-DCEPH_DEBUG_MUTEX>)
endif()
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.")
if(COMPILER_SUPPORTS_DIAGNOSTICS_COLOR)
- add_compile_options(-fdiagnostics-color=${DIAGNOSTICS_COLOR})
+ add_compile_options(
+ "$<$<COMPILE_LANGUAGE:C>:-fdiagnostics-color=${DIAGNOSTICS_COLOR}>"
+ "$<$<COMPILE_LANGUAGE:CXX>:-fdiagnostics-color=${DIAGNOSTICS_COLOR}>")
endif()
set(EXTRALIBS ${CMAKE_DL_LIBS})
list(APPEND EXTRALIBS gcov)
endif(${ENABLE_COVERAGE})
-set(GCOV_PREFIX_STRIP 4)
-
-# the src/.git_version file may be written out by make-dist; otherwise
-# we pull the git version from .git
-option(ENABLE_GIT_VERSION "build Ceph with git version string" ON)
-if(${ENABLE_GIT_VERSION})
- get_git_head_revision(GIT_REFSPEC CEPH_GIT_VER)
- git_describe(CEPH_GIT_NICE_VER_WITH_V --always)
- # remove leading 'v'
- string(SUBSTRING ${CEPH_GIT_NICE_VER_WITH_V} 1 -1 CEPH_GIT_NICE_VER)
- #if building from a source tarball via make-dist
- if(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
- message(STATUS "Ceph/.git directory not found, parsing ${CMAKE_CURRENT_SOURCE_DIR}/.git_version for CEPH_GIT_VER and CEPH_GIT_NICE_VER")
- file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/.git_version CEPH_GIT_SHA_AND_TAG)
- list(GET CEPH_GIT_SHA_AND_TAG 0 CEPH_GIT_VER)
- list(GET CEPH_GIT_SHA_AND_TAG 1 CEPH_GIT_NICE_VER)
- endif(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
-else(${ENABLE_GIT_VERSION})
- set(CEPH_GIT_VER "no_version")
- set(CEPH_GIT_NICE_VER "Development")
-endif(${ENABLE_GIT_VERSION})
-
-# the src/ceph_release file is 3 lines,
-# <release number, e.g. '12' for luminous>
-# <release name, e.g. 'luminous'>
-# <release type: 'dev' for x.0.z, 'rc' or x.1.z, or 'stable' or x.2.z>
-# note that the release name is semi-redundant and must match CEPH_RELEASE_*
-# definitions in include/rados.h and common/ceph_strings.c.
-file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/ceph_release CEPH_RELEASE_FILE)
-list(GET CEPH_RELEASE_FILE 0 CEPH_RELEASE)
-list(GET CEPH_RELEASE_FILE 1 CEPH_RELEASE_NAME)
-list(GET CEPH_RELEASE_FILE 2 CEPH_RELEASE_TYPE)
+if(WITH_TESTS)
+ set(GCOV_PREFIX_STRIP 4)
+ configure_file(${CMAKE_SOURCE_DIR}/src/ceph-coverage.in
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-coverage @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/src/ceph-debugpack.in
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-debugpack @ONLY)
+endif()
option(WITH_OCF "build OCF-compliant cluster resource agent" OFF)
if(WITH_OCF)
add_subdirectory(blkin/blkin-lib)
endif(WITH_BLKIN)
-# Common infrastructure
-configure_file(
- ${CMAKE_SOURCE_DIR}/src/ceph_ver.h.in.cmake
- ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
- @ONLY)
-
set(mds_files)
list(APPEND mds_files
mds/MDSMap.cc
add_subdirectory(crimson)
endif()
-function(compile_with_fmt target)
- get_target_property(fmt_compile_definitions
- fmt::fmt INTERFACE_COMPILE_DEFINITIONS)
- if(fmt_compile_definitions)
- target_compile_definitions(${target} PUBLIC
- ${fmt_compile_definitions})
- endif()
-endfunction()
+include(CheckTypeSize)
+set(CMAKE_EXTRA_INCLUDE_FILES "sys/time.h")
+CHECK_TYPE_SIZE(suseconds_t SUSECONDS_T)
+unset(CMAKE_EXTRA_INCLUDE_FILES)
set(libcommon_files
${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
global/global_context.cc
xxHash/xxhash.c
common/error_code.cc
+ common/tracer.cc
log/Log.cc
mon/MonCap.cc
mon/MonClient.cc
osdc/Objecter.cc
osdc/error_code.cc
librbd/Features.cc
+ librbd/io/IoOperations.cc
${mds_files})
-if(WITH_JAEGER)
- list(APPEND libcommon_files common/tracer.cc)
-endif()
+
set_source_files_properties(ceph_ver.c
APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)
add_library(common-objs OBJECT ${libcommon_files})
-compile_with_fmt(common-objs)
+target_compile_definitions(common-objs PRIVATE
+ $<TARGET_PROPERTY:fmt::fmt,INTERFACE_COMPILE_DEFINITIONS>)
+add_dependencies(common-objs legacy-option-headers)
if(WITH_JAEGER)
- find_package(yaml-cpp 0.6.0)
- if(NOT yaml-cpp_FOUND)
- set(jaeger_libs ${CMAKE_BINARY_DIR}/external/lib/libyaml-cpp.so
- ${CMAKE_BINARY_DIR}/external/lib/libyaml-cpp.so.0.6
- ${CMAKE_BINARY_DIR}/external/lib/libyaml-cpp.so.0.6.2)
- #customize libjaeger.install
- execute_process(COMMAND bash -c "sed -i 's/#//' debian/libjaeger.install"
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
- execute_process(COMMAND bash -c "grep -q 'yaml-cpp' debian/libjaeger.install || echo 'usr/lib/libyaml-cpp.so.*' >> debian/libjaeger.install"
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
- endif()
- include(IncludeJaeger)
- add_library(jaeger-base INTERFACE)
- add_dependencies(common-objs
- yaml-cpp::yaml-cpp
- opentracing::libopentracing
- thrift::libthrift
- jaegertracing::libjaegertracing)
- target_link_libraries(jaeger-base INTERFACE
- yaml-cpp::yaml-cpp
- opentracing::libopentracing
- thrift::libthrift
- jaegertracing::libjaegertracing)
- include_directories(SYSTEM ${CMAKE_BINARY_DIR}/external/include)
- #with CMake 3.12+ the following can be replaced by:
- #target_link_libraries(common-objs jaeger-base)
- list(APPEND jaeger_libs
- ${CMAKE_BINARY_DIR}/external/lib/libjaegertracing.so.0
- ${CMAKE_BINARY_DIR}/external/lib/libjaegertracing.so.0.6.1
- ${CMAKE_BINARY_DIR}/external/lib/libopentracing.so.1
- ${CMAKE_BINARY_DIR}/external/lib/libopentracing.so.1.6.0
- ${CMAKE_BINARY_DIR}/external/lib/libthrift.so.0.13.0)
- install(FILES ${jaeger_libs}
- DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ find_package(thrift 0.13.0 REQUIRED)
+ include(BuildOpentelemetry)
+ build_opentelemetry()
+ set(jaeger_base opentelemetry::libopentelemetry thrift::libthrift)
+ add_dependencies(common-objs ${jaeger_base})
+ target_link_libraries(common-objs ${jaeger_base})
endif()
CHECK_C_COMPILER_FLAG("-fvar-tracking-assignments" HAS_VTA)
set(ceph_common_objs
$<TARGET_OBJECTS:common-auth-objs>
$<TARGET_OBJECTS:common-common-objs>
+ $<TARGET_OBJECTS:common-options-objs>
$<TARGET_OBJECTS:common-msg-objs>
$<TARGET_OBJECTS:common_buffer_obj>
$<TARGET_OBJECTS:common_texttable_obj>
Boost::program_options
Boost::date_time
Boost::iostreams
- fmt::fmt
StdFilesystem::filesystem
fmt::fmt
${BLKID_LIBRARIES}
endif()
if(WITH_JAEGER)
- list(APPEND ceph_common_deps jaeger-base)
+ list(APPEND ceph_common_deps ${jaeger_base})
endif()
if(WIN32)
if(WITH_BLUESTORE_PMEM OR WITH_RBD_RWL)
if(WITH_SYSTEM_PMDK)
+ set(pmem_COMPONENTS)
if(WITH_BLUESTORE_PMEM)
- find_package(pmem REQUIRED COMPONENTS pmem)
+ list(APPEND pmem_COMPONENTS pmem)
endif()
if(WITH_RBD_RWL)
- find_package(pmem REQUIRED COMPONENTS pmemobj)
+ list(APPEND pmem_COMPONENTS pmemobj)
endif()
find_package(pmem 1.10 REQUIRED COMPONENTS ${pmem_COMPONENTS})
else()
add_library(common STATIC ${ceph_common_objs})
target_link_libraries(common ${ceph_common_deps})
+add_dependencies(common legacy-option-headers ${jaeger_base})
add_library(ceph-common SHARED ${ceph_common_objs})
target_link_libraries(ceph-common ${ceph_common_deps})
+add_dependencies(ceph-common legacy-option-headers ${jaeger_base})
# appease dpkg-shlibdeps
set_target_properties(ceph-common PROPERTIES
SOVERSION 2
add_subdirectory(global)
-if(NOT WIN32)
+# RGW also support Lua scripting
+if(WITH_CEPHFS OR WITH_RADOSGW)
find_package(Lua 5.3 REQUIRED)
endif()
add_subdirectory(libradosstriper)
endif()
-add_subdirectory(mgr)
+# make rocksdb statically
+
+if(NOT WITH_SYSTEM_ROCKSDB)
+ include(BuildRocksDB)
+ build_rocksdb()
+endif(NOT WITH_SYSTEM_ROCKSDB)
+
+if(WITH_MGR)
+ add_subdirectory(mgr)
+endif()
set(librados_config_srcs
librados-config.cc)
install(TARGETS ceph-mon DESTINATION bin)
# OSD/ObjectStore
-# make rocksdb statically
-
-if(NOT WITH_SYSTEM_ROCKSDB)
- include(BuildRocksDB)
- build_rocksdb()
-endif(NOT WITH_SYSTEM_ROCKSDB)
include(TestBigEndian)
test_big_endian(CEPH_BIG_ENDIAN)
osd/objclass.cc
objclass/class_api.cc
ceph_osd.cc)
-if(WITH_JAEGER)
- list(APPEND ceph_osd_srcs common/tracer.cc)
-endif()
+
add_executable(ceph-osd ${ceph_osd_srcs})
add_dependencies(ceph-osd erasure_code_plugins)
target_link_libraries(ceph-osd osd os global-static common
add_subdirectory(crypto)
-if(WITH_TESTS)
- configure_file(${CMAKE_SOURCE_DIR}/src/ceph-coverage.in
- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-coverage @ONLY)
- configure_file(${CMAKE_SOURCE_DIR}/src/ceph-debugpack.in
- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-debugpack @ONLY)
-endif()
-
-configure_file(${CMAKE_SOURCE_DIR}/src/ceph.in
- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph @ONLY)
-
-configure_file(${CMAKE_SOURCE_DIR}/src/init-ceph.in
- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/init-ceph @ONLY)
-
-configure_file(ceph-post-file.in
- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-post-file @ONLY)
-
-configure_file(ceph-crash.in
- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crash @ONLY)
-
if(WITH_TESTS)
install(PROGRAMS
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-debugpack
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-post-file
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crash
- ${CMAKE_SOURCE_DIR}/src/ceph-run
- ${CMAKE_SOURCE_DIR}/src/ceph-clsinfo
+ ceph-run
+ ceph-clsinfo
DESTINATION bin)
install(PROGRAMS
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/init-ceph
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/ceph)
install(PROGRAMS
- ${CMAKE_SOURCE_DIR}/src/ceph-create-keys
+ ceph-create-keys
DESTINATION sbin)
add_subdirectory(bash_completion)
endif(ENABLE_SHARED)
install(TARGETS cephfs DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY
- "${CMAKE_SOURCE_DIR}/src/include/cephfs"
+ "include/cephfs"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
set(ceph_syn_srcs
ceph_syn.cc
endif()
install(PROGRAMS
- ${CMAKE_SOURCE_DIR}/src/ceph-rbdnamer
- ${CMAKE_SOURCE_DIR}/src/rbd-replay-many
- ${CMAKE_SOURCE_DIR}/src/rbdmap
+ ceph-rbdnamer
+ rbd-replay-many
+ rbdmap
DESTINATION ${CMAKE_INSTALL_BINDIR})
add_subdirectory(rbd_replay)
endif(WITH_RBD)
if(WITH_RADOSGW)
add_subdirectory(libkmip)
-
- set(civetweb_common_files civetweb/src/civetweb.c)
- add_library(civetweb_common_objs OBJECT ${civetweb_common_files})
- target_include_directories(civetweb_common_objs SYSTEM PRIVATE
- "${CMAKE_SOURCE_DIR}/src/civetweb/include")
- set_property(TARGET civetweb_common_objs
- APPEND PROPERTY COMPILE_DEFINITIONS USE_IPV6=1)
- if (LIBSSL_SONAME)
- set_property(TARGET civetweb_common_objs
- APPEND PROPERTY COMPILE_DEFINITIONS SSL_LIB="${LIBSSL_SONAME}")
- set_property(TARGET civetweb_common_objs
- APPEND PROPERTY COMPILE_DEFINITIONS CRYPTO_LIB="${LIBCRYPTO_SONAME}")
- endif()
-
- if (OPENSSL_FOUND)
- # Use cmake to determine openssl version, a TODO is to make
- # civetweb itself do this based on openssl_api_compat strings
- if (NOT (OPENSSL_VERSION VERSION_LESS "1.1"))
- message(STATUS "Setting civetweb to use OPENSSL >= 1.1")
- set_property(TARGET civetweb_common_objs
- APPEND PROPERTY COMPILE_DEFINITIONS OPENSSL_API_1_1=1)
- endif()
- endif(OPENSSL_FOUND)
add_subdirectory(rgw)
-
endif(WITH_RADOSGW)
install(FILES
${CMAKE_BINARY_DIR}/include/acconfig.h
)
-if(NOT WIN32)
# Everything you need to spin up a cluster with vstart.sh
add_custom_target(vstart-base DEPENDS
ceph-osd
ceph-conf
monmaptool
crushtool
- rados
+ rados)
+if(NOT WIN32)
+ # WIN32 port does not build python bindings
+ # TODO: introduce an option for enabling python binding
+ add_dependencies(vstart-base
cython_rados)
+endif()
+
if (WITH_MGR)
add_dependencies(vstart-base ceph-mgr)
endif()
add_custom_target(vstart DEPENDS vstart-base)
-if(WITH_RBD)
+if(WITH_RBD AND NOT WIN32)
add_dependencies(vstart cython_rbd)
endif()
if (WITH_CEPHFS)
if(WITH_MGR)
add_dependencies(vstart ceph-volume-venv-setup)
endif()
-endif(NOT WIN32)
# Everything you need to run CephFS tests
add_custom_target(cephfs_testing DEPENDS
cls_cephfs
ceph-fuse
ceph-dencoder
+ ceph-dencoder-modules
cephfs-journal-tool
cephfs-meta-injection
cephfs-data-scan
rgw
COMMENT "Generate C++ documentation")
endif()
-