summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-12 20:52:15 +0100
committerskal <pascal.massimino@gmail.com>2026-03-12 20:52:15 +0100
commit747250a4e4d2a1dd9109b30b3fcfad05d526b408 (patch)
treee514faeb4cef7cb1c1815c7cfcad1868ef250739 /cmake
parent7057fd5b25a9b20a5d1d0d705491061e61e7757b (diff)
fix(assets): regenerate assets when DEMO_STRIP_ALL toggles
Write asset_packer_mode.flag at configure time so that switching between disk-load (debug) and embedded (STRIP_ALL) modes invalidates assets_data.cc. Previously a stale embedded assets_data.cc caused fopen() on WGSL bytes, silently failing all shader snippet registration (vs_main not found crash). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/DemoCodegen.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmake/DemoCodegen.cmake b/cmake/DemoCodegen.cmake
index aaf54a3..a353fc7 100644
--- a/cmake/DemoCodegen.cmake
+++ b/cmake/DemoCodegen.cmake
@@ -244,6 +244,14 @@ if(NOT DEMO_STRIP_ALL)
set(ASSET_PACKER_FLAGS "--disk_load")
endif()
+# Write a flag file so that toggling DEMO_STRIP_ALL triggers asset regeneration.
+set(ASSET_MODE_FLAG_FILE "${CMAKE_CURRENT_BINARY_DIR}/asset_packer_mode.flag")
+if(DEMO_STRIP_ALL)
+ file(WRITE "${ASSET_MODE_FLAG_FILE}" "strip_all\n")
+else()
+ file(WRITE "${ASSET_MODE_FLAG_FILE}" "disk_load\n")
+endif()
+
set(GEN_DEMO_H_STAMP ${GEN_DEMO_H}.gen_stamp)
add_custom_command(
OUTPUT ${GEN_DEMO_H_STAMP} ${GEN_DEMO_CC}
@@ -252,6 +260,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GEN_DEMO_H}.new ${GEN_DEMO_H}
COMMAND ${CMAKE_COMMAND} -E touch ${GEN_DEMO_H_STAMP}
DEPENDS ${ASSET_PACKER_DEPENDS} ${WORKSPACE_ASSETS}
+ ${ASSET_MODE_FLAG_FILE}
${GEN_DEMO_H}.shaders_stamp
${GEN_DEMO_H}.audio_stamp
${GEN_DEMO_H}.models_stamp