2018-01-20 23:23:19 +00:00
|
|
|
if (ARCH_FREEBSD OR ARCH_32)
|
2017-10-24 19:18:15 +00:00
|
|
|
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" OFF)
|
|
|
|
else ()
|
|
|
|
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" ${NOT_UNBUNDLED})
|
|
|
|
endif ()
|
2017-11-16 19:17:09 +00:00
|
|
|
|
2018-01-20 23:23:19 +00:00
|
|
|
if (ARCH_FREEBSD)
|
2017-11-28 19:57:15 +00:00
|
|
|
option (ENABLE_TCMALLOC "Set to TRUE to enable tcmalloc" OFF)
|
2017-11-16 19:17:09 +00:00
|
|
|
else ()
|
2017-11-28 19:57:15 +00:00
|
|
|
option (ENABLE_TCMALLOC "Set to TRUE to enable tcmalloc" ON)
|
2017-11-16 19:17:09 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-11-28 19:57:15 +00:00
|
|
|
option (DEBUG_TCMALLOC "Set to TRUE to use debug version of libtcmalloc" OFF)
|
2017-10-24 19:18:15 +00:00
|
|
|
|
2017-11-28 19:57:15 +00:00
|
|
|
if (ENABLE_TCMALLOC)
|
2017-10-24 19:18:15 +00:00
|
|
|
#contrib/libtcmalloc doesnt build debug version, try find in system
|
2017-11-28 19:57:15 +00:00
|
|
|
if (DEBUG_TCMALLOC OR NOT USE_INTERNAL_GPERFTOOLS_LIBRARY)
|
2017-10-24 19:18:15 +00:00
|
|
|
find_package (Gperftools)
|
|
|
|
endif ()
|
|
|
|
|
2018-01-20 23:23:19 +00:00
|
|
|
if (NOT (GPERFTOOLS_FOUND AND GPERFTOOLS_INCLUDE_DIR AND GPERFTOOLS_TCMALLOC_MINIMAL) AND NOT (ARCH_FREEBSD OR ARCH_32))
|
2017-10-24 19:18:15 +00:00
|
|
|
set (USE_INTERNAL_GPERFTOOLS_LIBRARY 1)
|
|
|
|
set (GPERFTOOLS_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libtcmalloc/include")
|
|
|
|
set (GPERFTOOLS_TCMALLOC_MINIMAL tcmalloc_minimal_internal)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (GPERFTOOLS_FOUND OR USE_INTERNAL_GPERFTOOLS_LIBRARY)
|
|
|
|
set (USE_TCMALLOC 1)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
message (STATUS "Using tcmalloc=${USE_TCMALLOC}: ${GPERFTOOLS_INCLUDE_DIR} : ${GPERFTOOLS_TCMALLOC_MINIMAL}")
|
|
|
|
endif ()
|