Skip to content

Commit

Permalink
Merge pull request #18576 from tchaikov/wip-cmake-no-rados_a
Browse files Browse the repository at this point in the history
cmake: do not link against librados.a

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
  • Loading branch information
tchaikov committed Oct 27, 2017
2 parents a8b000f + d5c9933 commit 78116c3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 deletions.
12 changes: 5 additions & 7 deletions src/librados/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ add_library(librados_objs OBJECT
RadosClient.cc)
add_library(librados_api_obj OBJECT
librados.cc)
add_library(rados_a STATIC
$<TARGET_OBJECTS:librados_api_obj>
$<TARGET_OBJECTS:librados_objs>
$<TARGET_OBJECTS:common_buffer_obj>)
target_link_libraries(rados_a osdc ceph-common cls_lock_client
${BLKID_LIBRARIES} ${CRYPTO_LIBS} ${EXTRALIBS})
if(WITH_LTTNG)
add_dependencies(librados_api_obj librados-tp)
endif()
Expand All @@ -31,7 +25,11 @@ if(ENABLE_SHARED)
LINK_FLAGS " -Wl,--exclude-libs,ALL")
endif()
else(ENABLE_SHARED)
add_library(librados ALIAS rados_a)
add_library(librados STATIC
$<TARGET_OBJECTS:librados_api_obj>
$<TARGET_OBJECTS:librados_objs>)
target_link_libraries(librados osdc ceph-common cls_lock_client
${BLKID_LIBRARIES} ${CRYPTO_LIBS} ${EXTRALIBS})
endif(ENABLE_SHARED)
install(TARGETS librados DESTINATION ${CMAKE_INSTALL_LIBDIR})

