mirror of
https://github.com/ceph/ceph
synced 2025-01-01 00:22:25 +00:00
cmake: compile crimson-specific libraries
- add crimson::cflags target for populating WITH_SEASTAR=1 macro so any library linking against crimson::cflags will have WITH_SEASTAR=1 defined. but we still need to set the definition and include directories for object targets. - there are two ways to use the seastar logging backend, to specify the backend at run-time, or to do so at compile-time. if we do so at run-time, we would need to include seastar specific headers in dout.h. this will force the non-seastar-osd components to pull in seastar header file or linkage dependencies. and it's not performant, as we need to check the option everytime we are about the print a log message as the ceph::common::ConfigProxy for seastar is not compatible ::ConfigProxy at binary level -- they don't inherit from the same parent class, and ceph_context does not keep a reference of this nonexistent parent class. if we respect WITH_SEASTAR preprocessor macro, the only downside is that we need to re-compile all compilation units using logging with WITH_SEASTAR=1. and this implies a side effect, we don't need to use template techniques to specialize for seastar anymore, we can just conditionalize the seastar/alien specific behavior on `#ifdef WITH_SEASTAR`. so in this change, we compile crimson-common and crimson-auth as the alternatives of ceph-common and common-auth-objs respectively. and WITH_SEASTAR=1 is defined when compiling them. Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
4488b504d6
commit
6fdc2c13de
@ -307,6 +307,9 @@ if(WITH_SEASTAR)
|
||||
endif()
|
||||
endmacro ()
|
||||
add_subdirectory(seastar)
|
||||
# create the directory so cmake won't complain when looking at the imported
|
||||
# target: Seastar exports this directory created at build-time
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/seastar/gen")
|
||||
add_subdirectory(crimson)
|
||||
endif()
|
||||
|
||||
|
@ -14,3 +14,10 @@ set(auth_srcs
|
||||
unknown/AuthUnknownAuthorizeHandler.cc)
|
||||
|
||||
add_library(common-auth-objs OBJECT ${auth_srcs})
|
||||
if(WITH_SEASTAR)
|
||||
add_library(crimson-auth OBJECT ${auth_srcs})
|
||||
target_compile_definitions(crimson-auth PRIVATE
|
||||
"WITH_SEASTAR=1")
|
||||
target_include_directories(crimson-auth PRIVATE
|
||||
$<TARGET_PROPERTY:Seastar::seastar,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endif()
|
||||
|
@ -1,3 +1,115 @@
|
||||
add_library(crimson::cflags INTERFACE IMPORTED)
|
||||
set_target_properties(crimson::cflags PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "WITH_SEASTAR=1"
|
||||
INTERFACE_LINK_LIBRARIES Seastar::seastar)
|
||||
|
||||
set(crimson_common_srcs
|
||||
common/config_proxy.cc
|
||||
common/assert.cc
|
||||
common/log.cc)
|
||||
|
||||
# the specialized version of ceph-common, where
|
||||
# - the logging is sent to Seastar backend
|
||||
# - and the template parameter of lock_policy is SINGLE
|
||||
add_library(crimson-common STATIC
|
||||
${PROJECT_SOURCE_DIR}/src/common/addr_parsing.c
|
||||
${PROJECT_SOURCE_DIR}/src/common/admin_socket.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/admin_socket_client.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/armor.c
|
||||
${PROJECT_SOURCE_DIR}/src/common/bit_str.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/bloom_filter.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/ceph_argparse.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/ceph_context.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/ceph_crypto.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/ceph_hash.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/ceph_time.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/ceph_strings.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/cmdparse.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/common_init.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/code_environment.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/config.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/config_values.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/dout.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/entity_name.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/environment.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/errno.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/escape.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/hex.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/fs_types.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/histogram.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/hobject.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/hostname.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/ipaddr.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/io_priority.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/lockdep.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/mutex_debug.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/mempool.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/options.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/perf_counters.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/perf_histogram.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/page.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/pipe.c
|
||||
${PROJECT_SOURCE_DIR}/src/common/snap_types.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/safe_io.c
|
||||
${PROJECT_SOURCE_DIR}/src/common/signal.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/str_list.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/str_map.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/strtol.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/reverse.c
|
||||
${PROJECT_SOURCE_DIR}/src/common/types.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/utf8.c
|
||||
${PROJECT_SOURCE_DIR}/src/common/version.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/BackTrace.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/CachedPrebufferedStreambuf.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/ConfUtils.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/DecayCounter.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/HTMLFormatter.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/Formatter.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/Graylog.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/LogEntry.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/Mutex.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/RefCountedObj.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/SubProcess.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/TextTable.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/Thread.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/HeartbeatMap.cc
|
||||
${PROJECT_SOURCE_DIR}/src/common/PluginRegistry.cc
|
||||
${PROJECT_SOURCE_DIR}/src/librbd/Features.cc
|
||||
${PROJECT_SOURCE_DIR}/src/log/Log.cc
|
||||
${PROJECT_SOURCE_DIR}/src/mgr/ServiceMap.cc
|
||||
${PROJECT_SOURCE_DIR}/src/mds/inode_backtrace.cc
|
||||
${PROJECT_SOURCE_DIR}/src/mds/mdstypes.cc
|
||||
${PROJECT_SOURCE_DIR}/src/mds/FSMap.cc
|
||||
${PROJECT_SOURCE_DIR}/src/mds/FSMapUser.cc
|
||||
${PROJECT_SOURCE_DIR}/src/mds/MDSMap.cc
|
||||
${PROJECT_SOURCE_DIR}/src/msg/msg_types.cc
|
||||
${PROJECT_SOURCE_DIR}/src/msg/Message.cc
|
||||
${PROJECT_SOURCE_DIR}/src/mon/MonCap.cc
|
||||
${PROJECT_SOURCE_DIR}/src/osd/osd_types.cc
|
||||
${PROJECT_SOURCE_DIR}/src/osd/ECMsgTypes.cc
|
||||
${PROJECT_SOURCE_DIR}/src/osd/HitSet.cc
|
||||
${PROJECT_SOURCE_DIR}/src/osd/OSDMap.cc
|
||||
${PROJECT_SOURCE_DIR}/src/osd/PGPeeringEvent.cc
|
||||
${crimson_common_srcs}
|
||||
$<TARGET_OBJECTS:crimson-auth>
|
||||
$<TARGET_OBJECTS:common_buffer_obj>
|
||||
$<TARGET_OBJECTS:crimson-crush>
|
||||
$<TARGET_OBJECTS:global_common_objs>)
|
||||
|
||||
target_compile_definitions(crimson-common PRIVATE
|
||||
"CEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\""
|
||||
"CEPH_PKGLIBDIR=\"${CMAKE_INSTALL_FULL_PKGLIBDIR}\"")
|
||||
|
||||
target_link_libraries(crimson-common
|
||||
PUBLIC
|
||||
json_spirit
|
||||
PRIVATE
|
||||
crc32
|
||||
crimson::cflags
|
||||
Boost::iostreams
|
||||
Boost::random
|
||||
${NSS_LIBRARIES} ${NSPR_LIBRARIES} ${OPENSSL_LIBRARIES})
|
||||
|
||||
set(crimson_net_srcs
|
||||
net/Dispatcher.cc
|
||||
net/Errors.cc
|
||||
@ -6,13 +118,14 @@ set(crimson_net_srcs
|
||||
set(crimson_thread_srcs
|
||||
thread/ThreadPool.cc
|
||||
thread/Throttle.cc)
|
||||
set(crimson_common_srcs
|
||||
common/config_proxy.cc
|
||||
common/assert.cc
|
||||
common/log.cc)
|
||||
add_library(crimson STATIC
|
||||
${crimson_common_srcs}
|
||||
${crimson_net_srcs}
|
||||
${crimson_thread_srcs}
|
||||
${CMAKE_SOURCE_DIR}/src/common/buffer_seastar.cc)
|
||||
target_link_libraries(crimson Seastar::seastar ceph-common)
|
||||
target_compile_options(crimson PRIVATE
|
||||
"-ftemplate-backtrace-limit=0")
|
||||
target_link_libraries(crimson
|
||||
PUBLIC
|
||||
crimson-common Seastar::seastar
|
||||
PRIVATE
|
||||
crimson::cflags)
|
||||
|
@ -9,3 +9,11 @@ set(crush_srcs
|
||||
CrushLocation.cc)
|
||||
|
||||
add_library(crush_objs OBJECT ${crush_srcs})
|
||||
|
||||
if(WITH_SEASTAR)
|
||||
add_library(crimson-crush OBJECT ${crush_srcs})
|
||||
target_compile_definitions(crimson-crush PRIVATE
|
||||
"WITH_SEASTAR=1")
|
||||
target_include_directories(crimson-crush PRIVATE
|
||||
$<TARGET_PROPERTY:Seastar::seastar,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user