mirror of
https://github.com/ceph/ceph
synced 2025-03-30 23:40:09 +00:00
cmake: do not link against profiler if gperftools is found
this behaviour matches the autotools. and we should not enable profiling unless asked to do so. Fixes: http://tracker.ceph.com/issues/16804 Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
07206f3173
commit
8268d1ba6a
@ -249,17 +249,6 @@ if(NOT ${ATOMIC_OPS_FOUND})
|
||||
set(NO_ATOMIC_OPS 1)
|
||||
endif(NOT ${ATOMIC_OPS_FOUND})
|
||||
|
||||
option(WITH_GPERFTOOLS "gperftools is here" ON)
|
||||
if(${WITH_GPERFTOOLS})
|
||||
find_package(gperftools)
|
||||
set(HAVE_GPERFTOOLS ${GPERFTOOLS_FOUND})
|
||||
if(${HAVE_GPERFTOOLS})
|
||||
find_file(HAVE_GPERFTOOLS_HEAP_PROFILER_H heap-profiler.h PATHS /usr/include/gperftools)
|
||||
find_file(HAVE_GPERFTOOLS_MALLOC_EXTENSION_H malloc_extension.h PATHS /usr/include/gperftools)
|
||||
find_file(HAVE_GPERFTOOLS_PROFILER_H profiler.h PATHS /usr/include/gperftools)
|
||||
endif(${HAVE_GPERFTOOLS})
|
||||
endif(${WITH_GPERFTOOLS})
|
||||
|
||||
find_package(snappy REQUIRED)
|
||||
|
||||
#if allocator is set on command line make sure it matches below strings
|
||||
|
@ -201,9 +201,19 @@ set(EXTRALIBS uuid rt ${CMAKE_DL_LIBS} ${ATOMIC_OPS_LIBRARIES})
|
||||
|
||||
option(WITH_PROFILER "build extra profiler binaries" OFF)
|
||||
if(WITH_PROFILER)
|
||||
find_package(gperftools REQUIRED)
|
||||
list(APPEND EXTRALIBS profiler)
|
||||
endif(WITH_PROFILER)
|
||||
|
||||
if(WITH_PROFILER AND ALLOCATOR STREQUAL "tcmalloc")
|
||||
find_file(HAVE_GPERFTOOLS_HEAP_PROFILER_H heap-profiler.h
|
||||
PATHS ${GPERFTOOLS_INCLUDE_DIR})
|
||||
find_file(HAVE_GPERFTOOLS_MALLOC_EXTENSION_H malloc_extension.h
|
||||
PATHS ${GPERFTOOLS_INCLUDE_DIR})
|
||||
find_file(HAVE_GPERFTOOLS_PROFILER_H profiler.h
|
||||
PATHS ${GPERFTOOLS_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(${ENABLE_COVERAGE})
|
||||
find_program(HAVE_GCOV gcov)
|
||||
if(NOT HAVE_GCOV)
|
||||
@ -476,13 +486,13 @@ set(common_mountcephfs_files
|
||||
add_library(common_mountcephfs_objs OBJECT
|
||||
${common_mountcephfs_files})
|
||||
|
||||
if(WITH_PROFILER AND HAVE_GPERFTOOLS)
|
||||
if(WITH_PROFILER)
|
||||
list(APPEND libcommon_files
|
||||
perfglue/cpu_profiler.cc)
|
||||
else()
|
||||
list(APPEND libcommon_files
|
||||
perfglue/disabled_stubs.cc)
|
||||
endif(WITH_PROFILER AND HAVE_GPERFTOOLS)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SHARED)
|
||||
list(APPEND libcommon_files
|
||||
@ -499,10 +509,6 @@ set_source_files_properties(${CMAKE_SOURCE_DIR}/src/ceph_ver.c
|
||||
${CMAKE_SOURCE_DIR}/src/test/encoding/ceph_dencoder.cc
|
||||
APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)
|
||||
|
||||
if(${HAVE_GPERFTOOLS})
|
||||
target_link_libraries(common profiler)
|
||||
endif(${HAVE_GPERFTOOLS})
|
||||
|
||||
if(HAVE_ARMV8_CRC)
|
||||
add_library(common_crc_aarch64 STATIC common/crc32c_aarch64.c)
|
||||
set_target_properties(common_crc_aarch64 PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${ARM_CRC_FLAGS}")
|
||||
|
Loading…
Reference in New Issue
Block a user