Skip to content

Commit

Permalink
cmake: restructure src/CMakeLists.txt in a more hierarchical way
Browse files Browse the repository at this point in the history
Signed-off-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed Jul 14, 2016
1 parent 492a301 commit fba9180
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 133 deletions.
134 changes: 1 addition & 133 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1032,44 +1032,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)
Expand Down Expand Up @@ -1207,37 +1170,6 @@ if(${WITH_RBD})
include/rbd/librbd.hpp
DESTINATION include/rbd)

add_executable(rbd-nbd tools/rbd_nbd/rbd-nbd.cc
$<TARGET_OBJECTS:parse_secret_objs>)
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)
Expand All @@ -1246,70 +1178,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}
$<TARGET_OBJECTS:common_util_obj>
$<TARGET_OBJECTS:parse_secret_objs>
$<TARGET_OBJECTS:common_texttable_obj>
$<TARGET_OBJECTS:krbd_objs>)
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
Expand Down
38 changes: 38 additions & 0 deletions src/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
48 changes: 48 additions & 0 deletions src/tools/rbd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
$<TARGET_OBJECTS:common_util_obj>
$<TARGET_OBJECTS:parse_secret_objs>
$<TARGET_OBJECTS:common_texttable_obj>
$<TARGET_OBJECTS:krbd_objs>)
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)
42 changes: 42 additions & 0 deletions src/tools/rbd_mirror/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 5 additions & 0 deletions src/tools/rbd_nbd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_executable(rbd-nbd rbd_nbd/rbd-nbd.cc
$<TARGET_OBJECTS:parse_secret_objs>)
target_link_libraries(rbd-nbd librbd librados global keyutils
${Boost_REGEX_LIBRARY})
install(TARGETS rbd-nbd DESTINATION bin)

0 comments on commit fba9180

Please sign in to comment.