Let FDB uses Findjemalloc.cmake
This commit is contained in:
parent
873b800ba8
commit
4373f111fb
|
@ -4,7 +4,9 @@ set(FORCE_ALL_COMPONENTS OFF CACHE BOOL "Fails cmake if not all dependencies are
|
||||||
# jemalloc
|
# jemalloc
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
include(Jemalloc)
|
if(USE_JEMALLOC)
|
||||||
|
find_package(jemalloc REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Valgrind
|
# Valgrind
|
||||||
|
|
|
@ -7,7 +7,7 @@ Findjemalloc
|
||||||
|
|
||||||
Find jemalloc, the generic purpose malloc implementation that emphasizes fragmentation avoidance and scalable concurrency support.
|
Find jemalloc, the generic purpose malloc implementation that emphasizes fragmentation avoidance and scalable concurrency support.
|
||||||
|
|
||||||
This module will first try jemalloc_config, then pkg_config and finally by find_path and find_library.
|
This module will first try jemalloc_config, then find_path and find_library.
|
||||||
|
|
||||||
jemalloc_ROOT variable can be used for HINTS for different version of jemalloc.
|
jemalloc_ROOT variable can be used for HINTS for different version of jemalloc.
|
||||||
|
|
||||||
|
@ -104,13 +104,16 @@ macro(_finalize_find_package_jemalloc)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
if(NOT jemalloc_ROOT)
|
if(NOT jemalloc_ROOT)
|
||||||
set(jemalloc_ROOT $ENV{jemalloc_ROOT})
|
set(jemalloc_ROOT $ENV{jemalloc_ROOT})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# First check if jemalloc_config.sh is available
|
# First check if jemalloc_config.sh is available
|
||||||
unset(_jemalloc_CONFIG_PATH)
|
unset(_jemalloc_CONFIG_PATH)
|
||||||
set(jemalloc_FOUND FALSE)
|
set(jemalloc_FOUND FALSE)
|
||||||
find_program(_jemalloc_CONFIG_PATH NAMES jemalloc-config HINTS ${jemalloc_ROOT})
|
find_program(
|
||||||
|
_jemalloc_CONFIG_PATH
|
||||||
|
NAMES jemalloc-config
|
||||||
|
HINTS ${jemalloc_ROOT})
|
||||||
|
|
||||||
if(_jemalloc_CONFIG_PATH)
|
if(_jemalloc_CONFIG_PATH)
|
||||||
_configure_use_jemalloc_config()
|
_configure_use_jemalloc_config()
|
||||||
|
@ -127,38 +130,28 @@ if(_jemalloc_CONFIG_PATH)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Try pkg-config
|
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
pkg_search_module(jemalloc jemalloc)
|
|
||||||
if(jemalloc_FOUND)
|
|
||||||
set(jemalloc_LIBRARY "${jemalloc_LIBRARIES}")
|
|
||||||
find_package_message(
|
|
||||||
jemalloc "Found jemalloc by pkg-config: ${jemalloc_LIBRARY}"
|
|
||||||
"[${jemalloc_LIBRARY}][${jemalloc_INCLUDE_DIRS}]")
|
|
||||||
_configure_jemalloc_target()
|
|
||||||
# pkg-config will not find jemalloc_pic library
|
|
||||||
_finalize_find_package_jemalloc()
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Manual find jemalloc by hand
|
# Manual find jemalloc by hand
|
||||||
set(jemalloc_FOUND FALSE)
|
|
||||||
find_path(
|
find_path(
|
||||||
jemalloc_INCLUDE_DIRS
|
jemalloc_INCLUDE_DIRS
|
||||||
NAMES jemalloc.h
|
NAMES jemalloc.h
|
||||||
PATH_SUFFIXES jemalloc jemalloc/include
|
PATH_SUFFIXES jemalloc jemalloc/include
|
||||||
HINTS ${jemalloc_ROOT}
|
HINTS ${jemalloc_ROOT})
|
||||||
)
|
|
||||||
if(NOT jemalloc_INCLUDE_DIRS)
|
if(NOT jemalloc_INCLUDE_DIRS)
|
||||||
_finalize_find_package_jemalloc()
|
_finalize_find_package_jemalloc()
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
find_library(jemalloc_LIBRARY NAMES libjemalloc.a HINTS ${jemalloc_ROOT})
|
find_library(
|
||||||
|
jemalloc_LIBRARY
|
||||||
|
NAMES libjemalloc.a
|
||||||
|
HINTS ${jemalloc_ROOT})
|
||||||
if(jemalloc_LIBRARY)
|
if(jemalloc_LIBRARY)
|
||||||
set(jemalloc_FOUND TRUE)
|
set(jemalloc_FOUND TRUE)
|
||||||
_configure_jemalloc_target()
|
_configure_jemalloc_target()
|
||||||
endif()
|
endif()
|
||||||
find_library(jemalloc_pic_LIBRARY NAMES jemalloc_pic.a HINTS ${jemalloc_ROOT})
|
find_library(
|
||||||
|
jemalloc_pic_LIBRARY
|
||||||
|
NAMES libjemalloc_pic.a
|
||||||
|
HINTS ${jemalloc_ROOT})
|
||||||
if(jemalloc_pic_LIBRARY)
|
if(jemalloc_pic_LIBRARY)
|
||||||
_configure_jemalloc_pic_target()
|
_configure_jemalloc_pic_target()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -41,7 +41,12 @@ else()
|
||||||
target_link_libraries(fdbserver PRIVATE fdbclient sqlite)
|
target_link_libraries(fdbserver PRIVATE fdbclient sqlite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(fdbserver PRIVATE toml11_target jemalloc rapidjson)
|
if(USE_JEMALLOC)
|
||||||
|
target_include_directories(fdbserver INTERFACE $<TARGET_PROPERTY:jemalloc::jemalloc, INTERFACE_INCLUDE_DIRECTORIES>)
|
||||||
|
target_link_libraries(fdbserver PRIVATE jemalloc::jemalloc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(fdbserver PRIVATE toml11_target rapidjson)
|
||||||
if(WITH_ROCKSDB_EXPERIMENTAL)
|
if(WITH_ROCKSDB_EXPERIMENTAL)
|
||||||
target_compile_definitions(fdbserver PRIVATE SSD_ROCKSDB_EXPERIMENTAL)
|
target_compile_definitions(fdbserver PRIVATE SSD_ROCKSDB_EXPERIMENTAL)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue