From: Kefu Chai Date: Fri, 12 Mar 2021 11:32:16 +0000 (+0800) Subject: cmake: do not build mutex_debug.cc if !WITH_CEPH_DEBUG_MUTEX X-Git-Tag: v17.1.0~2626^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=039c00bd3f1031ed354b178e93e284cf3da26d1a;p=ceph.git cmake: do not build mutex_debug.cc if !WITH_CEPH_DEBUG_MUTEX 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 --- diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 498e2dd2de0..0ec4b2edb7e 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -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) diff --git a/src/crimson/os/alienstore/CMakeLists.txt b/src/crimson/os/alienstore/CMakeLists.txt index 90e89fd6968..bc143a289b5 100644 --- a/src/crimson/os/alienstore/CMakeLists.txt +++ b/src/crimson/os/alienstore/CMakeLists.txt @@ -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 $ $) +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}) diff --git a/src/test/common/CMakeLists.txt b/src/test/common/CMakeLists.txt index a625d8fb43b..a7e64a7a247 100644 --- a/src/test/common/CMakeLists.txt +++ b/src/test/common/CMakeLists.txt @@ -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