From 58060d2f7e86427124551f3f6edcf05bf6e4d229 Mon Sep 17 00:00:00 2001 From: Gangzheng Tong Date: Wed, 17 Sep 2025 12:27:57 -0700 Subject: Set default mimalloc for spirv-tools but allow user to override (#8460) This PR resolves a configuration conflict where the SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC option was defined twice with different defaults, causing user settings to be overridden. Changes: - Removed duplicate definition in external/CMakeLists.txt that only applied to WIN32 - Define default in main CMakeLists.txt - ON by default for Windows - OFF by default for other platforms (still need to resolve crashes so set it to `OFF` for now) Preserved user configuration - explicit -DSLANG_ENABLE_SPIRV_TOOLS_MIMALLOC=value settings are now properly respected Related to https://github.com/shader-slang/slang/issues/8158 --------- Co-authored-by: slangbot Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- CMakeLists.txt | 8 +++++++- external/CMakeLists.txt | 9 --------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab4556550..ae99959f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,10 +185,16 @@ advanced_option( "Build using system glslang library" OFF ) +if(WIN32) + set(SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC_DEFAULT ON) +else() + set(SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC_DEFAULT OFF) +endif() + advanced_option( SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC "Enable mimalloc for SPIRV-Tools to improve compilation performance" - OFF + ${SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC_DEFAULT} ) option( diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index fed9e5e4e..e0dcdfb40 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -25,15 +25,6 @@ if(NOT SLANG_ENABLE_EXTERNAL_COMPILER_WARNINGS) endif() endif() -# Option to enable mimalloc for SPIRV-Tools to improve compilation performance -if(WIN32) - option( - SLANG_ENABLE_SPIRV_TOOLS_MIMALLOC - "Enable mimalloc for SPIRV-Tools to improve compilation performance" - ON - ) -endif() - # Unordered dense if(NOT ${SLANG_USE_SYSTEM_UNORDERED_DENSE}) if(NOT SLANG_OVERRIDE_UNORDERED_DENSE_PATH) -- cgit v1.2.3