BUILD-XMA2-OPT-IN: gate configure-time Cargo XMA2 build behind -DLEONIDA_XMA2_DECODER=ON (#963) #995

Closed
markankamaransheogarat-sys wants to merge 2 commits from upstream-pr/995 into main
markankamaransheogarat-sys commented 2026-11-24 16:38:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by markankamaransheogarat-sys on 2026-11-24T16:38:31Z.


Summary

  • Addresses the supply-chain note in #963: runtime/CMakeLists.txt previously ran cargo build (fetching github.com/omonkeyz/xbox-emulator) at CMake configure time whenever cargo was on PATH.
  • Adds option(LEONIDA_XMA2_DECODER "Build the Rust XMA2 decoder at configure time" OFF) and gates find_program(LEONIDA_CARGO cargo) + execute_process(...) on if(LEONIDA_XMA2_DECODER OR LEONIDA_REQUIRE_XMA2_DECODER).
  • .github/workflows/runtime.yml already passes -DLEONIDA_REQUIRE_XMA2_DECODER=ON, so CI continues to build and require the decoder unchanged.
  • Updates runtime/xma_decoder/README.md and adds tests/test_cmake_xma2_opt_in.py.

Verification

  • python3 -I tests/test_cmake_xma2_opt_in.py: 1/1 passed.
  • python3 -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/xma_decoder/README.md tests/test_cmake_xma2_opt_in.py: passed.

AI-assisted: yes (no game files).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5476334750 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/995). Originally posted by [markankamaransheogarat-sys](https://github.com/markankamaransheogarat-sys) on 2026-11-24T16:38:31Z. --- ### Summary - Addresses the supply-chain note in #963: `runtime/CMakeLists.txt` previously ran `cargo build` (fetching `github.com/omonkeyz/xbox-emulator`) at CMake configure time whenever `cargo` was on `PATH`. - Adds `option(LEONIDA_XMA2_DECODER "Build the Rust XMA2 decoder at configure time" OFF)` and gates `find_program(LEONIDA_CARGO cargo)` + `execute_process(...)` on `if(LEONIDA_XMA2_DECODER OR LEONIDA_REQUIRE_XMA2_DECODER)`. - `.github/workflows/runtime.yml` already passes `-DLEONIDA_REQUIRE_XMA2_DECODER=ON`, so CI continues to build and require the decoder unchanged. - Updates `runtime/xma_decoder/README.md` and adds `tests/test_cmake_xma2_opt_in.py`. ### Verification - `python3 -I tests/test_cmake_xma2_opt_in.py`: 1/1 passed. - `python3 -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/xma_decoder/README.md tests/test_cmake_xma2_opt_in.py`: passed. AI-assisted: yes (no game files).
KernelSmoker commented 2026-11-24 16:42:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T16:42:45Z.

Review: APPROVED


Reviewed exact head b30db4175e12f200f571a2ff74de6bc147c8a181. On latest main 82a2aabcc, the new Python regression passed 1/1, docs links 16/16, no-game-data scan and diff check passed. I also configured the Windows-only CMake branch in a disposable Fedora 45 environment with a fake Cargo executable: with LEONIDA_XMA2_DECODER=OFF, configure completed and Cargo was not invoked; with the option ON, it invoked Cargo and tolerated the simulated build failure when not required; with LEONIDA_REQUIRE_XMA2_DECODER=ON, the same failure stopped configuration as required. This tests the gating and required-mode behavior, not a real Rust/XMA2 build or Windows runtime. Hosted checks were queued at review time.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6043476864 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/995#pullrequestreview-6043476864). Originally posted by [KernelSmoker](https://github.com/KernelSmoker) on 2026-11-24T16:42:45Z. **Review:** APPROVED --- Reviewed exact head b30db4175e12f200f571a2ff74de6bc147c8a181. On latest main 82a2aabcc, the new Python regression passed 1/1, docs links 16/16, no-game-data scan and diff check passed. I also configured the Windows-only CMake branch in a disposable Fedora 45 environment with a fake Cargo executable: with `LEONIDA_XMA2_DECODER=OFF`, configure completed and Cargo was not invoked; with the option ON, it invoked Cargo and tolerated the simulated build failure when not required; with `LEONIDA_REQUIRE_XMA2_DECODER=ON`, the same failure stopped configuration as required. This tests the gating and required-mode behavior, not a real Rust/XMA2 build or Windows runtime. Hosted checks were queued at review time.
zmasi commented 2026-11-28 20:55:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T20:55:40Z.


#995 | head 6ac4d7060e (merged cleanly with main 1bc055e6c2) | python -I tests/test_cmake_xma2_opt_in.py + live cmake -S runtime -B <temp> -G "Visual Studio 17 2022" -A x64 configure check | red on main: FAILED (failures=1) (runtime/CMakeLists.txt lacked option(LEONIDA_XMA2_DECODER ... OFF) and ran cargo build unconditionally during configure whenever cargo was on PATH) | green on PR+main: 1 test OK + live CMake configure prints -- LEONIDA_XMA2_DECODER is OFF: runtime/xma_decoder not built, XMA voices will be silent without invoking cargo for xma_decoder | Windows 11 (10.0.26200.9974), MSVC 19.44, Python 3.12.10 | AI-assisted: yes

Audited runtime/CMakeLists.txt, runtime/xma_decoder/README.md, and tests/test_cmake_xma2_opt_in.py on Windows 11, confirming default LEONIDA_XMA2_DECODER=OFF skips configure-time Cargo compilation of runtime/xma_decoder while preserving prebuilt LEONIDA_XMA2_DECODER_LIB resolution and -DLEONIDA_XMA2_DECODER=ON / -DLEONIDA_REQUIRE_XMA2_DECODER=ON opt-in paths. Also verified tests/test_docs_encoding.py (1 OK), tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245646226 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/995#issuecomment-7245646226). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T20:55:40Z. --- #995 | head 6ac4d7060ef2dbe2ffcbf7f41a0b7f8c369df727 (merged cleanly with main 1bc055e6c2) | `python -I tests/test_cmake_xma2_opt_in.py` + live `cmake -S runtime -B <temp> -G "Visual Studio 17 2022" -A x64` configure check | red on main: `FAILED (failures=1)` (`runtime/CMakeLists.txt` lacked `option(LEONIDA_XMA2_DECODER ... OFF)` and ran `cargo build` unconditionally during configure whenever `cargo` was on `PATH`) | green on PR+main: `1 test OK` + live CMake configure prints `-- LEONIDA_XMA2_DECODER is OFF: runtime/xma_decoder not built, XMA voices will be silent` without invoking `cargo` for `xma_decoder` | Windows 11 (`10.0.26200.9974`), MSVC 19.44, Python 3.12.10 | AI-assisted: yes Audited `runtime/CMakeLists.txt`, `runtime/xma_decoder/README.md`, and `tests/test_cmake_xma2_opt_in.py` on Windows 11, confirming default `LEONIDA_XMA2_DECODER=OFF` skips configure-time Cargo compilation of `runtime/xma_decoder` while preserving prebuilt `LEONIDA_XMA2_DECODER_LIB` resolution and `-DLEONIDA_XMA2_DECODER=ON` / `-DLEONIDA_REQUIRE_XMA2_DECODER=ON` opt-in paths. Also verified `tests/test_docs_encoding.py` (`1 OK`), `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
TheGeogeo commented 2026-11-29 02:17:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T02:17:14Z.


Tested 6ac4d7060 merged (no commit) with main 53b77df14. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo; Python 3.12.4. check_no_game_data.py is clean.

  • Green: tests/test_cmake_xma2_opt_in.py passes. Red: with runtime/CMakeLists.txt back to main, it fails (no option(LEONIDA_XMA2_DECODER ... OFF)).
  • On the merge, configure now prints LEONIDA_XMA2_DECODER is OFF: runtime/xma_decoder not built, XMA voices will be silent, and gta6rt relinks without the XMA2 decoder. The 13 tests of the 2 relinked executables pass.
  • LINK: gta6rt.exe links without ws2_32.lib with nothing new over main.

Decision needed before merging (maintainers): making the decoder opt-in changes every build that does not pass -DLEONIDA_XMA2_DECODER=ON. On main, make_game.py and scripts/build_runtime.ps1 pass no such flag, so their builds would get silent XMA voices. If opt-in is wanted, those two scripts should pass the flag in the same PR. Otherwise the default should stay ON.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249330633 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/995#issuecomment-7249330633). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T02:17:14Z. --- Tested `6ac4d7060` merged (no commit) with `main` `53b77df14`. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo; Python 3.12.4. `check_no_game_data.py` is clean. - Green: `tests/test_cmake_xma2_opt_in.py` passes. Red: with `runtime/CMakeLists.txt` back to `main`, it fails (no `option(LEONIDA_XMA2_DECODER ... OFF)`). - On the merge, configure now prints `LEONIDA_XMA2_DECODER is OFF: runtime/xma_decoder not built, XMA voices will be silent`, and `gta6rt` relinks without the XMA2 decoder. The 13 tests of the 2 relinked executables pass. - LINK: `gta6rt.exe` links without `ws2_32.lib` with nothing new over `main`. **Decision needed before merging (maintainers):** making the decoder opt-in changes every build that does not pass `-DLEONIDA_XMA2_DECODER=ON`. On `main`, `make_game.py` and `scripts/build_runtime.ps1` pass no such flag, so their builds would get silent XMA voices. If opt-in is wanted, those two scripts should pass the flag in the same PR. Otherwise the default should stay ON. AI-assisted (Claude Code).
TheGeogeo commented 2026-11-29 19:07:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T19:07:31Z.


Tested 6ac4d7060 merged (no commit) with main dd87aa405: Python 3.12.4, Windows 11 10.0.26300, CPU only. Configure not run: only the Python test.

  • Green: tests/test_cmake_xma2_opt_in.py gives 1 test OK.
  • Red: with runtime/CMakeLists.txt back to main, it fails: option(LEONIDA_XMA2_DECODER "..." OFF) is not found.
  • The test file is new. check_no_game_data.py is clean.
  • For whoever merges: with this PR, a default configure no longer builds runtime/xma_decoder. It prints "LEONIDA_XMA2_DECODER is OFF: runtime/xma_decoder not built, XMA voices will be silent", unless LEONIDA_XMA2_DECODER or LEONIDA_REQUIRE_XMA2_DECODER is ON. That is the stated opt-in; build setups that want XMA audio need one of the two.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261027854 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/995#issuecomment-7261027854). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T19:07:31Z. --- Tested `6ac4d7060` merged (no commit) with `main` `dd87aa405`: Python 3.12.4, Windows 11 10.0.26300, CPU only. Configure not run: only the Python test. - Green: `tests/test_cmake_xma2_opt_in.py` gives 1 test OK. - Red: with `runtime/CMakeLists.txt` back to `main`, it fails: `option(LEONIDA_XMA2_DECODER "..." OFF)` is not found. - The test file is new. `check_no_game_data.py` is clean. - For whoever merges: with this PR, a default configure no longer builds `runtime/xma_decoder`. It prints "LEONIDA_XMA2_DECODER is OFF: runtime/xma_decoder not built, XMA voices will be silent", unless `LEONIDA_XMA2_DECODER` or `LEONIDA_REQUIRE_XMA2_DECODER` is ON. That is the stated opt-in; build setups that want XMA audio need one of the two. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 20:40:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T20:40:04Z.


Maintainer decision: OK in principle. Making the XMA2 decoder opt-in fits the rule that gta6rt must link without it.

One change before merge: with this PR a default build has silent XMA voices. Please add a line to docs/running.md (where players look) saying how to turn it on, -DLEONIDA_XMA2_DECODER=ON and what it needs (Cargo), so a player who builds with the defaults knows why there is no XMA audio and how to get it.

AI-assisted (Claude Code), posted for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262262554 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/995#issuecomment-7262262554). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T20:40:04Z. --- Maintainer decision: OK in principle. Making the XMA2 decoder opt-in fits the rule that `gta6rt` must link without it. One change before merge: with this PR a default build has silent XMA voices. Please add a line to `docs/running.md` (where players look) saying how to turn it on, `-DLEONIDA_XMA2_DECODER=ON` and what it needs (Cargo), so a player who builds with the defaults knows why there is no XMA audio and how to get it. AI-assisted (Claude Code), posted for MoonEyes.
aslan2142 commented 2026-12-01 10:46:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T10:46:40Z.

Review: CHANGES_REQUESTED


The CMake opt-in gating (LEONIDA_XMA2_DECODER=OFF by default, LEONIDA_REQUIRE_XMA2_DECODER preserved for CI) and tests/test_cmake_xma2_opt_in.py look clean and verified. Requesting changes on two items before merge:

  1. Unaddressed maintainer request: As requested by @MoonEyes in the thread, because a default build now leaves XMA voices silent, please add a brief note in docs/running.md explaining how to enable it (-DLEONIDA_XMA2_DECODER=ON and the Cargo prerequisite).
  2. Stale/failing CI: The previous CI run had cancelled/failing jobs (windows, check, linux-gpu-tools, translator-tests, stdlib-tests-linux).

Please add the docs/running.md note and re-run CI to green.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6129713244 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/995#pullrequestreview-6129713244). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T10:46:40Z. **Review:** CHANGES_REQUESTED --- The CMake opt-in gating (`LEONIDA_XMA2_DECODER=OFF` by default, `LEONIDA_REQUIRE_XMA2_DECODER` preserved for CI) and `tests/test_cmake_xma2_opt_in.py` look clean and verified. Requesting changes on two items before merge: 1. **Unaddressed maintainer request:** As requested by @MoonEyes in the thread, because a default build now leaves XMA voices silent, please add a brief note in `docs/running.md` explaining how to enable it (`-DLEONIDA_XMA2_DECODER=ON` and the Cargo prerequisite). 2. **Stale/failing CI:** The previous CI run had cancelled/failing jobs (`windows`, `check`, `linux-gpu-tools`, `translator-tests`, `stdlib-tests-linux`). Please add the `docs/running.md` note and re-run CI to green. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:21:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:21:45Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319177565 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/995#issuecomment-7319177565). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:21:45Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!995
No description provided.