Merge pull request #9446 from ceph/wip-cmake

cmake changes

Reviewed-by: Ali Maredia <amaredia@redhat.com>
This commit is contained in:
Ali Maredia 2016-06-04 18:28:40 -04:00
commit 50eab6e4a8
18 changed files with 87 additions and 55 deletions

View File

@ -150,6 +150,13 @@ CHECK_CXX_SOURCE_COMPILES("
set(CEPH_MAN_DIR "share/man" CACHE STRING "Install location for man pages (relative to prefix).")
option(ENABLE_SHARED "build shared libraries" ON)
if(ENABLE_SHARED)
set(CEPH_SHARED SHARED)
else(ENABLE_SHARED)
set(CEPH_SHARED STATIC)
endif(ENABLE_SHARED)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
find_package(execinfo)
@ -347,11 +354,11 @@ option(PG_DEBUG_REFS "PG Ref debugging is enabled" OFF)
add_definitions(-D__linux__)
if(BUILD_SHARED_LIBS)
if(ENABLE_SHARED)
set(Boost_USE_STATIC_LIBS OFF)
else(BUILD_SHARED_LIBS)
else(ENABLE_SHARED)
set(Boost_USE_STATIC_LIBS ON)
endif(BUILD_SHARED_LIBS)
endif(ENABLE_SHARED)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost COMPONENTS thread system regex random program_options date_time iostreams REQUIRED)

View File