Expand Down
3 changes: 2 additions & 1 deletion src/librbd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ add_library(rbd_internal STATIC
if(WITH_LTTNG)
add_dependencies(rbd_internal librbd-tp)
endif()
target_link_libraries(rbd_internal PRIVATE
osdc)

add_library(librbd ${CEPH_SHARED}
librbd.cc)
Expand All @@ -119,7 +121,6 @@ target_link_libraries(librbd PRIVATE
rbd_types
journal
librados
osdc
cls_rbd_client
cls_lock_client
cls_journal_client
Expand Down
24 changes: 12 additions & 12 deletions src/test/librados/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(libradostest_srcs
add_library(radostest STATIC
${libradostest_srcs}
$<TARGET_OBJECTS:libradostest_obj>)
target_link_libraries(radostest ceph-common json_spirit ${EXTRALIBS})
target_link_libraries(radostest librados ceph-common json_spirit ${EXTRALIBS})
set_target_properties(radostest PROPERTIES COMPILE_FLAGS ${UNITTEST_CXX_FLAGS})

# ceph_test_rados_api_cmd
Expand All @@ -16,7 +16,7 @@ add_executable(ceph_test_rados_api_cmd
set_target_properties(ceph_test_rados_api_cmd PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_cmd
rados_a global ${UNITTEST_LIBS} radostest)
librados ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_io
add_executable(ceph_test_rados_api_io
Expand Down Expand Up @@ -62,7 +62,7 @@ add_executable(ceph_test_rados_api_list
set_target_properties(ceph_test_rados_api_list PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_list
rados_a global ${UNITTEST_LIBS} radostest)
librados global ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_pool
add_executable(ceph_test_rados_api_pool
Expand All @@ -72,7 +72,7 @@ set_target_properties(ceph_test_rados_api_pool PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS}
)
target_link_libraries(ceph_test_rados_api_pool
rados_a ${UNITTEST_LIBS} radostest)
librados ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_stat
add_executable(ceph_test_rados_api_stat
Expand All @@ -81,7 +81,7 @@ add_executable(ceph_test_rados_api_stat
set_target_properties(ceph_test_rados_api_stat PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_stat
rados_a ${UNITTEST_LIBS} radostest)
librados ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_watch_notify
add_executable(ceph_test_rados_api_watch_notify
Expand All @@ -90,7 +90,7 @@ add_executable(ceph_test_rados_api_watch_notify
set_target_properties(ceph_test_rados_api_watch_notify PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_watch_notify
rados_a ${UNITTEST_LIBS} radostest)
librados ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_cls
add_executable(ceph_test_rados_api_cls
Expand All @@ -99,7 +99,7 @@ add_executable(ceph_test_rados_api_cls
set_target_properties(ceph_test_rados_api_cls PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_cls
rados_a ${UNITTEST_LIBS} radostest)
librados ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_misc
add_executable(ceph_test_rados_api_misc
Expand All @@ -109,7 +109,7 @@ add_executable(ceph_test_rados_api_misc
set_target_properties(ceph_test_rados_api_misc PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_misc
rados_a global ${UNITTEST_LIBS} radostest)
librados global ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_lock
add_executable(ceph_test_rados_api_lock
Expand All @@ -118,7 +118,7 @@ add_executable(ceph_test_rados_api_lock
set_target_properties(ceph_test_rados_api_lock PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_lock
rados_a ${UNITTEST_LIBS} radostest)
librados ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_service
add_executable(ceph_test_rados_api_service
Expand All @@ -127,7 +127,7 @@ add_executable(ceph_test_rados_api_service
set_target_properties(ceph_test_rados_api_service PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_service
rados_a global ${UNITTEST_LIBS} radostest)
librados global ${UNITTEST_LIBS} radostest)

# ceph_test_rados_api_tier
add_executable(ceph_test_rados_api_tier
Expand All @@ -137,7 +137,7 @@ add_executable(ceph_test_rados_api_tier
set_target_properties(ceph_test_rados_api_tier PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_tier
global rados_a ${UNITTEST_LIBS} Boost::system radostest)
librados global ${UNITTEST_LIBS} Boost::system radostest)

# ceph_test_rados_api_snapshots
add_executable(ceph_test_rados_api_snapshots
Expand All @@ -146,7 +146,7 @@ add_executable(ceph_test_rados_api_snapshots
set_target_properties(ceph_test_rados_api_snapshots PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_rados_api_snapshots
rados_a ${UNITTEST_LIBS} radostest)
librados ${UNITTEST_LIBS} radostest)

install(TARGETS
ceph_test_rados_api_aio
Expand Down
20 changes: 7 additions & 13 deletions src/test/librados/cmd.cc
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "mds/mdstypes.h"
#include "include/buffer.h"
#include "include/rbd_types.h"
#include "include/rados/librados.h"
#include "include/rados/librados.hpp"
#include "include/stringify.h"
#include "test/librados/test.h"

#include "common/Cond.h"

#include "gtest/gtest.h"
#include <errno.h>
#include <condition_variable>
#include <map>
#include <sstream>
#include <string>
Expand Down Expand Up @@ -238,13 +234,11 @@ TEST(LibRadosCmd, PGCmdPP) {

struct Log {
list<string> log;
Cond cond;
Mutex lock;

Log() : lock("l::lock") {}
std::condition_variable cond;
std::mutex lock;

bool contains(string str) {
Mutex::Locker l(lock);
bool contains(const string& str) {
std::lock_guard<std::mutex> l(lock);
for (list<string>::iterator p = log.begin(); p != log.end(); ++p) {
if (p->find(str) != std::string::npos)
return true;
Expand All @@ -259,9 +253,9 @@ void log_cb(void *arg,
uint64_t seq, const char *level,
const char *msg) {
Log *l = static_cast<Log *>(arg);
Mutex::Locker locker(l->lock);
std::lock_guard<std::mutex> locker(l->lock);
l->log.push_back(line);
l->cond.Signal();
l->cond.notify_all();
cout << "got: " << line << std::endl;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/librbd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ target_link_libraries(ceph_test_librbd
journal
cls_journal_client
cls_rbd_client
rados_a
librados
${UNITTEST_LIBS}
radostest)
target_compile_definitions(ceph_test_librbd PUBLIC "-DTEST_LIBRBD_INTERNALS")
Expand Down
2 changes: 1 addition & 1 deletion src/test/rbd_mirror/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ target_link_libraries(ceph_test_rbd_mirror
cls_rbd_client
cls_journal_client
rbd_types
rados_a
librados
radostest
${UNITTEST_LIBS}
)
Expand Down

0 comments on commit 78116c3

Please sign in to comment.