]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: fix linking of compressor and plugins
authorCasey Bodley <cbodley@redhat.com>
Thu, 28 Apr 2016 19:39:28 +0000 (15:39 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 29 Apr 2016 17:42:12 +0000 (13:42 -0400)
libcommon now includes the compressor objects necessary to load
compressor plugins

also removed extra dependencies on the plugins and their unit tests

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/CMakeLists.txt
src/compressor/CMakeLists.txt
src/compressor/snappy/CMakeLists.txt
src/compressor/zlib/CMakeLists.txt
src/test/common/CMakeLists.txt
src/test/compressor/CMakeLists.txt

index 6e823a781ed285efa007c45a94c0d454bcc3edcb..89489e979207ef2f2df50e675b4a754c2e693b0f 100644 (file)
@@ -327,6 +327,7 @@ set(libcommon_files
   common/fs_types.cc
   ${arch_files}
   ${auth_files}
+  $<TARGET_OBJECTS:compressor_objs>
   ${mds_files})
 set(mon_common_files
   auth/AuthSessionHandler.cc
index 0cef856e1514c635bb1a60787a1715c3c10adae4..3ebc47bee8171d515835305b073cfb3233aeaae5 100644 (file)
@@ -2,8 +2,7 @@
 set(compressor_srcs 
   Compressor.cc
   AsyncCompressor.cc)
-add_library(compressor STATIC ${compressor_srcs})
-target_link_libraries(compressor common snappy ${CMAKE_DL_LIBS})
+add_library(compressor_objs OBJECT ${compressor_srcs})
 
 ## compressor plugins
 
@@ -12,8 +11,6 @@ set(compressorlibdir ${LIBRARY_OUTPUT_PATH}/compressor)
 add_subdirectory(snappy)
 add_subdirectory(zlib)
 
-add_library(compressor_objs OBJECT Compressor.cc)
-
 add_custom_target(compressor_plugins DEPENDS
     ceph_snappy
     ceph_zlib)
index 43cb61eca333cb8fca7325e7f7d0afeb980447e6..eb7473065dab06cbd6bb22b39aed8c0b72dbdf11 100644 (file)
@@ -1,14 +1,11 @@
 # snappy
 
-# absolute path because $snappy_sources used outside of this directory
 set(snappy_sources
-  ${CMAKE_SOURCE_DIR}/src/compressor/snappy/CompressionPluginSnappy.cc
-  $<TARGET_OBJECTS:compressor_objs>
+  CompressionPluginSnappy.cc
 )
 
 add_library(ceph_snappy SHARED ${snappy_sources})
 add_dependencies(ceph_snappy ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ceph_snappy ${EXTRALIBS})
-set_target_properties(ceph_snappy PROPERTIES VERSION 2.14.0 SOVERSION 2)
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lsnappy")
+target_link_libraries(ceph_snappy snappy)
+set_target_properties(ceph_snappy PROPERTIES VERSION 2.0.0 SOVERSION 2)
 install(TARGETS ceph_snappy DESTINATION lib/compressor)
index cacf3077a59b12a0ea409038abc777d6e4852d56..b68f4c9875b4e498640b62d37fff87c299bbd29c 100644 (file)
@@ -3,12 +3,10 @@
 set(zlib_sources
   CompressionPluginZlib.cc
   CompressionZlib.cc
-  $<TARGET_OBJECTS:compressor_objs>
 )
 
 add_library(ceph_zlib SHARED ${zlib_sources})
 add_dependencies(ceph_zlib ${CMAKE_SOURCE_DIR}/src/ceph_ver.h)
-target_link_libraries(ceph_zlib ${EXTRALIBS})
-set_target_properties(ceph_zlib PROPERTIES VERSION 2.14.0 SOVERSION 2)
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lz")
+target_link_libraries(ceph_zlib z)
+set_target_properties(ceph_zlib PROPERTIES VERSION 2.0.0 SOVERSION 2)
 install(TARGETS ceph_zlib DESTINATION lib/compressor)
index 4fd71abbab872a88d1dcea29489d7e3fb47ada1d..85abb403ce426b075dc9e5da0127a48290f2e052 100644 (file)
@@ -159,7 +159,7 @@ add_executable(unittest_async_compressor EXCLUDE_FROM_ALL
   test_async_compressor.cc
 )
 add_ceph_unittest(unittest_async_compressor ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_async_compressor)
-target_link_libraries(unittest_async_compressor global compressor)
+target_link_libraries(unittest_async_compressor global)
 
 # unittest_interval_set
 add_executable(unittest_interval_set EXCLUDE_FROM_ALL
index 0b35f543e50a4c665aaedbb2bcf4d1be8eed20f4..41a6d63cb96c62f8fe645a69de3e1f5c868136c3 100644 (file)
@@ -1,76 +1,39 @@
-add_library(ceph_example SHARED
-  compressor_plugin_example.cc
-  ${CMAKE_SOURCE_DIR}/src/compressor/Compressor.cc
-  )
-target_link_libraries(ceph_example crush pthread ${EXTRA_LIBS})
+add_library(ceph_example SHARED compressor_plugin_example.cc)
 
 # unittest_compression_plugin
 add_executable(unittest_compression_plugin EXCLUDE_FROM_ALL
   test_compression_plugin.cc
-  ${CMAKE_SOURCE_DIR}/src/compressor/Compressor.cc
   )
 add_ceph_unittest(unittest_compression_plugin ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_compression_plugin)
-target_link_libraries(unittest_compression_plugin 
-  osd
-  common 
-  global 
-  dl 
-  )
+target_link_libraries(unittest_compression_plugin global)
+add_dependencies(unittest_compression_plugin ceph_example)
 
 # unittest_compression_snappy
 add_executable(unittest_compression_snappy EXCLUDE_FROM_ALL
   test_compression_snappy.cc
-  ${snappy_sources}
   )
 add_ceph_unittest(unittest_compression_snappy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_compression_snappy)
-target_link_libraries(unittest_compression_snappy 
-  osd
-  common 
-  global 
-  dl 
-  snappy
-  )
+target_link_libraries(unittest_compression_snappy global ceph_snappy)
 
 # unittest_compression_plugin_snappy
 add_executable(unittest_compression_plugin_snappy EXCLUDE_FROM_ALL
   test_compression_plugin_snappy.cc
-  ${snappy_sources}
   )
 add_ceph_unittest(unittest_compression_plugin_snappy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_compression_plugin_snappy)
-target_link_libraries(unittest_compression_plugin_snappy 
-  osd
-  common 
-  global 
-  compressor
-  dl 
-  snappy
-  )
+target_link_libraries(unittest_compression_plugin_snappy global)
+add_dependencies(unittest_compression_plugin_snappy ceph_snappy)
 
 # unittest_compression_zlib
 add_executable(unittest_compression_zlib EXCLUDE_FROM_ALL
   test_compression_zlib.cc
-  ${CMAKE_SOURCE_DIR}/src/compressor/zlib/CompressionZlib.cc
   )
 add_ceph_unittest(unittest_compression_zlib ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_compression_zlib)
-target_link_libraries(unittest_compression_zlib 
-  z
-  osd
-  common 
-  global 
-  )
+target_link_libraries(unittest_compression_zlib global ceph_zlib)
 
 # unittest_compression_plugin_zlib
 add_executable(unittest_compression_plugin_zlib EXCLUDE_FROM_ALL
   test_compression_plugin_zlib.cc
-  ${zlib_sources}
   )
 add_ceph_unittest(unittest_compression_plugin_zlib ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_compression_plugin_zlib)
-target_link_libraries(unittest_compression_plugin_zlib 
-  osd
-  common 
-  global 
-  compressor
-  dl 
-  z
-  )
-
+target_link_libraries(unittest_compression_plugin_zlib global)
+add_dependencies(unittest_compression_plugin_zlib ceph_zlib)