From 04d0ebd38c099430d3436ad68a3b86cc61908aab Mon Sep 17 00:00:00 2001 From: David Racine Date: Sun, 27 Sep 2026 22:21:33 -0400 Subject: [PATCH] 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 --- CMakeLists.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7792172b2f..77b9e46768 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)