Skip to content

Commit

Permalink
cmake: extract common,msg out of src/CMakeLists.txt
Browse files Browse the repository at this point in the history
* add arch as a static library.
* add crc32 as a static library. its only dependency is libarch.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Jul 27, 2018
1 parent 591167e commit 85a3c63
Show file tree
Hide file tree
Showing 6 changed files with 308 additions and 269 deletions.
288 changes: 19 additions & 269 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,6 @@ configure_file(
${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
@ONLY)

set(auth_files
auth/AuthAuthorizeHandler.cc
auth/AuthClientHandler.cc
auth/AuthSessionHandler.cc
auth/AuthMethodList.cc
auth/cephx/CephxAuthorizeHandler.cc
auth/cephx/CephxClientHandler.cc
auth/cephx/CephxProtocol.cc
auth/cephx/CephxSessionHandler.cc
auth/none/AuthNoneAuthorizeHandler.cc
auth/unknown/AuthUnknownAuthorizeHandler.cc
auth/Crypto.cc
auth/KeyRing.cc
auth/RotatingKeyRing.cc)

set(mds_files)
list(APPEND mds_files
mds/MDSMap.cc
Expand All @@ -337,18 +322,6 @@ list(APPEND mds_files
mds/mdstypes.cc
mds/flock.cc)

set(crush_srcs
crush/builder.c
crush/mapper.c
crush/crush.c
crush/hash.c
crush/CrushWrapper.cc
crush/CrushCompiler.cc
crush/CrushTester.cc
crush/CrushLocation.cc)

add_library(crush_objs OBJECT ${crush_srcs})

add_subdirectory(json_spirit)

include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/xxHash")
Expand Down Expand Up @@ -384,238 +357,42 @@ if(WITH_SEASTAR)
add_subdirectory(crimson)
endif()

set(xio_common_srcs)
if(HAVE_XIO)
list(APPEND xio_common_srcs
msg/xio/XioConnection.cc
msg/xio/XioMsg.cc
msg/xio/XioPool.cc
msg/xio/XioMessenger.cc
msg/xio/XioPortal.cc)
endif(HAVE_XIO)

set(async_rdma_common_srcs)
if(HAVE_RDMA)
list(APPEND async_rdma_common_srcs
msg/async/rdma/Infiniband.cc
msg/async/rdma/RDMAConnectedSocketImpl.cc
msg/async/rdma/RDMAIWARPConnectedSocketImpl.cc
msg/async/rdma/RDMAServerSocketImpl.cc
msg/async/rdma/RDMAIWARPServerSocketImpl.cc
msg/async/rdma/RDMAStack.cc)
endif()

add_library(common_buffer_obj OBJECT
common/buffer.cc)

add_library(common_texttable_obj OBJECT
common/TextTable.cc)

set(libcommon_files
${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
ceph_ver.c
common/AsyncOpTracker.cc
common/DecayCounter.cc
common/LogClient.cc
common/LogEntry.cc
common/PrebufferedStreambuf.cc
common/CachedPrebufferedStreambuf.cc
common/BackTrace.cc
common/perf_counters.cc
common/perf_histogram.cc
common/mutex_debug.cc
common/Mutex.cc
common/OutputDataSocket.cc
common/admin_socket.cc
common/admin_socket_client.cc
common/bloom_filter.cc
common/Readahead.cc
common/cmdparse.cc
common/escape.cc
common/url_escape.cc
common/io_priority.cc
common/ceph_time.cc
common/mempool.cc
common/Throttle.cc
common/Timer.cc
common/Finisher.cc
common/environment.cc
common/sctp_crc32.c
common/crc32c.cc
common/crc32c_intel_baseline.c
xxHash/xxhash.c
common/assert.cc
common/run_cmd.cc
common/WorkQueue.cc
common/ConfUtils.cc
common/fd.cc
common/xattr.c
common/str_list.cc
common/str_map.cc
common/snap_types.cc
common/errno.cc
common/TrackedOp.cc
common/SloppyCRCMap.cc
common/types.cc
common/iso_8601.cc
log/Log.cc
mon/MonCap.cc
mon/MonClient.cc
mon/MonMap.cc
mgr/MgrClient.cc
msg/simple/Accepter.cc
msg/DispatchQueue.cc
msg/Message.cc
mgr/ServiceMap.cc
osd/ECMsgTypes.cc
osd/HitSet.cc
common/RefCountedObj.cc
msg/Messenger.cc
msg/simple/Pipe.cc
msg/simple/PipeConnection.cc
msg/simple/SimpleMessenger.cc
msg/async/AsyncConnection.cc
msg/async/AsyncMessenger.cc
msg/async/Event.cc
msg/async/EventSelect.cc
msg/async/Stack.cc
msg/async/PosixStack.cc
msg/async/net_handler.cc
msg/QueueStrategy.cc
${xio_common_srcs}
${async_rdma_common_srcs}
msg/msg_types.cc
common/reverse.c
common/hobject.cc
osd/OSDMap.cc
osd/OSDMapMapping.cc
common/histogram.cc
osd/osd_types.cc
osd/PGPeeringEvent.cc
osd/OpRequest.cc
common/blkdev.cc
common/common_init.cc
common/pipe.c
common/ceph_argparse.cc
common/ceph_context.cc
common/code_environment.cc
common/dout.cc
common/signal.cc
common/Thread.cc
common/Formatter.cc
common/HTMLFormatter.cc
common/HeartbeatMap.cc
common/PluginRegistry.cc
common/ceph_fs.cc
common/ceph_hash.cc
common/ceph_strings.cc
common/ceph_frag.cc
common/options.cc
common/config.cc
common/config_values.cc
common/utf8.c
common/mime.c
common/strtol.cc
common/page.cc
common/lockdep.cc
common/version.cc
common/hex.cc
common/entity_name.cc
common/ceph_crypto.cc
common/ceph_crypto_cms.cc
common/ceph_json.cc
common/ipaddr.cc
common/pick_address.cc
common/address_helper.cc
common/linux_version.c
common/TracepointProvider.cc
common/Cycles.cc
common/scrub_types.cc
common/bit_str.cc
osdc/Striper.cc
osdc/Objecter.cc
common/compat.cc
common/Graylog.cc
common/fs_types.cc
common/dns_resolve.cc
common/hostname.cc
common/util.cc
common/PriorityCache.cc
common/SubProcess.cc
librbd/Features.cc
arch/probe.cc
${auth_files}
${mds_files})
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})

CHECK_C_COMPILER_FLAG("-fvar-tracking-assignments" HAS_VTA)
if(HAS_VTA)
set_source_files_properties(
common/config.cc
common/options.cc
PROPERTIES COMPILE_FLAGS -fno-var-tracking-assignments)
endif()

if(FREEBSD)
list(APPEND libcommon_files common/freebsd_errno.cc)
elseif(APPLE)
list(APPEND libcommon_files common/darwin_errno.cc)
elseif(SUN)
list(APPEND libcommon_files common/solaris_errno.cc)
elseif(AIX)
list(APPEND libcommon_files common/aix_errno.cc)
endif()

if(HAVE_ARM)
list(APPEND libcommon_files arch/arm.c)
elseif(HAVE_INTEL)
list(APPEND libcommon_files arch/intel.c)
elseif(HAVE_POWER8)
list(APPEND libcommon_files arch/ppc.c)
endif()

if(HAVE_INTEL)
list(APPEND libcommon_files
common/crc32c_intel_fast.c)
if(HAVE_GOOD_YASM_ELF64)
list(APPEND libcommon_files
common/crc32c_intel_fast_asm.s
common/crc32c_intel_fast_zero_asm.s)
endif(HAVE_GOOD_YASM_ELF64)
elseif(HAVE_POWER8)
list(APPEND libcommon_files
common/crc32c_ppc.c)
if(HAVE_PPC64LE)
list(APPEND libcommon_files
common/crc32c_ppc_asm.S
common/crc32c_ppc_fast_zero_asm.S)
endif(HAVE_PPC64LE)
endif(HAVE_INTEL)

if(LINUX)
list(APPEND libcommon_files msg/async/EventEpoll.cc)
message(STATUS " Using EventEpoll for events.")
elseif(FREEBSD OR APPLE)
list(APPEND libcommon_files msg/async/EventKqueue.cc)
message(STATUS " Using EventKqueue for events.")
endif(LINUX)

if(WITH_LTTNG AND WITH_EVENTTRACE)
message(STATUS " Using EventTrace class.")
add_definitions("-DWITH_EVENTTRACE")
list(APPEND libcommon_files common/EventTrace.cc)
endif()

set(common_mountcephfs_files
common/armor.c
common/safe_io.c
common/module.c
common/addr_parsing.c)
add_library(common_mountcephfs_objs OBJECT
${common_mountcephfs_files})

add_library(common-objs OBJECT ${libcommon_files})
add_subdirectory(auth)
add_subdirectory(common)
add_subdirectory(crush)
add_subdirectory(msg)
add_subdirectory(arch)

set(ceph_common_objs
$<TARGET_OBJECTS:common-auth-objs>
$<TARGET_OBJECTS:common-common-objs>
$<TARGET_OBJECTS:common-msg-objs>
$<TARGET_OBJECTS:common_buffer_obj>
$<TARGET_OBJECTS:common_texttable_obj>
$<TARGET_OBJECTS:compressor_objs>
Expand All @@ -624,7 +401,8 @@ set(ceph_common_objs
$<TARGET_OBJECTS:global_common_objs>
$<TARGET_OBJECTS:crush_objs>)
set(ceph_common_deps
json_spirit erasure_code ${LIB_RESOLV}
json_spirit erasure_code arch crc32
${LIB_RESOLV}
Boost::thread
Boost::system
Boost::random
Expand All @@ -640,49 +418,30 @@ set(ceph_common_deps
if(HAVE_UDEV)
list(APPEND ceph_common_deps ${UDEV_LIBRARIES})
endif()

if(HAVE_VERBS)
list(APPEND ceph_common_deps IBVerbs::verbs)
endif()

if(HAVE_RDMACM)
list(APPEND ceph_common_deps RDMA::RDMAcm)
endif()

if(NOT WITH_SYSTEM_BOOST)
list(APPEND ceph_common_deps ${ZLIB_LIBRARIES})
endif()

if(HAVE_QATZIP)
list(APPEND ceph_common_deps ${QATZIP_LIBRARIES})
endif()

set_source_files_properties(${CMAKE_SOURCE_DIR}/src/ceph_ver.c
${CMAKE_SOURCE_DIR}/src/common/version.cc
APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)

if(HAVE_ARMV8_CRC)
add_library(common_crc_aarch64 STATIC common/crc32c_aarch64.c)
set_target_properties(common_crc_aarch64 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${ARMV8_CRC_COMPILE_FLAGS}")
list(APPEND ceph_common_deps common_crc_aarch64)
endif(HAVE_ARMV8_CRC)
endif()

if(WITH_DPDK)
list(APPEND common_async_dpdk_files
msg/async/dpdk/ARP.cc
msg/async/dpdk/DPDK.cc
msg/async/dpdk/dpdk_rte.cc
msg/async/dpdk/DPDKStack.cc
msg/async/dpdk/EventDPDK.cc
msg/async/dpdk/IP.cc
msg/async/dpdk/net.cc
msg/async/dpdk/IPChecksum.cc
msg/async/dpdk/Packet.cc
msg/async/dpdk/TCP.cc
msg/async/dpdk/UserspaceEvent.cc
msg/async/dpdk/ethernet.cc)
add_library(common_async_dpdk STATIC
${common_async_dpdk_files})
list(APPEND ceph_common_deps common_async_dpdk)
target_link_libraries(common_async_dpdk
${DPDK_LIBRARIES})
endif(WITH_DPDK)
endif()

add_library(common STATIC ${ceph_common_objs})
target_link_libraries(common
Expand All @@ -708,8 +467,6 @@ if(WITH_STATIC_LIBSTDCXX)
endif()
install(TARGETS ceph-common DESTINATION ${CMAKE_INSTALL_PKGLIBDIR})

add_library(common_utf8 STATIC common/utf8.c)

if(${WITH_LTTNG})
add_subdirectory(tracing)
add_dependencies(common-objs oprequest-tp)
Expand Down Expand Up @@ -912,13 +669,6 @@ install(PROGRAMS
DESTINATION sbin)

add_subdirectory(bash_completion)

if(WITH_LIBCEPHFS OR WITH_KRBD)
set(parse_secret_files
common/secret.c)
add_library(parse_secret_objs OBJECT ${parse_secret_files})
endif()

add_subdirectory(client)

if(WITH_LIBCEPHFS)
Expand Down
12 changes: 12 additions & 0 deletions src/arch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(arch_srcs
probe.cc)

if(HAVE_ARM)
list(APPEND arch_srcs arm.c)
elseif(HAVE_INTEL)
list(APPEND arch_srcs intel.c)
elseif(HAVE_POWER8)
list(APPEND arch_srcs ppc.c)
endif()

add_library(arch STATIC ${arch_srcs})
Loading

0 comments on commit 85a3c63

Please sign in to comment.