skate3recomp-multiplayer/cmake/CodegenTargets.cmake
MiTHRAL e3a9fa0b99 releases: tolerate rexglue codegen exit crash; ship actual runtime lib name
The rexglue codegen tool segfaults/aborts during static teardown AFTER
writing its output (cvar registry SIOF + heap corruption at exit). The
generated source is complete and valid, so generate-skate3/generate-eawebkit
now wrap the invocation with bash -c that verifies the written output files
instead of the exit code - a genuine failure (unresolved calls without the
Title Update package) produces no output and is still caught. Fixes the
release build on toolchains that hit the teardown bug (also applies to CI).

release.sh: glob the actual rexglue runtime lib name (librexruntimerd.so for
relwithdebinfo vs librexruntime.so for release) so packaging ships the lib
the binary links.
2026-08-27 12:42:04 -04:00

37 lines
1.9 KiB
CMake

add_custom_target(generate-skate3
# The rexglue codegen tool writes its output and THEN crashes during
# static teardown (SIOF / heap-corruption at exit - the cvar registry and
# friends are freed out of order). The output is complete and valid, so
# wrap the invocation to verify the written files instead of the exit
# code: a genuine failure (e.g. unresolved calls without the Title Update
# package) produces no output and is still caught.
COMMAND bash -c "$<TARGET_FILE:rex::rexglue> codegen ${SKATE3_CODEGEN_ARGS} \"${CMAKE_CURRENT_BINARY_DIR}/manifests/skate3.toml\"; rc=\$?; [ -f \"${CMAKE_CURRENT_SOURCE_DIR}/generated/sources.cmake\" ] || exit \$rc; exit 0"
COMMAND "${CMAKE_COMMAND}"
"-DSKATE3_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ApplySkate3CodegenPatches.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating recompiled code for default.xex"
VERBATIM
)
add_custom_target(generate-eawebkit
COMMAND bash -c "$<TARGET_FILE:rex::rexglue> codegen ${SKATE3_CODEGEN_ARGS} \"${CMAKE_CURRENT_BINARY_DIR}/manifests/eawebkit.toml\"; rc=\$?; [ -f \"${CMAKE_CURRENT_SOURCE_DIR}/generated/eawebkit/sources.cmake\" ] || exit \$rc; exit 0"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating recompiled code for EAWebkit.xex"
VERBATIM
)
if(TARGET skate3-title-update-codegen-inputs)
add_dependencies(generate-skate3 skate3-title-update-codegen-inputs)
add_dependencies(generate-eawebkit skate3-title-update-codegen-inputs)
endif()
add_dependencies(generate-skate3 generate-eawebkit)
add_custom_target(generate-all
DEPENDS generate-skate3 generate-eawebkit
)
add_custom_target(skate3_codegen DEPENDS generate-skate3)
add_custom_target(eawebkit_codegen DEPENDS generate-eawebkit)
add_custom_target(all_codegen DEPENDS generate-all)