feat(build): record the CPU flags used by the game #2608

Open
JooaoPedro15 wants to merge 1 commit from JooaoPedro15/fix/record-build-flags into main
JooaoPedro15 commented 2026-11-12 01:48:29 +00:00 (Migrated from github.com)

A built game currently cannot say which CPU target and compilation flags produced it. This makes reports hard to compare and leaves an updater without a record of the original build choices (#2576).

Record the CPU argument list and the normalized base flags for lifted code, hot code and host runtime in hookshot_build_flags.json. The executable embeds exactly the same JSON and prints it near the start of hookshot_log.txt; the game folder receives the file beside hookshot_version.txt, including packaged builds with the executable in bin/. Publication uses a temporary file and replacement, after successful linking.

The CPU list preserves -march, optional -mtune, and -ffp-contract=off. The other fields use the existing object-key normalization: include paths omitted, temporary sysroot paths normalized. These are the game's base flags; they do not describe a separately built renderer or optional per-file library defines. Reusing the recorded CPU choices during an update (#2577) is a separate change; this PR does not add RX_CPU_FLAGS or alter the selected CPU flags.

Validation:

  • Compiled metadata fixture checks that the C macro prints exactly the published JSON, including quotes, backslashes, control characters and non-ASCII input.
  • Tests preserve the previous record after a failed replacement, and preserve the installed game/image/metadata after an interrupted metadata staging copy.
  • Updated the existing Windows/development and packaged Linux installation fixtures to require and verify the new root-level file.
  • Related local suites pass (build flags, finish output, build times, build log, cleanup scope, and version). Windows-only fixture cases and the packaged Linux case require their CI platforms.
  • Full macOS suite before the Linux-specific fixture adjustment: 377 passed, 24 failed, 72 skipped. Failures include Python 3.9 API gaps, Linux/GNU assumptions, unavailable optional packages, macOS temporary-directory canonicalization, and main's existing HOS_FPS_LOG source-check failure. No dependencies installed; no game run or GPU performance measurement.
  • git diff --check passes.

CI: all six game-free jobs passed on Windows and Linux, on main 55b976c0 plus this change and the pending #2575. That separate validation branch differs from this PR only in host/oot_high_fps.c, the environment-switch fix from #2575. Both Python shards on both OSes, the SPIR-V fixtures, and workflow lint passed.

Current status: #2575 has merged. Rebased onto main b157c3e8 (seven focused local suites pass); the full fork CI is being repeated on this updated branch. The combined CI above records the earlier tested snapshot, not this latest rebase.

Overlap: #2673, opened later for the same request, reports a complete Linux game build/run. Only one implementation should land; this remains a draft pending maintainer choice and a real game build/run, which is unavailable on this Mac. This implementation keeps the existing CPU choices, does not introduce RX_CPU_FLAGS, and publishes the record produced by the child build after successful linking.

Fixes #2576
Related: #2577, #2505.

Work is recorded in docs/worklist.md; Discord coordination was unavailable in this environment.

Assisted-by: OpenAI Codex
Co-Authored-By: Codex [email protected]

A built game currently cannot say which CPU target and compilation flags produced it. This makes reports hard to compare and leaves an updater without a record of the original build choices (#2576). Record the CPU argument list and the normalized base flags for lifted code, hot code and host runtime in `hookshot_build_flags.json`. The executable embeds exactly the same JSON and prints it near the start of `hookshot_log.txt`; the game folder receives the file beside `hookshot_version.txt`, including packaged builds with the executable in `bin/`. Publication uses a temporary file and replacement, after successful linking. The CPU list preserves `-march`, optional `-mtune`, and `-ffp-contract=off`. The other fields use the existing object-key normalization: include paths omitted, temporary sysroot paths normalized. These are the game's base flags; they do not describe a separately built renderer or optional per-file library defines. Reusing the recorded CPU choices during an update (#2577) is a separate change; this PR does not add `RX_CPU_FLAGS` or alter the selected CPU flags. Validation: - Compiled metadata fixture checks that the C macro prints exactly the published JSON, including quotes, backslashes, control characters and non-ASCII input. - Tests preserve the previous record after a failed replacement, and preserve the installed game/image/metadata after an interrupted metadata staging copy. - Updated the existing Windows/development and packaged Linux installation fixtures to require and verify the new root-level file. - Related local suites pass (build flags, finish output, build times, build log, cleanup scope, and version). Windows-only fixture cases and the packaged Linux case require their CI platforms. - Full macOS suite before the Linux-specific fixture adjustment: 377 passed, 24 failed, 72 skipped. Failures include Python 3.9 API gaps, Linux/GNU assumptions, unavailable optional packages, macOS temporary-directory canonicalization, and main's existing HOS_FPS_LOG source-check failure. No dependencies installed; no game run or GPU performance measurement. - `git diff --check` passes. CI: [all six game-free jobs passed on Windows and Linux](https://github.com/JooaoPedro15/Hookshot/actions/runs/43136083782), on main `55b976c0` plus this change and the pending #2575. That separate validation branch differs from this PR only in `host/oot_high_fps.c`, the environment-switch fix from #2575. Both Python shards on both OSes, the SPIR-V fixtures, and workflow lint passed. Current status: #2575 has merged. Rebased onto main `b157c3e8` (seven focused local suites pass); the full fork CI is being repeated on this updated branch. The combined CI above records the earlier tested snapshot, not this latest rebase. Overlap: #2673, opened later for the same request, reports a complete Linux game build/run. Only one implementation should land; this remains a draft pending maintainer choice and a real game build/run, which is unavailable on this Mac. This implementation keeps the existing CPU choices, does not introduce `RX_CPU_FLAGS`, and publishes the record produced by the child build after successful linking. Fixes #2576 Related: #2577, #2505. Work is recorded in docs/worklist.md; Discord coordination was unavailable in this environment. Assisted-by: OpenAI Codex Co-Authored-By: Codex <[email protected]>
github-sync changed title from WIP: feat(build): record the CPU flags used by the game to feat(build): record the CPU flags used by the game 2026-11-12 16:55:16 +00:00
Commenting is not possible because the repository is archived.
No description provided.