]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: do not build mutex_debug.cc if !WITH_CEPH_DEBUG_MUTEX
authorKefu Chai <kchai@redhat.com>
Fri, 12 Mar 2021 11:32:16 +0000 (19:32 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 12 Mar 2021 17:15:07 +0000 (01:15 +0800)
there is no need to build shared_mutex_debug.cc and
mutex_debug.cc, if they are not used at all. in Release build
we just use the mutex primitives offered by C++ standard library and
the POSIX API offered by libc.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/CMakeLists.txt
src/crimson/os/alienstore/CMakeLists.txt
src/test/common/CMakeLists.txt

index 498e2dd2de011f5155824cf0fd69bd14ae4d4474..0ec4b2edb7ebfe943e849e461064faf5a8266f4f 100644 (file)
@@ -77,7 +77,6 @@ set(common_srcs
   lockdep.cc
   mempool.cc
   mime.c
-  mutex_debug.cc
   numa.cc
   openssl_opts_handler.cc
   options.cc
@@ -90,7 +89,6 @@ set(common_srcs
   reverse.c
   run_cmd.cc
   scrub_types.cc
-  shared_mutex_debug.cc
   signal.cc
   snap_types.cc
   str_list.cc
@@ -103,6 +101,12 @@ set(common_srcs
   util.cc
   version.cc)
 
+if(WITH_CEPH_DEBUG_MUTEX)
+  list(APPEND common_srcs
+    mutex_debug.cc
+    shared_mutex_debug.cc)
+endif()
+
 if(WIN32)
   if(MINGW)
     set(CMAKE_MC_COMPILER x86_64-w64-mingw32-windmc)
index 90e89fd6968eb2eccacdc9711a934099111a6dd3..bc143a289b5bd8d33b2db82f5431a4d3ae1bf447 100644 (file)
@@ -16,11 +16,9 @@ set(crimson_alien_common_srcs
   ${PROJECT_SOURCE_DIR}/src/common/HeartbeatMap.cc
   ${PROJECT_SOURCE_DIR}/src/common/PluginRegistry.cc
   ${PROJECT_SOURCE_DIR}/src/common/lockdep.cc
-  ${PROJECT_SOURCE_DIR}/src/common/mutex_debug.cc
   ${PROJECT_SOURCE_DIR}/src/common/perf_counters.cc
   ${PROJECT_SOURCE_DIR}/src/common/perf_counters_collection.cc
   ${PROJECT_SOURCE_DIR}/src/common/RefCountedObj.cc
-  ${PROJECT_SOURCE_DIR}/src/common/shared_mutex_debug.cc
   ${PROJECT_SOURCE_DIR}/src/common/SubProcess.cc
   ${PROJECT_SOURCE_DIR}/src/common/Throttle.cc
   ${PROJECT_SOURCE_DIR}/src/common/Timer.cc
@@ -31,6 +29,11 @@ set(crimson_alien_common_srcs
   ${PROJECT_SOURCE_DIR}/src/global/global_context.cc
   $<TARGET_OBJECTS:compressor_objs>
   $<TARGET_OBJECTS:common_prioritycache_obj>)
+if(WITH_CEPH_DEBUG_MUTEX)
+  list(APPEND crimson_alien_common_srcs
+    ${PROJECT_SOURCE_DIR}/src/common/mutex_debug.cc
+    ${PROJECT_SOURCE_DIR}/src/common/shared_mutex_debug.cc)
+endif()
 add_library(crimson-alien-common STATIC
   ${crimson_alien_common_srcs})
 
index a625d8fb43bf6bf821919b78dc5c0fd003211330..a7e64a7a247867a7e9785f51103f4ddc189830ff 100644 (file)
@@ -260,12 +260,12 @@ add_executable(unittest_weighted_priority_queue
 target_link_libraries(unittest_weighted_priority_queue ceph-common)
 add_ceph_unittest(unittest_weighted_priority_queue)
 
-# unittest_mutex_debug
-add_executable(unittest_mutex_debug
-  test_mutex_debug.cc
-  )
-add_ceph_unittest(unittest_mutex_debug)
-target_link_libraries(unittest_mutex_debug ceph-common)
+if(WITH_CEPH_DEBUG_MUTEX)
+  add_executable(unittest_mutex_debug
+    test_mutex_debug.cc)
+  add_ceph_unittest(unittest_mutex_debug)
+  target_link_libraries(unittest_mutex_debug ceph-common)
+endif()
 
 # unittest_shunique_lock
 add_executable(unittest_shunique_lock