mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 23:39:31 +03:00
Fixing Cmake file and making dbg files build by default
This commit is contained in:
parent
0ced3c5216
commit
d96f00af2a
3 changed files with 18 additions and 16 deletions
|
@ -22,7 +22,7 @@ BraceWrapping:
|
||||||
AfterClass: false
|
AfterClass: false
|
||||||
AfterControlStatement: false
|
AfterControlStatement: false
|
||||||
AfterEnum: false
|
AfterEnum: false
|
||||||
AfterFunction: true
|
AfterFunction: false
|
||||||
AfterNamespace: false
|
AfterNamespace: false
|
||||||
AfterObjCDeclaration: false
|
AfterObjCDeclaration: false
|
||||||
AfterStruct: false
|
AfterStruct: false
|
||||||
|
@ -105,6 +105,6 @@ SpacesInCStyleCastParentheses: false
|
||||||
SpacesInContainerLiterals: true
|
SpacesInContainerLiterals: true
|
||||||
SpacesInParentheses: false
|
SpacesInParentheses: false
|
||||||
SpacesInSquareBrackets: false
|
SpacesInSquareBrackets: false
|
||||||
Standard: Cpp20
|
Standard: Cpp11
|
||||||
TabWidth: 4
|
TabWidth: 4
|
||||||
UseTab: Never
|
UseTab: Never
|
|
@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 3.18)
|
||||||
project(libmimalloc C CXX)
|
project(libmimalloc C CXX)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON) # Ensure C++20 is required
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF) # Use strict C++20 without compiler-specific extensions
|
||||||
|
|
||||||
option(MI_SECURE "Use full security mitigations (like guard pages, allocation randomization, double-free mitigation, and free-list corruption detection)" OFF)
|
option(MI_SECURE "Use full security mitigations (like guard pages, allocation randomization, double-free mitigation, and free-list corruption detection)" OFF)
|
||||||
option(MI_DEBUG_FULL "Use full internal heap invariant checking in DEBUG mode (expensive)" OFF)
|
option(MI_DEBUG_FULL "Use full internal heap invariant checking in DEBUG mode (expensive)" OFF)
|
||||||
|
@ -40,7 +42,7 @@ option(MI_INSTALL_TOPLEVEL "Install directly into $CMAKE_INSTALL_PREFIX instead
|
||||||
option(MI_NO_THP "Disable transparent huge pages support on Linux/Android for the mimalloc process only" OFF)
|
option(MI_NO_THP "Disable transparent huge pages support on Linux/Android for the mimalloc process only" OFF)
|
||||||
option(MI_EXTRA_CPPDEFS "Extra pre-processor definitions (use as `-DMI_EXTRA_CPPDEFS=\"opt1=val1;opt2=val2\"`)" "")
|
option(MI_EXTRA_CPPDEFS "Extra pre-processor definitions (use as `-DMI_EXTRA_CPPDEFS=\"opt1=val1;opt2=val2\"`)" "")
|
||||||
|
|
||||||
option(MI_WIN_DBG_EXTS "Build with windows debugger extension points")
|
option(MI_WIN_DBG_EXTS "Build with windows debugger extension points" ON)
|
||||||
|
|
||||||
# negated options for vcpkg features
|
# negated options for vcpkg features
|
||||||
option(MI_NO_USE_CXX "Use plain C compilation (has priority over MI_USE_CXX)" OFF)
|
option(MI_NO_USE_CXX "Use plain C compilation (has priority over MI_USE_CXX)" OFF)
|
||||||
|
@ -74,13 +76,6 @@ set(mi_sources
|
||||||
src/stats.c
|
src/stats.c
|
||||||
src/prim/prim.c)
|
src/prim/prim.c)
|
||||||
|
|
||||||
if(WIN32 AND MI_WIN_DBG_EXTS)
|
|
||||||
list(APPEND mi_sources src/prim/windows/windbg/mimalloc_windbg.cpp)
|
|
||||||
list(APPEND mi_sources src/prim/windows/windbg/mimalloc_windbg_arenas.cpp)
|
|
||||||
list(APPEND mi_sources src/prim/windows/windbg/mimalloc_windbg_options.cpp)
|
|
||||||
list(APPEND mi_sources src/prim/windows/windbg/mimalloc_windbg_utils.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(mi_cflags "")
|
set(mi_cflags "")
|
||||||
set(mi_cflags_static "") # extra flags for a static library build
|
set(mi_cflags_static "") # extra flags for a static library build
|
||||||
set(mi_cflags_dynamic "") # extra flags for a shared-object library build
|
set(mi_cflags_dynamic "") # extra flags for a shared-object library build
|
||||||
|
@ -160,6 +155,11 @@ if(MI_NO_OPT_ARCH)
|
||||||
set(MI_OPT_ARCH "OFF")
|
set(MI_OPT_ARCH "OFF")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
add_compile_options(/std:c++20)
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
add_compile_options(-std=c++20)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel")
|
if(CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel")
|
||||||
set(MI_USE_CXX "ON")
|
set(MI_USE_CXX "ON")
|
||||||
|
@ -273,6 +273,13 @@ if(MI_WIN_DBG_EXTS)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32 AND MI_WIN_DBG_EXTS)
|
||||||
|
list(APPEND mi_sources ${PROJECT_SOURCE_DIR}/src/prim/windows/windbg/mimalloc_windbg.cpp)
|
||||||
|
list(APPEND mi_sources ${PROJECT_SOURCE_DIR}/src/prim/windows/windbg/mimalloc_windbg_arenas.cpp)
|
||||||
|
list(APPEND mi_sources ${PROJECT_SOURCE_DIR}/src/prim/windows/windbg/mimalloc_windbg_options.cpp)
|
||||||
|
list(APPEND mi_sources ${PROJECT_SOURCE_DIR}/src/prim/windows/windbg/mimalloc_windbg_utils.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MI_GUARDED)
|
if(MI_GUARDED)
|
||||||
message(STATUS "Compile guard pages behind certain object allocations (MI_GUARDED=ON)")
|
message(STATUS "Compile guard pages behind certain object allocations (MI_GUARDED=ON)")
|
||||||
list(APPEND mi_defines MI_GUARDED=1)
|
list(APPEND mi_defines MI_GUARDED=1)
|
||||||
|
|
|
@ -108,9 +108,4 @@ extern "C" __declspec(dllexport) HRESULT CALLBACK mi_help(PDEBUG_CLIENT Client,
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) HRESULT CALLBACK mi_dump_stats(PDEBUG_CLIENT client, PCSTR args) {
|
extern "C" __declspec(dllexport) HRESULT CALLBACK mi_dump_stats(PDEBUG_CLIENT client, PCSTR args) {
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" __declspec(dllexport) HRESULT CALLBACK mi_dump_options(PDEBUG_CLIENT client, PCSTR args) {
|
|
||||||
mi_options_print();
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue