Reapply "Convert build scripts to CMake (#13427)"

This reverts commit 374bb15db6.
This commit is contained in:
Ashcon Partovi
2024-09-11 08:24:50 -07:00
parent 3e904303ac
commit d39e422b20
223 changed files with 4468 additions and 44770 deletions

View File

@@ -0,0 +1,58 @@
include(Macros)
register_repository(
NAME
mimalloc
REPOSITORY
oven-sh/mimalloc
COMMIT
4c283af60cdae205df5a872530c77e2a6a307d43
)
set(MIMALLOC_CMAKE_ARGS
-DMI_BUILD_STATIC=ON
-DMI_BUILD_OBJECT=ON
-DMI_BUILD_SHARED=OFF
-DMI_BUILD_TESTS=OFF
-DMI_USE_CXX=ON
-DMI_OVERRIDE=OFF
-DMI_OSX_ZONE=OFF
-DMI_OSX_INTERPOSE=OFF
-DMI_SKIP_COLLECT_ON_EXIT=ON
)
if(DEBUG)
list(APPEND MIMALLOC_CMAKE_ARGS -DMI_DEBUG_FULL=ON)
endif()
if(ENABLE_VALGRIND)
list(APPEND MIMALLOC_CMAKE_ARGS -DMI_VALGRIND=ON)
endif()
if(WIN32)
set(MIMALLOC_LIBRARY mimalloc-static)
elseif(DEBUG)
set(MIMALLOC_LIBRARY mimalloc-debug)
else()
set(MIMALLOC_LIBRARY mimalloc)
endif()
# Workaround for linker issue on macOS and Linux x64
# https://github.com/microsoft/mimalloc/issues/512
if(APPLE OR (LINUX AND NOT DEBUG))
set(MIMALLOC_LIBRARY CMakeFiles/mimalloc-obj.dir/src/static.c.o)
endif()
register_cmake_command(
TARGET
mimalloc
TARGETS
mimalloc-static
mimalloc-obj
ARGS
${MIMALLOC_CMAKE_ARGS}
LIBRARIES
${MIMALLOC_LIBRARY}
INCLUDES
include
)