From c949e8684b4e4a91fe3dbeb312fb417ca3f3231c Mon Sep 17 00:00:00 2001 From: atdunbg Date: Sun, 4 Oct 2026 02:10:08 +0800 Subject: [PATCH] build: strip Jolt debug symbols from Release (55MB -> 11.3MB exe) Jolt's GENERATE_DEBUG_SYMBOLS option defaults to ON and injects -g in every config, so the Release binary carried ~44MB of DWARF sections (.debug_info/.debug_line/...) from Jolt TUs alone -- 80% of the 55MB exe. Force the option OFF for Release builds only (the vendored submodule is untouched; Debug/RelWithDebInfo keep symbols). Measured: 55.0MB -> 11.3MB, .text unchanged at 8.5MB, zero debug sections left. The remaining ~1.6MB is the ELF symtab, useful for crash stacks; plain strip takes it to 9.7MB if a distributable is needed. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffbfba2..8d6b874 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,11 @@ set(JPH_USE_CPU_COMPUTE OFF CACHE BOOL "" FORCE) set(JPH_USE_DX12 OFF CACHE BOOL "" FORCE) set(JPH_USE_VK OFF CACHE BOOL "" FORCE) set(JPH_USE_MTL OFF CACHE BOOL "" FORCE) +# Jolt GENERATE_DEBUG_SYMBOLS 默认 ON,Release 也带 -g → Jolt 的 DWARF +# Debug/RelWithDebInfo 保留符号便于调试 +if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(GENERATE_DEBUG_SYMBOLS OFF CACHE BOOL "" FORCE) +endif() add_subdirectory(Lib/JoltPhysics/Build) # ---- Assimp(vendored submodule,模型导入;只编译需要的 importer) ----