2018-08-08 03:37:35 +00:00
|
|
|
if (OS_LINUX AND NOT SANITIZE)
|
|
|
|
set(ENABLE_JEMALLOC_DEFAULT 1)
|
|
|
|
else ()
|
|
|
|
set(ENABLE_JEMALLOC_DEFAULT 0)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
option (ENABLE_JEMALLOC "Set to TRUE to use jemalloc" ${ENABLE_JEMALLOC_DEFAULT})
|
2018-08-05 08:54:57 +00:00
|
|
|
if (OS_LINUX)
|
2018-08-03 16:39:04 +00:00
|
|
|
option (USE_INTERNAL_JEMALLOC_LIBRARY "Set to FALSE to use system jemalloc library instead of bundled" ${NOT_UNBUNDLED})
|
2018-08-03 21:13:54 +00:00
|
|
|
elseif ()
|
|
|
|
option (USE_INTERNAL_JEMALLOC_LIBRARY "Set to FALSE to use system jemalloc library instead of bundled" OFF)
|
|
|
|
endif()
|
2017-02-28 23:49:04 +00:00
|
|
|
|
2017-01-27 20:00:02 +00:00
|
|
|
if (ENABLE_JEMALLOC)
|
2018-08-03 16:39:04 +00:00
|
|
|
if (NOT USE_INTERNAL_JEMALLOC_LIBRARY)
|
2018-08-02 00:20:20 +00:00
|
|
|
find_package (JeMalloc)
|
|
|
|
endif ()
|
2017-01-27 20:00:02 +00:00
|
|
|
|
2018-08-03 16:39:04 +00:00
|
|
|
if (NOT JEMALLOC_LIBRARIES)
|
|
|
|
set (JEMALLOC_LIBRARIES "jemalloc")
|
|
|
|
set (USE_INTERNAL_JEMALLOC_LIBRARY 1)
|
|
|
|
endif ()
|
|
|
|
|
2018-08-02 00:20:20 +00:00
|
|
|
if (JEMALLOC_LIBRARIES)
|
2017-04-01 07:20:54 +00:00
|
|
|
set (USE_JEMALLOC 1)
|
2018-08-02 00:20:20 +00:00
|
|
|
else ()
|
|
|
|
message (FATAL_ERROR "ENABLE_JEMALLOC is set to true, but library was not found")
|
2017-04-01 07:20:54 +00:00
|
|
|
endif ()
|
2018-08-02 00:20:20 +00:00
|
|
|
|
2018-08-08 03:37:35 +00:00
|
|
|
if (SANITIZE)
|
|
|
|
message (FATAL_ERROR "ENABLE_JEMALLOC is set to true, but it cannot be used with sanitizers")
|
|
|
|
endif ()
|
|
|
|
|
2018-08-02 00:20:20 +00:00
|
|
|
message (STATUS "Using jemalloc=${USE_JEMALLOC}: ${JEMALLOC_LIBRARIES}")
|
2017-01-27 20:00:02 +00:00
|
|
|
endif ()
|