File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ set(USE_CAIRO ON CACHE BOOL "Add cairo support if available (for `store_ro_compo
3232set (USE_CURL ON CACHE BOOL "Add curl support if available (for `store_ro_http_proxy.c` backend)" )
3333set (USE_MEMCACHED ON CACHE BOOL "Add memcached support if available (for `store_memcached.c` backend)" )
3434set (USE_RADOS ON CACHE BOOL "Add rados support if available (for `store_rados.c` backend)" )
35+ set (MALLOC_LIB "libc" CACHE STRING "Memory Management Library for `renderd`" )
36+ set_property (CACHE MALLOC_LIB PROPERTY STRINGS "libc" "jemalloc" "mimalloc" "tcmalloc" )
3537
3638#-----------------------------------------------------------------------------
3739#
@@ -90,6 +92,20 @@ if(NOT HAVE_POW)
9092 find_library (MATH_LIBRARY m REQUIRED)
9193endif ()
9294
95+ if (NOT MALLOC_LIB STREQUAL "libc" )
96+ message (STATUS "Using '${MALLOC_LIB} ' for memory managment" )
97+ if (MALLOC_LIB STREQUAL "jemalloc" )
98+ # jemalloc (http://jemalloc.net)
99+ find_library (MALLOC_LIBRARY jemalloc REQUIRED)
100+ elseif (MALLOC_LIB STREQUAL "mimalloc" )
101+ # mimalloc (https://github.com/microsoft/mimalloc)
102+ find_library (MALLOC_LIBRARY mimalloc REQUIRED)
103+ elseif (MALLOC_LIB STREQUAL "tcmalloc" )
104+ # tcmalloc (https://github.com/google/tcmalloc)
105+ find_library (MALLOC_LIBRARY tcmalloc REQUIRED)
106+ endif ()
107+ endif ()
108+
93109#-----------------------------------------------------------------------------
94110#
95111# Set variables
Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ set(RENDER_LIBRARIES
4141 ${COMMON_LIBRARIES}
4242 ${INIPARSER_LIBRARIES}
4343 ${MATH_LIBRARY}
44- Threads::Threads
4544)
4645
4746set (STORE_SRCS
@@ -61,6 +60,11 @@ set(STORE_LIBRARIES
6160 ${LIBRADOS_LIBRARIES}
6261)
6362
63+ if (NOT MALLOC_LIB STREQUAL "libc" )
64+ message (STATUS "Prepending '${MALLOC_LIBRARY} ' to RENDER_LIBRARIES" )
65+ list (PREPEND RENDER_LIBRARIES ${MALLOC_LIBRARY} )
66+ endif ()
67+
6468#-----------------------------------------------------------------------------
6569#
6670# Installed targets
You can’t perform that action at this time.
0 commit comments