Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Add ALTERNATIVE_MALLOC_O option for user to link LDC with a malloc-overriding allocator like mimalloc.o #3758

Merged
merged 1 commit into from
Jun 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ set(COMPILE_D_MODULES_SEPARATELY OFF CACHE BOOL "Compile each D module separatel

set(LDC_ENABLE_ASSERTIONS "${LLVM_ENABLE_ASSERTIONS}" CACHE BOOL "Enable LDC assertions. Defaults to the LLVM assertions mode; overriding may cause LDC segfaults!")

# Allow user to specify mimalloc.o location, to be linked with `ldc2` only
set(ALTERNATIVE_MALLOC_O "" CACHE STRING "If specified, adds ALTERNATIVE_MALLOC_O object file to LDC link, to override the CRT malloc.")

if(D_VERSION EQUAL 1)
message(FATAL_ERROR "D version 1 is no longer supported.
Please consider using D version 2 or checkout the 'd1' git branch for the last version supporting D version 1.")
Expand Down Expand Up @@ -669,7 +672,7 @@ build_d_executable(
"${LDC_EXE_FULL}"
"${LDC_D_SOURCE_FILES}"
"${DFLAGS_BUILD_TYPE} ${DFLAGS_LDC}"
"${LDC_LINKERFLAG_LIST}"
"${ALTERNATIVE_MALLOC_O};${LDC_LINKERFLAG_LIST}"
"${FE_RES}"
"${LDC_LIB}"
${COMPILE_D_MODULES_SEPARATELY}
Expand Down