2017-02-28 23:49:04 +00:00
|
|
|
if (CMAKE_SYSTEM MATCHES "FreeBSD")
|
|
|
|
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 ()
|
|
|
|
option (ENABLE_LIBTCMALLOC "Set to TRUE to enable libtcmalloc" ON)
|
|
|
|
option (DEBUG_LIBTCMALLOC "Set to TRUE to use debug version of libtcmalloc" OFF)
|
|
|
|
|
2017-01-27 20:00:02 +00:00
|
|
|
if (ENABLE_LIBTCMALLOC)
|
2017-02-07 21:28:13 +00:00
|
|
|
#contrib/libtcmalloc doesnt build debug version, try find in system
|
|
|
|
if (DEBUG_LIBTCMALLOC OR NOT USE_INTERNAL_GPERFTOOLS_LIBRARY)
|
2017-02-27 21:07:57 +00:00
|
|
|
find_package (Gperftools)
|
|
|
|
if (GPERFTOOLS_FOUND)
|
|
|
|
include_directories (${GPERFTOOLS_INCLUDE_DIR})
|
|
|
|
endif ()
|
2017-01-27 20:00:02 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-02-27 21:07:57 +00:00
|
|
|
if (NOT (GPERFTOOLS_FOUND AND GPERFTOOLS_INCLUDE_DIR AND GPERFTOOLS_TCMALLOC_MINIMAL))
|
2017-02-08 21:35:27 +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)
|
2017-02-06 20:30:19 +00:00
|
|
|
include_directories (BEFORE ${GPERFTOOLS_INCLUDE_DIR})
|
2017-01-27 20:00:02 +00:00
|
|
|
endif ()
|
2017-01-13 11:25:44 +00:00
|
|
|
|
2017-02-06 20:30:19 +00:00
|
|
|
set (USE_TCMALLOC 1)
|
|
|
|
|
2017-02-08 21:35:27 +00:00
|
|
|
message (STATUS "Using tcmalloc=${USE_TCMALLOC}: ${GPERFTOOLS_INCLUDE_DIR} : ${GPERFTOOLS_TCMALLOC_MINIMAL}")
|
2017-01-27 20:00:02 +00:00
|
|
|
endif ()
|