Add support for building with JEMALLOC
This commit is contained in:
parent
ea6105a007
commit
52d31ee6b5
1 changed files with 15 additions and 0 deletions
|
|
@ -182,6 +182,9 @@ set(SRB2_CONFIG_STD23 OFF CACHE BOOL
|
|||
set(SRB2_CONFIG_COMPILEAPPIMAGE OFF CACHE BOOL
|
||||
"Compiles the game then attempts turning it into an appimage.")
|
||||
|
||||
set(SRB2_CONFIG_JEMALLOC OFF CACHE BOOL
|
||||
"Links jemalloc Allocator to replace GLibc malloc.")
|
||||
|
||||
if(SRB2_CONFIG_COMPILEAPPIMAGE AND "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
message("-- Generating Appimage at build time.")
|
||||
add_custom_command(
|
||||
|
|
@ -204,6 +207,18 @@ else()
|
|||
set_property(TARGET BLANKART PROPERTY CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
# Thanks https://stackoverflow.com/a/63320046
|
||||
if(SRB2_CONFIG_JEMALLOC)
|
||||
message("-- Using JEMALLOC.")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(JEMALLOC jemalloc)
|
||||
|
||||
pkg_search_module(JEMALLOC REQUIRED jemalloc)
|
||||
include_directories(${JEMALLOC_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(BLANKART PRIVATE ${JEMALLOC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
### Configuration
|
||||
set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL
|
||||
"Compile a development build of SRB2Kart.")
|
||||
|
|
|
|||
Loading…
Reference in a new issue