Added support for tcmalloc usage.
This commit is contained in:
@ -13,6 +13,7 @@ set_variables()
|
||||
set_maxscale_version()
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local/mariadb-maxscale" CACHE PATH "Prefix prepended to install directories.")
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
@ -27,6 +28,7 @@ find_package(Valgrind)
|
||||
find_package(MySQLClient)
|
||||
find_package(MySQL)
|
||||
find_package(Pandoc)
|
||||
find_package(TCMalloc)
|
||||
|
||||
# You can find the variables set by this in the FindCURL.cmake file
|
||||
# which is a default module in CMake.
|
||||
|
11
cmake/FindTCMalloc.cmake
Normal file
11
cmake/FindTCMalloc.cmake
Normal file
@ -0,0 +1,11 @@
|
||||
# this CMake file defines the following variables
|
||||
# TCMALLOC_FOUND - TCMalloc was found
|
||||
# TCMALLOC_LIBRARIES - TCMalloc library
|
||||
find_library(TCMALLOC_LIBRARIES NAMES tcmalloc libtcmalloc.so.4 libtcmalloc.so.4.2.2)
|
||||
if(TCMALLOC_LIBRARIES)
|
||||
set(TCMALLOC_FOUND TRUE CACHE INTERNAL "")
|
||||
message(STATUS "Found libtcmalloc: ${TCMALLOC_LIBRARIES}")
|
||||
else()
|
||||
set(TCMALLOC_FOUND FALSE CACHE INTERNAL "")
|
||||
message(STATUS "Could not find libtcmalloc, using system default malloc instead.")
|
||||
endif()
|
@ -60,6 +60,9 @@ macro(set_variables)
|
||||
# Install init.d scripts and ldconf configuration files
|
||||
set(WITH_SCRIPTS TRUE CACHE BOOL "Install init.d scripts and ldconf configuration files")
|
||||
|
||||
# Use tcmalloc as the memory allocator
|
||||
set(WITH_TCMALLOC FALSE CACHE BOOL "Use tcmalloc as the memory allocator")
|
||||
|
||||
# Build tests
|
||||
set(BUILD_TESTS FALSE CACHE BOOL "Build tests")
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
if(BUILD_TESTS OR BUILD_TOOLS)
|
||||
file(GLOB FULLCORE_SRC *.c)
|
||||
add_library(fullcore STATIC ${FULLCORE_SRC})
|
||||
if(WITH_TCMALLOC)
|
||||
target_link_libraries(fullcore ${TCMALLOC_LIBRARIES})
|
||||
endif()
|
||||
target_link_libraries(fullcore ${CURL_LIBRARIES} log_manager utils pthread ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++)
|
||||
endif()
|
||||
|
||||
@ -9,6 +12,11 @@ add_executable(maxscale atomic.c buffer.c spinlock.c gateway.c
|
||||
poll.c config.c users.c hashtable.c dbusers.c thread.c gwbitmask.c
|
||||
monitor.c adminusers.c secrets.c filter.c modutil.c hint.c
|
||||
housekeeper.c memlog.c resultset.c)
|
||||
|
||||
if(WITH_TCMALLOC)
|
||||
target_link_libraries(maxscale ${TCMALLOC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(maxscale ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} log_manager utils ssl aio pthread crypt dl crypto inih z rt m stdc++)
|
||||
install(TARGETS maxscale DESTINATION bin)
|
||||
|
||||
|
Reference in New Issue
Block a user