aboutsummaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-07-25 11:31:16 +0000
committersaturneric <[email protected]>2024-07-25 11:31:16 +0000
commit6728888b87806328b05f30b15825d05ca34026bc (patch)
tree2376e198984f1770cd3e240469e550fb4fef101d /third_party
parentfeat: update mimalloc to v2.1.7 (diff)
downloadGpgFrontend-6728888b87806328b05f30b15825d05ca34026bc.tar.gz
GpgFrontend-6728888b87806328b05f30b15825d05ca34026bc.zip
feat: add an ASAN option to enable a memory debugging mode
Diffstat (limited to 'third_party')
-rw-r--r--third_party/CMakeLists.txt26
1 files changed, 19 insertions, 7 deletions
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index 534d71da..8752a291 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -33,15 +33,27 @@ if (MINGW)
add_subdirectory(libarchive EXCLUDE_FROM_ALL)
endif()
-# not working at macOS
-if (NOT APPLE)
- set(MI_SECURE ON)
- if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
- # set(MI_TRACK_VALGRIND ON)
- set(MI_TRACK_ASAN ON)
+set(MI_SECURE ON)
+
+# fix the segment fault issue on M1 chip platform
+# refer to https://github.com/microsoft/mimalloc/issues/343
+if(APPLE)
+ set(MI_OSX_ZONE ON)
+ set(MI_OSX_INTERPOSE OFF)
+endif()
+
+# ASAN checking
+if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND ENABLE_ASAN)
+
+ if(APPLE)
+ set(MI_OVERRIDE OFF)
endif()
- add_subdirectory(mimalloc EXCLUDE_FROM_ALL)
+
+ set(MI_TRACK_VALGRIND ON)
+ set(MI_TRACK_ASAN ON)
endif()
+add_subdirectory(mimalloc EXCLUDE_FROM_ALL)
+
set(INSTALL_GTEST OFF)
add_subdirectory(googletest EXCLUDE_FROM_ALL) \ No newline at end of file