Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/CMakeLists.txt
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-07-28 10:54:26 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-07-28 10:54:26 +1000
commit8b1a2d6f0c9a1592a5c550ab23f6bf949ce65fc4 (patch)
treef743710a6f9d3c4177483a5134a6889a3bd3f097 /source/CMakeLists.txt
parent539819003051a47b86c61447e0e59044b0775b95 (diff)
add 2 new allocators, currently using rpmalloc on Windows (mimalloc unused for now)
Diffstat (limited to 'source/CMakeLists.txt')
-rw-r--r--source/CMakeLists.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 68b65e8..2192700 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -136,6 +136,8 @@ endif()
option(STAR_LUA_APICHECK "Use lua api checks" OFF)
option(STAR_USE_JEMALLOC "Use jemalloc allocators" OFF)
+option(STAR_USE_MIMALLOC "Use mimalloc allocators" OFF)
+option(STAR_USE_RPMALLOC "Use rpmalloc allocators" OFF)
# Report all the discovered system / environment settings and all options.
@@ -174,6 +176,7 @@ endif()
message(STATUS "Using Lua API checks: ${STAR_LUA_APICHECK}")
message(STATUS "Using jemalloc: ${STAR_USE_JEMALLOC}")
+message(STATUS "Using mimalloc: ${STAR_USE_MIMALLOC}")
# Set C defines and cmake variables based on the build settings we have now
# determined...
@@ -244,6 +247,10 @@ endif()
if(STAR_USE_JEMALLOC)
add_definitions(-DSTAR_USE_JEMALLOC)
+elseif(STAR_USE_MIMALLOC)
+ add_definitions(-DSTAR_USE_MIMALLOC)
+elseif(STAR_USE_RPMALLOC)
+ add_definitions(-DSTAR_USE_RPMALLOC -DENABLE_PRELOAD)
endif()
# Set C/C++ compiler flags based on build environment...
@@ -449,6 +456,11 @@ if(STAR_USE_JEMALLOC)
set(STAR_EXT_LIBS ${JEMALLOC_LIBRARY})
endif()
+if (STAR_USE_MIMALLOC)
+ find_package(mimalloc CONFIG REQUIRED)
+ set(STAR_EXT_LIBS ${STAR_EXT_LIBS} $<IF:$<TARGET_EXISTS:mimalloc-static>,mimalloc-static,mimalloc>)
+endif()
+
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
find_package(Freetype REQUIRED)