Build soh.o2r as part of ALL, only when its inputs change (#7262)

`install` builds ALL, which never included GenerateSohOtr, so it copied
whatever soh.o2r was already in the build tree. The version check can't
catch that: a stale soh.o2r carries the same version as the binary.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Racine
2026-09-27 22:21:33 -04:00
committed by GitHub
parent b939163c3d
commit 04d0ebd38c
+10 -5
View File
@@ -334,9 +334,12 @@ add_custom_target(
COMMAND ${CMAKE_COMMAND} -E false
)
# Target to generate only soh.o2r
add_custom_target(
GenerateSohOtr
# soh.o2r is rebuilt only when its inputs change, and is part of ALL so `install` never ships a stale one.
file(GLOB_RECURSE SOH_O2R_ASSETS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/soh/assets/custom/*)
list(FILTER SOH_O2R_ASSETS EXCLUDE REGEX "/soh/assets/custom/shaders/")
file(GLOB_RECURSE SOH_O2R_SHADERS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libultraship/src/fast/shaders/*)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/soh/soh.o2r
# copy LUS default shaders into assets/custom
COMMAND ${CMAKE_COMMAND} -E rm -r -f ${CMAKE_CURRENT_SOURCE_DIR}/soh/assets/custom/shaders/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/libultraship/src/fast/shaders/ ${CMAKE_CURRENT_SOURCE_DIR}/soh/assets/custom/shaders/
@@ -347,9 +350,11 @@ add_custom_target(
${CMAKE_PROJECT_VERSION}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/soh/soh.o2r ${CMAKE_CURRENT_SOURCE_DIR}/soh.o2r
COMMENT "Generating soh.o2r..."
DEPENDS soh-o2r-packer
BYPRODUCTS ${CMAKE_SOURCE_DIR}/soh.o2r ${CMAKE_BINARY_DIR}/soh/soh.o2r
DEPENDS soh-o2r-packer ${SOH_O2R_ASSETS} ${SOH_O2R_SHADERS}
BYPRODUCTS ${CMAKE_SOURCE_DIR}/soh.o2r
VERBATIM
)
add_custom_target(GenerateSohOtr ALL DEPENDS ${CMAKE_BINARY_DIR}/soh/soh.o2r)
# ExtractAssets produced soh.o2r as well as the rom archives, so keep doing that.
add_dependencies(ExtractAssets GenerateSohOtr)