From 5a695974ccf05b0c40597ff7c9833ee915ae5aa7 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 14 Jul 2016 14:50:31 +0800 Subject: [PATCH] cmake: restructure src/CMakeLists.txt in a more hierarchical way Signed-off-by: Kefu Chai --- src/CMakeLists.txt | 134 +--------------------------- src/tools/CMakeLists.txt | 38 ++++++++ src/tools/rbd/CMakeLists.txt | 48 ++++++++++ src/tools/rbd_mirror/CMakeLists.txt | 42 +++++++++ src/tools/rbd_nbd/CMakeLists.txt | 5 ++ 5 files changed, 134 insertions(+), 133 deletions(-) create mode 100644 src/tools/CMakeLists.txt create mode 100644 src/tools/rbd/CMakeLists.txt create mode 100644 src/tools/rbd_mirror/CMakeLists.txt create mode 100644 src/tools/rbd_nbd/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f679b37271540..12254d45a60ef 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1029,44 +1029,7 @@ set_target_properties(cephfstool PROPERTIES OUTPUT_NAME cephfs) install(TARGETS cephfstool DESTINATION bin) add_subdirectory(compressor) - -add_executable(ceph-client-debug tools/ceph-client-debug.cc) -target_link_libraries(ceph-client-debug cephfs librados global common) -install(TARGETS ceph-client-debug DESTINATION bin) - -add_executable(ceph-kvstore-tool tools/ceph_kvstore_tool.cc) -target_link_libraries(ceph-kvstore-tool os global ${UNITTEST_CXX_FLAGS}) -install(TARGETS ceph-kvstore-tool DESTINATION bin) - -set(ceph_conf_srcs - tools/ceph_conf.cc) -add_executable(ceph-conf ${ceph_conf_srcs}) -target_link_libraries(ceph-conf global) -install(TARGETS ceph-conf DESTINATION bin) - -set(monmaptool_srcs - tools/monmaptool.cc) -add_executable(monmaptool ${monmaptool_srcs}) -target_link_libraries(monmaptool global) -install(TARGETS monmaptool DESTINATION bin) - -set(osdomaptool_srcs - tools/osdmaptool.cc) -add_executable(osdmaptool ${osdomaptool_srcs}) -target_link_libraries(osdmaptool global) -install(TARGETS osdmaptool DESTINATION bin) - -set(ceph_psim_srcs - tools/psim.cc) -add_executable(ceph_psim ${ceph_psim_srcs}) -target_link_libraries(ceph_psim global) -install(TARGETS ceph_psim DESTINATION bin) - -set(ceph_authtool_srcs - tools/ceph_authtool.cc) -add_executable(ceph-authtool ${ceph_authtool_srcs}) -target_link_libraries(ceph-authtool global ${EXTRALIBS} ${CRYPTO_LIBS}) -install(TARGETS ceph-authtool DESTINATION bin) +add_subdirectory(tools) configure_file(${CMAKE_SOURCE_DIR}/src/ceph-coverage.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-coverage @ONLY) @@ -1204,37 +1167,6 @@ if(${WITH_RBD}) include/rbd/librbd.hpp DESTINATION include/rbd) - add_executable(rbd-nbd tools/rbd_nbd/rbd-nbd.cc - $) - target_link_libraries(rbd-nbd librbd librados global keyutils - ${Boost_REGEX_LIBRARY}) - - set(rbd_mirror_internal - tools/rbd_mirror/ClusterWatcher.cc - tools/rbd_mirror/ImageReplayer.cc - tools/rbd_mirror/ImageDeleter.cc - tools/rbd_mirror/ImageSync.cc - tools/rbd_mirror/ImageSyncThrottler.cc - tools/rbd_mirror/Mirror.cc - tools/rbd_mirror/PoolWatcher.cc - tools/rbd_mirror/Replayer.cc - tools/rbd_mirror/Threads.cc - tools/rbd_mirror/types.cc - tools/rbd_mirror/image_replayer/BootstrapRequest.cc - tools/rbd_mirror/image_replayer/CloseImageRequest.cc - tools/rbd_mirror/image_replayer/CreateImageRequest.cc - tools/rbd_mirror/image_replayer/OpenImageRequest.cc - tools/rbd_mirror/image_replayer/OpenLocalImageRequest.cc - tools/rbd_mirror/image_replayer/ReplayStatusFormatter.cc - tools/rbd_mirror/image_sync/ImageCopyRequest.cc - tools/rbd_mirror/image_sync/ObjectCopyRequest.cc - tools/rbd_mirror/image_sync/SnapshotCopyRequest.cc - tools/rbd_mirror/image_sync/SnapshotCreateRequest.cc - tools/rbd_mirror/image_sync/SyncPointCreateRequest.cc - tools/rbd_mirror/image_sync/SyncPointPruneRequest.cc) - add_library(rbd_mirror_internal STATIC - ${rbd_mirror_internal}) - if(WITH_FUSE) add_executable(rbd-fuse rbd_fuse/rbd-fuse.cc) @@ -1243,70 +1175,6 @@ if(${WITH_RBD}) install(TARGETS rbd-fuse DESTINATION bin) endif() - add_executable(rbd-mirror - tools/rbd_mirror/main.cc - common/ContextCompletion.cc) - target_link_libraries(rbd-mirror - rbd_mirror_internal - rbd_internal - rbd_api - rbd_types - journal - librados - osdc - cls_rbd_client - cls_lock_client - cls_journal_client - global) - - set(rbd_srcs - tools/rbd/rbd.cc - tools/rbd/ArgumentTypes.cc - tools/rbd/IndentStream.cc - tools/rbd/OptionPrinter.cc - tools/rbd/Shell.cc - tools/rbd/Utils.cc - tools/rbd/action/Bench.cc - tools/rbd/action/Children.cc - tools/rbd/action/Clone.cc - tools/rbd/action/Copy.cc - tools/rbd/action/Create.cc - tools/rbd/action/Diff.cc - tools/rbd/action/DiskUsage.cc - tools/rbd/action/Export.cc - tools/rbd/action/ExportDiff.cc - tools/rbd/action/Feature.cc - tools/rbd/action/Flatten.cc - tools/rbd/action/Group.cc - tools/rbd/action/ImageMeta.cc - tools/rbd/action/Import.cc - tools/rbd/action/ImportDiff.cc - tools/rbd/action/Info.cc - tools/rbd/action/Journal.cc - tools/rbd/action/Kernel.cc - tools/rbd/action/List.cc - tools/rbd/action/Lock.cc - tools/rbd/action/MergeDiff.cc - tools/rbd/action/MirrorPool.cc - tools/rbd/action/MirrorImage.cc - tools/rbd/action/Nbd.cc - tools/rbd/action/ObjectMap.cc - tools/rbd/action/Remove.cc - tools/rbd/action/Rename.cc - tools/rbd/action/Resize.cc - tools/rbd/action/Snap.cc - tools/rbd/action/Status.cc - tools/rbd/action/Watch.cc) - add_executable(rbd ${rbd_srcs} - $ - $ - $ - $) - set_target_properties(rbd PROPERTIES OUTPUT_NAME rbd) - target_link_libraries(rbd librbd librados global common keyutils udev - ${Boost_REGEX_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS}) - install(TARGETS rbd rbd-nbd rbd-mirror DESTINATION bin) install(PROGRAMS ${CMAKE_SOURCE_DIR}/src/ceph-rbdnamer ${CMAKE_SOURCE_DIR}/src/rbd-replay-many diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt new file mode 100644 index 0000000000000..85a3943f571cb --- /dev/null +++ b/src/tools/CMakeLists.txt @@ -0,0 +1,38 @@ +add_executable(ceph-client-debug ceph-client-debug.cc) +target_link_libraries(ceph-client-debug cephfs librados global common) +install(TARGETS ceph-client-debug DESTINATION bin) + +add_executable(ceph-kvstore-tool ceph_kvstore_tool.cc) +target_link_libraries(ceph-kvstore-tool os global ${UNITTEST_CXX_FLAGS}) +install(TARGETS ceph-kvstore-tool DESTINATION bin) + +set(ceph_conf_srcs ceph_conf.cc) +add_executable(ceph-conf ${ceph_conf_srcs}) +target_link_libraries(ceph-conf global) +install(TARGETS ceph-conf DESTINATION bin) + +set(monmaptool_srcs monmaptool.cc) +add_executable(monmaptool ${monmaptool_srcs}) +target_link_libraries(monmaptool global) +install(TARGETS monmaptool DESTINATION bin) + +set(osdomaptool_srcs osdmaptool.cc) +add_executable(osdmaptool ${osdomaptool_srcs}) +target_link_libraries(osdmaptool global) +install(TARGETS osdmaptool DESTINATION bin) + +set(ceph_psim_srcs psim.cc) +add_executable(ceph_psim ${ceph_psim_srcs}) +target_link_libraries(ceph_psim global) +install(TARGETS ceph_psim DESTINATION bin) + +set(ceph_authtool_srcs ceph_authtool.cc) +add_executable(ceph-authtool ${ceph_authtool_srcs}) +target_link_libraries(ceph-authtool global ${EXTRALIBS} ${CRYPTO_LIBS}) +install(TARGETS ceph-authtool DESTINATION bin) + +if(WITH_RBD) + add_subdirectory(rbd) + add_subdirectory(rbd_mirror) + add_subdirectory(rbd_nbd) +endif(WITH_RBD) diff --git a/src/tools/rbd/CMakeLists.txt b/src/tools/rbd/CMakeLists.txt new file mode 100644 index 0000000000000..36c7303b45ff4 --- /dev/null +++ b/src/tools/rbd/CMakeLists.txt @@ -0,0 +1,48 @@ +set(rbd_srcs + rbd.cc + ArgumentTypes.cc + IndentStream.cc + OptionPrinter.cc + Shell.cc + Utils.cc + action/Bench.cc + action/Children.cc + action/Clone.cc + action/Copy.cc + action/Create.cc + action/Diff.cc + action/DiskUsage.cc + action/Export.cc + action/ExportDiff.cc + action/Feature.cc + action/Flatten.cc + action/Group.cc + action/ImageMeta.cc + action/Import.cc + action/ImportDiff.cc + action/Info.cc + action/Journal.cc + action/Kernel.cc + action/List.cc + action/Lock.cc + action/MergeDiff.cc + action/MirrorPool.cc + action/MirrorImage.cc + action/Nbd.cc + action/ObjectMap.cc + action/Remove.cc + action/Rename.cc + action/Resize.cc + action/Snap.cc + action/Status.cc + action/Watch.cc) +add_executable(rbd ${rbd_srcs} + $ + $ + $ + $) +set_target_properties(rbd PROPERTIES OUTPUT_NAME rbd) +target_link_libraries(rbd librbd librados global common keyutils udev + ${Boost_REGEX_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS}) +install(TARGETS rbd DESTINATION bin) diff --git a/src/tools/rbd_mirror/CMakeLists.txt b/src/tools/rbd_mirror/CMakeLists.txt new file mode 100644 index 0000000000000..4ac3c8c572018 --- /dev/null +++ b/src/tools/rbd_mirror/CMakeLists.txt @@ -0,0 +1,42 @@ +set(rbd_mirror_internal + ClusterWatcher.cc + ImageReplayer.cc + ImageDeleter.cc + ImageSync.cc + ImageSyncThrottler.cc + Mirror.cc + PoolWatcher.cc + Replayer.cc + Threads.cc + types.cc + image_replayer/BootstrapRequest.cc + image_replayer/CloseImageRequest.cc + image_replayer/CreateImageRequest.cc + image_replayer/OpenImageRequest.cc + image_replayer/OpenLocalImageRequest.cc + image_replayer/ReplayStatusFormatter.cc + image_sync/ImageCopyRequest.cc + image_sync/ObjectCopyRequest.cc + image_sync/SnapshotCopyRequest.cc + image_sync/SnapshotCreateRequest.cc + image_sync/SyncPointCreateRequest.cc + image_sync/SyncPointPruneRequest.cc) +add_library(rbd_mirror_internal STATIC + ${rbd_mirror_internal}) + +add_executable(rbd-mirror + main.cc + ${CMAKE_SOURCE_DIR}/src/common/ContextCompletion.cc) +target_link_libraries(rbd-mirror + rbd_mirror_internal + rbd_internal + rbd_api + rbd_types + journal + librados + osdc + cls_rbd_client + cls_lock_client + cls_journal_client + global) +install(TARGETS rbd-mirror DESTINATION bin) diff --git a/src/tools/rbd_nbd/CMakeLists.txt b/src/tools/rbd_nbd/CMakeLists.txt new file mode 100644 index 0000000000000..81a8dbaebbed8 --- /dev/null +++ b/src/tools/rbd_nbd/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(rbd-nbd rbd-nbd.cc + $) +target_link_libraries(rbd-nbd librbd librados global keyutils + ${Boost_REGEX_LIBRARY}) +install(TARGETS rbd-nbd DESTINATION bin) -- 2.39.5