runtime: accept prebuilt XMA2 decoder via -DLEONIDA_XMA2_DECODER_LIB (BUILD-XMA2-PREBUILT-LIB) #1491
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1491
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1491/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@madhyn on GitHub · 2026-11-25 01:43 UTC · original
madhyn:feat/xma2-prebuilt-lib→main· +219 −33 · 5 files · 2 commits · merged 2026-11-25 02:00 UTCClaimed in the coordination issue as: BUILD-XMA2-PREBUILT-LIB (claim)
What and why
Allows passing a prebuilt
leonida_xma2_decoder.libto CMake via-DLEONIDA_XMA2_DECODER_LIB=<path>, skippingcargoat configure time:clang-cl+xwin), distribution Rust packages (for example Arch Linux'srustpackage) typically omitrust-stdforx86_64-pc-windows-msvc.runtime/CMakeLists.txtunconditionally invokedcargo build --target x86_64-pc-windows-msvc, failed with a warning, and silently produced a runtime whose XMA2 voices output silence — even when the user had already cross-compiledleonida_xma2_decoder.libwith a matching Windows-MSVC sysroot. It also prevented offline / zero-configure-time-Cargo builds from reusing an existing static library (complementing #995).runtime/cmake/xma2_decoder.cmake: addsleonida_resolve_prebuilt_xma2_decoder()(kept in its own module socmake -Pcan test it directly, matchingruntime/cmake/vulkan_headers_missing.cmake). Resolves absolute or build-relative paths (including spaces) and raisesFATAL_ERRORif a non-empty value does not point to an existing file, rather than falling back silently to muted audio.runtime/CMakeLists.txt: adds theLEONIDA_XMA2_DECODER_LIBcache filepath variable; when set, bypassesfind_program(LEONIDA_CARGO cargo)andexecute_process(... cargo build ...)and imports the supplied library with the sameLEONIDA_HAVE_XMA2_DECODER=1and Windows SDK link contract (includingsynchronization). When unset, preserves the existingcargoconfigure path unchanged.runtime/xma_decoder/README.mdanddocs/linux.md: document-DLEONIDA_XMA2_DECODER_LIB=<path>and the Linuxx86_64-pc-windows-msvctarget requirement.tests/test_cmake_xma2_prebuilt.py: unit tests exercisingruntime/cmake/xma2_decoder.cmakeviacmake -P(empty, absolute, relative, spaces, missing file, directory) plus CMakeLists wiring checks.Overlaps: #995 edits the same XMA2 block in
runtime/CMakeLists.txtandruntime/xma_decoder/README.md(opt-in flag for configure-time Cargo); the two changes are complementary and merge cleanly in either order.Tested
Arch Linux (
7.3.5-arch1-1),clang-cl23.1.5 +xwinSDK10.0.26100, CMake + Ninja, GCC 16.2.1, Wine 11.22 (Staging), Python 3.14:python3 -I scripts/check_no_game_data.py runtime/cmake/xma2_decoder.cmake runtime/CMakeLists.txt runtime/xma_decoder/README.md docs/linux.md tests/test_cmake_xma2_prebuilt.py: passpython3 -I tests/test_cmake_xma2_prebuilt.py -v: 7/7 passed (cmake -Pruns + CMakeLists wiring check)tests/test_text_write_line_endings.py,tests/test_cmake_vulkan_missing.py,tests/test_cmake_translator_deps.py,tests/test_acphal_abi.py,tests/test_ci_registration.py, and alltests/test_docs_*.py+tests/test_i18n_index.py: all passedcmake -S runtime -B ... -G Ninja) +ctest -R "^(root_signature|host_cpu)$": 2/2 passedclang-cl-xwin.cmake) with a stub failingcargo(exit 99) first onPATH:-DLEONIDA_XMA2_DECODER_LIB=/nonexistent/leonida_xma2_decoder.lib: configure failed withFATAL_ERRORnamingLEONIDA_XMA2_DECODER_LIB-DLEONIDA_XMA2_DECODER_LIB=<prebuilt leonida_xma2_decoder.lib> -DLEONIDA_REQUIRE_XMA2_DECODER=ON: configured in 1.5 s without invokingcargo, builtacphal_test.exeandgta6rt.execleanlywine acphal_test.exe: 170 checks, 0 failures (including non-silent Rust XMA2 PCM decode)GPUs tested: n/a (build-system and documentation change; audio/runtime link verified under Wine 11.22 on Arch Linux with RTX 3060 Ti driver 615.78.08)
AI-assisted: yes
Checklist
main(5a5df8e0b) and merges cleanly.CONTRIBUTING.md), including in logs or reports quoted here.docs/design.mdcontract table n/a).@aslan2142 on GitHub · 2026-11-25 02:00 UTC · original
Merged. Thanks, @madhyn: this is a useful escape hatch for cross-builds, and the cargo path is unchanged when the option is unset.
BUILD-XMA2-PREBUILT-LIBwas posted at 01:40 UTC, three minutes before this PR, and is unedited. Nobody else claimed a prebuilt decoder.46e078824): configure checks only that the file exists, not which source, version or target it was built from, soruntime/xma_decoder/README.mdnow says to build the library yourself from this checkout, gives thecargo build ... --release --locked --target x86_64-pc-windows-msvccommand and where the library lands, and says that with the option set CMake no longer rebuilds the decoder after source changes.docs/linux.mdpoints to it.-Dis made absolute by CMake against the directory it runs in, so the build-folder resolution in the helper only applies to values set some other way. The README now says to pass an absolute path.CMakeCache.txtare identical tomain's;cargoplaced first onPATHwas never called, andacphal_testlinked against the library;tests/test_cmake_xma2_prebuilt.pypasses 7 of 7 (and fails 7 of 7 onmain's tree); the docs tests,test_text_write_line_endings,test_ci_registrationandcheck_no_game_data.pyon the changed files pass.runtime/CMakeLists.txtandruntime/xma_decoder/README.md, so it now needs a merge ofmain; the two don't merge cleanly in either order.AI-assisted (Claude Code, Claude Opus 5.5).