@ -713,8 +713,6 @@ install -m 0644 -D etc/sysconfig/SuSEfirewall2.d/services/ceph-osd-mds %{buildro
# udev rules
install -m 0644 -D udev/50-rbd.rules %{buildroot}%{_udevrulesdir}/50-rbd.rules
install -m 0644 -D udev/95-ceph-osd.rules %{buildroot}%{_udevrulesdir}/95-ceph-osd.rules
mv %{buildroot}/sbin/mount.ceph %{buildroot}/usr/sbin/mount.ceph
mv %{buildroot}/sbin/mount.fuse.ceph %{buildroot}/usr/sbin/mount.fuse.ceph
#set up placeholder directories
mkdir -p %{buildroot}%{_sysconfdir}/ceph

View File

@ -1,13 +1,6 @@
function(distutils_install_module name)
if(DEFINED ENV{DESTDIR})
get_filename_component(debian_version /etc/debian_version ABSOLUTE)
if(EXISTS ${debian_version})
set(options "--install-layout=deb")
else()
set(options "--prefix=/usr")
endif()
endif()
include(CMakeParseArguments)
function(distutils_install_module name)
set(py_srcs setup.py README.rst requirements.txt test-requirements.txt ${name})
foreach(src ${py_srcs})
list(APPEND py_clone ${CMAKE_CURRENT_BINARY_DIR}/${src})
@ -18,9 +11,24 @@ function(distutils_install_module name)
endforeach()
add_custom_target(${name}-clone ALL
DEPENDS ${py_clone})
install(CODE
"execute_process(COMMAND ${PYTHON_EXECUTABLE} setup.py install ${options} --root=$DESTDIR
WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")")
cmake_parse_arguments(DU "" INSTALL_SCRIPT "" ${ARGN})
install(CODE "
set(options)
if(DEFINED ENV{DESTDIR})
if(EXISTS /etc/debian_version)
list(APPEND options --install-layout=deb)
else()
list(APPEND options --prefix=/usr)
endif()
list(APPEND options --root=\$ENV{DESTDIR})
if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\")
list(APPEND options --install-script=${DU_INSTALL_SCRIPT})
endif()
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE}
setup.py install \${options}
WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")")
endfunction(distutils_install_module)
function(distutils_add_cython_module name src)
@ -46,10 +54,11 @@ endfunction(distutils_add_cython_module)
function(distutils_install_cython_module name)
install(CODE "
set(options --prefix=/usr)
if(DEFINED ENV{DESTDIR})
if(EXISTS /etc/debian_version)
set(options --install-layout=deb)
else()
set(options --prefix=/usr)
endif()
set(root --root=\$ENV{DESTDIR})
else()

View File

@ -1,4 +1,4 @@
sbin/mount.ceph
usr/sbin/mount.ceph sbin
usr/bin/cephfs
usr/share/man/man8/cephfs.8
usr/share/man/man8/mount.ceph.8

View File

@ -1,3 +1,3 @@
sbin/mount.fuse.ceph
usr/sbin/mount.fuse.ceph sbin
usr/bin/ceph-fuse
usr/share/man/man8/ceph-fuse.8

View File

@ -508,10 +508,6 @@ target_link_libraries(global common ${CMAKE_THREAD_LIBS_INIT} ${CRYPTO_LIBS}
if(${WITH_LTTNG})
target_link_libraries(global lttng-ust dl)
endif(${WITH_LTTNG})
if(BUILD_SHARED_LIBS)
set_target_properties(global PROPERTIES
OUTPUT_NAME ceph-global VERSION "1.0.0" SOVERSION "1")
endif(BUILD_SHARED_LIBS)
# rados object classes
add_subdirectory(cls)
@ -533,7 +529,7 @@ set(librados_srcs
librados/snap_set_diff.cc
librados/RadosXattrIter.cc
)
add_library(librados ${librados_srcs}
add_library(librados ${CEPH_SHARED} ${librados_srcs}
$<TARGET_OBJECTS:cls_references_objs>
$<TARGET_OBJECTS:common_util_obj>)
add_dependencies(librados osdc)
@ -543,10 +539,10 @@ endif()
# LINK_PRIVATE instead of PRIVATE is used to backward compatibility with cmake 2.8.11
target_link_libraries(librados LINK_PRIVATE osdc osd os global common cls_lock_client
${BLKID_LIBRARIES} ${CRYPTO_LIBS} ${EXTRALIBS})
if(BUILD_SHARED_LIBS)
if(ENABLE_SHARED)
set_target_properties(librados PROPERTIES OUTPUT_NAME rados VERSION 2.0.0
SOVERSION 2)
endif(BUILD_SHARED_LIBS)
endif(ENABLE_SHARED)
add_library(librados_api STATIC common/buffer.cc librados/librados.cc)
@ -706,6 +702,7 @@ target_link_libraries(ceph-dencoder
librados
librbd
global
os
osd
mds
mon
@ -718,7 +715,6 @@ target_link_libraries(ceph-dencoder
cls_statelog_client
cls_version_client
cls_replica_log_client
cls_kvs
cls_user_client
cls_journal_client
cls_timeindex_client
@ -996,11 +992,7 @@ target_link_libraries(crushtool global)
install(TARGETS crushtool DESTINATION bin)
# Support/Tools
# the static gtest/gmock libraries load correctly for us
set(BUILD_SHARED_LIBS_saved ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(gmock)
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_saved})
add_subdirectory(test)
set(cephfs_srcs cephfs.cc)
@ -1123,16 +1115,16 @@ if(WITH_LIBCEPHFS)
add_library(client STATIC ${libclient_srcs})
target_link_libraries(client osdc mds)
set(libcephfs_srcs libcephfs.cc)
add_library(cephfs ${libcephfs_srcs}
add_library(cephfs ${CEPH_SHARED} ${libcephfs_srcs}
$<TARGET_OBJECTS:cls_references_objs>
$<TARGET_OBJECTS:common_util_obj>)
target_link_libraries(cephfs LINK_PRIVATE client osdc osd os global common
${BLKID_LIBRARIES}
${CRYPTO_LIBS} ${EXTRALIBS})
if(BUILD_SHARED_LIBS)
if(ENABLE_SHARED)
set_target_properties(cephfs PROPERTIES OUTPUT_NAME cephfs VERSION 1.0.0
SOVERSION 1)
endif(BUILD_SHARED_LIBS)
endif(ENABLE_SHARED)
install(TARGETS cephfs DESTINATION lib)
install(DIRECTORY
"${CMAKE_SOURCE_DIR}/src/include/cephfs"
@ -1151,7 +1143,7 @@ endif(BUILD_SHARED_LIBS)
target_link_libraries(mount.ceph keyutils)
install(TARGETS ceph-syn DESTINATION bin)
install(TARGETS mount.ceph DESTINATION /sbin)
install(TARGETS mount.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
if(HAVE_LIBFUSE)
set(ceph_fuse_srcs
@ -1161,7 +1153,7 @@ endif(BUILD_SHARED_LIBS)
target_link_libraries(ceph-fuse ${FUSE_LIBRARIES} client global)
set_target_properties(ceph-fuse PROPERTIES COMPILE_FLAGS "-I${FUSE_INCLUDE_DIRS}")
install(TARGETS ceph-fuse DESTINATION bin)
install(PROGRAMS mount.fuse.ceph DESTINATION /sbin)
install(PROGRAMS mount.fuse.ceph DESTINATION ${CMAKE_INSTALL_SBINDIR})
endif(HAVE_LIBFUSE)
endif(WITH_LIBCEPHFS)
@ -1283,7 +1275,8 @@ if(${WITH_RBD})
add_executable(rbd ${rbd_srcs}
$<TARGET_OBJECTS:common_util_obj>
$<TARGET_OBJECTS:parse_secret_objs>
$<TARGET_OBJECTS:common_texttable_obj>)
$<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}

View File

@ -19,9 +19,9 @@ shell_scripts += init-ceph
mount_ceph_SOURCES = mount/mount.ceph.c
mount_ceph_LDADD = $(LIBSECRET) $(LIBCOMMON)
if LINUX
su_sbin_PROGRAMS += mount.ceph
sbin_PROGRAMS += mount.ceph
endif # LINUX
su_sbin_SCRIPTS += mount.fuse.ceph
sbin_SCRIPTS += mount.fuse.ceph
if WITH_MON

View File

@ -8,4 +8,5 @@ add_custom_target(ceph-disk
COMMENT "ceph-disk is being created")
include(Distutils)
distutils_install_module(ceph_disk)
distutils_install_module(ceph_disk
INSTALL_SCRIPT /usr/sbin)

View File

@ -68,7 +68,7 @@ if(WITH_LTTNG)
add_dependencies(rbd_internal rbd-tp)
endif()
add_library(librbd
add_library(librbd ${CEPH_SHARED}
$<TARGET_OBJECTS:osdc_rbd_objs>
$<TARGET_OBJECTS:common_util_obj>
$<TARGET_OBJECTS:krbd_objs>
@ -90,8 +90,8 @@ target_link_libraries(librbd LINK_PRIVATE
keyutils
${CMAKE_DL_LIBS}
${EXTRALIBS})
if(BUILD_SHARED_LIBS)
if(ENABLE_SHARED)
set_target_properties(librbd PROPERTIES VERSION "1.0.0" SOVERSION "1"
OUTPUT_NAME rbd)
endif(BUILD_SHARED_LIBS)
endif(ENABLE_SHARED)
install(TARGETS librbd DESTINATION lib)

View File

@ -398,6 +398,9 @@ target_link_libraries(ceph_test_filejournal
${CMAKE_DL_LIBS}
${EXTRALIBS}
)
install(TARGETS
ceph_test_filejournal
DESTINATION ${CMAKE_INSTALL_BINDIR})
# ceph_test_keys
add_executable(ceph_test_keys

View File

@ -4,7 +4,7 @@ add_executable(ceph_test_cls_lock
set_target_properties(ceph_test_cls_lock PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_cls_lock
cls_lock
cls_lock_client
librados
global
${UNITTEST_LIBS}

View File

@ -8,8 +8,8 @@ set_target_properties(ceph_test_cls_rbd PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_cls_rbd
librbd
cls_rbd
cls_lock
cls_rbd_client
cls_lock_client
librados
global
${UNITTEST_LIBS}

View File

@ -3,12 +3,26 @@ target_link_libraries(rados_striper_test radostest)
set_target_properties(rados_striper_test PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
add_executable(ceph_test_rados_api_striping
add_executable(ceph_test_rados_striper_api_striping
striping.cc
)
target_link_libraries(ceph_test_rados_api_striping librados radosstriper
target_link_libraries(ceph_test_rados_striper_api_striping librados radosstriper
${UNITTEST_LIBS} rados_striper_test)
set_target_properties(ceph_test_rados_api_striping PROPERTIES COMPILE_FLAGS
set_target_properties(ceph_test_rados_striper_api_striping PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
add_ceph_test(rados-striper.sh ${CMAKE_SOURCE_DIR}/src/test/libradosstriper/rados-striper.sh)
add_executable(ceph_test_rados_striper_api_io
io.cc)
target_link_libraries(ceph_test_rados_striper_api_io librados radosstriper
${UNITTEST_LIBS} rados_striper_test)
set_target_properties(ceph_test_rados_striper_api_io PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
add_executable(ceph_test_rados_striper_api_aio
aio.cc)
target_link_libraries(ceph_test_rados_striper_api_aio librados radosstriper
${UNITTEST_LIBS} rados_striper_test)
set_target_properties(ceph_test_rados_striper_api_aio PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})

View File

@ -27,6 +27,8 @@ set_target_properties(ceph_perf_msgr_client PROPERTIES COMPILE_FLAGS
target_link_libraries(ceph_perf_msgr_client os global ${UNITTEST_LIBS})
install(TARGETS
ceph_test_async_driver
ceph_test_msgr
ceph_perf_msgr_server
ceph_perf_msgr_client
DESTINATION bin)
DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -23,6 +23,8 @@ target_link_libraries(ceph_test_objectstore
${BLKID_LIBRARIES}
${CMAKE_DL_LIBS}
)
install(TARGETS ceph_test_objectstore
DESTINATION ${CMAKE_INSTALL_BINDIR})
#ceph_test_keyvaluedb
add_executable(ceph_test_keyvaluedb

View File

@ -13,6 +13,9 @@ target_link_libraries(ceph_test_rados
${EXTRALIBS}
${CMAKE_DL_LIBS}
)
install(TARGETS
ceph_test_rados
DESTINATION ${CMAKE_INSTALL_BINDIR})
# scripts
add_ceph_test(osd-bench.sh ${CMAKE_CURRENT_SOURCE_DIR}/osd-bench.sh)

View File

@ -18,7 +18,6 @@ target_link_libraries(ceph_test_rgw_manifest
cls_timeindex_client
cls_version_client
cls_replica_log_client
cls_kvs
cls_user_client
librados
global
@ -46,7 +45,6 @@ target_link_libraries(ceph_test_rgw_obj
cls_statelog_client
cls_version_client
cls_replica_log_client
cls_kvs
cls_user_client
librados
global

View File

@ -34,11 +34,13 @@ set(test_rados_delete_pools_parallel_srcs
st_rados_delete_pool.cc
st_rados_list_objects.cc
)
add_executable(test_rados_delete_pools_parallel
add_executable(ceph_test_rados_delete_pools_parallel
${test_rados_delete_pools_parallel_srcs}
)
target_link_libraries(test_rados_delete_pools_parallel librados systest global
target_link_libraries(ceph_test_rados_delete_pools_parallel librados systest global
pthread rt ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
install(TARGETS ceph_test_rados_delete_pools_parallel
DESTINATION ${CMAKE_INSTALL_BINDIR})
# test_rados_watch_notify
set(test_rados_watch_notify_srcs