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.
This commit is contained in:
2026-10-04 02:10:08 +08:00
parent 90097a756e
commit c949e8684b
+5
View File
@@ -31,6 +31,11 @@ set(JPH_USE_CPU_COMPUTE OFF CACHE BOOL "" FORCE)
set(JPH_USE_DX12 OFF CACHE BOOL "" FORCE) set(JPH_USE_DX12 OFF CACHE BOOL "" FORCE)
set(JPH_USE_VK OFF CACHE BOOL "" FORCE) set(JPH_USE_VK OFF CACHE BOOL "" FORCE)
set(JPH_USE_MTL 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) add_subdirectory(Lib/JoltPhysics/Build)
# ---- Assimp(vendored submodule,模型导入;只编译需要的 importer) ---- # ---- Assimp(vendored submodule,模型导入;只编译需要的 importer) ----