Build the title HUD test only with Vulkan headers #2311

Open
github-bot wants to merge 1 commit from github-bot/gh-2311 into main AGit
Owner

@⁠ZroIsHere on GitHub · 2026-11-26 13:44 UTC · original
ZroIsHere:fix/cmake-title-hud-vulkan-optional → main · +12 −9 · 1 files · 1 commits · draft

title_hud_test includes Vulkan memory-budget types, but CMake declared it before creating Vulkan::Headers and linked it unconditionally. On Windows without Vulkan headers, configuration warned that Vulkan components would be omitted and then failed because the target did not exist.

Move the HUD test declaration under the existing if(TARGET Vulkan::Headers) guard. The standalone runtime can now configure and build without Vulkan headers; the HUD test remains available when those headers are installed or fetched.

Validation: CMake configuration and the gta6rt RelWithDebInfo build passed on Windows/MSVC without Vulkan headers. No tests were run.

**@⁠ZroIsHere** on GitHub · 2026-11-26 13:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2311) `ZroIsHere:fix/cmake-title-hud-vulkan-optional` → `main` · +12 −9 · 1 files · 1 commits · draft `title_hud_test` includes Vulkan memory-budget types, but CMake declared it before creating `Vulkan::Headers` and linked it unconditionally. On Windows without Vulkan headers, configuration warned that Vulkan components would be omitted and then failed because the target did not exist. Move the HUD test declaration under the existing `if(TARGET Vulkan::Headers)` guard. The standalone runtime can now configure and build without Vulkan headers; the HUD test remains available when those headers are installed or fetched. Validation: CMake configuration and the `gta6rt` RelWithDebInfo build passed on Windows/MSVC without Vulkan headers. No tests were run.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:44:35 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-26 17:57 UTC · original · reviewed

Built and ran title_hud with Vulkan headers enabled on Windows 11. CTest passed. In a separate BUILD_TESTING=OFF configure, the PR generated a HUD test target and the baseline CMake did not. Details inline.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-26 17:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2311#pullrequestreview-6078689104) · **reviewed** Built and ran `title_hud` with Vulkan headers enabled on Windows 11. CTest passed. In a separate `BUILD_TESTING=OFF` configure, the PR generated a HUD test target and the baseline CMake did not. Details inline. AI-assisted.
@ -1893,6 +1884,18 @@ if(NOT TARGET Vulkan::Headers)
endif()
endif()
if(TARGET Vulkan::Headers)
if(WIN32)
Author
Owner

@⁠lixonik on GitHub · 2026-11-26 17:57 UTC · original

[P2] Keep the HUD target behind BUILD_TESTING as well as Vulkan availability.

With Vulkan headers present and -DBUILD_TESTING=OFF, the branch generates title_hud_test.exe in Ninja's default build. The baseline CMake under the same options generates no HUD test target. This moved the executable outside its old BUILD_TESTING block. if(WIN32 AND BUILD_TESTING) would preserve the non-test build behavior.

**@⁠lixonik** on GitHub · 2026-11-26 17:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2311#discussion_r4711969307) [P2] Keep the HUD target behind `BUILD_TESTING` as well as Vulkan availability. With Vulkan headers present and `-DBUILD_TESTING=OFF`, the branch generates `title_hud_test.exe` in Ninja's default build. The baseline CMake under the same options generates no HUD test target. This moved the executable outside its old `BUILD_TESTING` block. `if(WIN32 AND BUILD_TESTING)` would preserve the non-test build behavior.
Author
Owner

@⁠wavehs on GitHub · 2026-11-26 19:46 UTC · original · reviewed

macOS arm64 check of #2311 (title HUD test behind Vulkan::Headers). A CMake-only change; the Windows configure failure it fixes cannot be reproduced here, so this is a static review plus the two macOS configures.

Tested head 24abeaa11 merged onto main bdbc7e923 as merge 42eb12948 (clean, no conflicts).

Environment: Apple M3 Pro arm64, macOS 27.2.1, CMake 4.5.0, Vulkan-Headers 1.4.363.0 (/opt/homebrew/include).

What I could run

  • Configure with Vulkan headers (the normal case): cmake -S runtime -B /tmp/b2311v -DCMAKE_BUILD_TYPE=RelWithDebInfo succeeds, and the reordered if(TARGET Vulkan::Headers) block still defines the Vulkan tests (vulkan_device_fault_test, vulkan_device_markers_test, the vk_* tools) - the move did not accidentally take them out of the guard.
  • Configure with Vulkan headers deliberately unavailable (-DCMAKE_DISABLE_FIND_PACKAGE_Vulkan=ON -DCMAKE_IGNORE_PATH=/opt/homebrew/include -DCMAKE_IGNORE_PREFIX_PATH=/opt/homebrew -DBUILD_TESTING=OFF): succeeds with the existing warning, title_hud_test is not defined, and spirv_capability_test (the one test that documents itself as needing no Vulkan header) still builds. On macOS the old code also skipped title_hud_test because of the if(WIN32) around it, so this configure does not distinguish main from the fix - the failure the PR describes is a Windows one (target_link_libraries(... Vulkan::Headers ...) before that imported target exists) and cannot be reproduced without MSVC/Wine. I am taking the runtime behaviour on Windows from the PR's report, not from a run of my own; the CMake ordering itself is right (the block is now after find_package/the find_path fallback at runtime/CMakeLists.txt:1938-1961).
  • python -I tests/test_ctest_registration.py: still OK (no test target lost its add_test).

Finding: the moved block is no longer inside if(BUILD_TESTING)
The old declaration sat inside the big if(BUILD_TESTING) that closes at runtime/CMakeLists.txt:1902 (and inside its if(WIN32)). The new one is at :1960-1971, inside if(TARGET Vulkan::Headers) only. So on Windows with Vulkan headers and -DBUILD_TESTING=OFF, title_hud_test is now compiled and linked (user32/psapi), and add_test(NAME title_hud ...) is issued with testing disabled - a target that used to disappear with the tests now costs build time in a testless build, which is precisely the property the surrounding block was keeping. The guard should be if(BUILD_TESTING AND WIN32) (or the if(WIN32) block wrapped in if(BUILD_TESTING)) inside the TARGET Vulkan::Headers check. This is the only regression I can see in the reorder; the no-Vulkan Windows fix itself reads correctly.

Nits

  • The comment "The HUD test exercises the Vulkan memory-budget formatter with synthetic data (no GPU needed)" is accurate but the test also links user32/psapi, so "no GPU" is not "portable": it stays Windows-only, which the WIN32 guard says.
  • title_hud_test was not run by either side here (it needs user32/psapi), so the PR's "No tests were run" is the honest state; nothing in the move changes what the test compiles against.

Not run: a Windows/MSVC configure without Vulkan headers (the actual bug), title_hud_test itself, and the full runtime build.

python -I scripts/check_no_game_data.py runtime/CMakeLists.txt: clean.

No game files. AI-assisted.

**@⁠wavehs** on GitHub · 2026-11-26 19:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2311#pullrequestreview-6079728065) · **reviewed** **macOS arm64 check of #2311** (title HUD test behind `Vulkan::Headers`). A CMake-only change; the Windows configure failure it fixes cannot be reproduced here, so this is a static review plus the two macOS configures. Tested head `24abeaa11` merged onto `main` `bdbc7e923` as merge `42eb12948` (clean, no conflicts). Environment: Apple M3 Pro arm64, macOS 27.2.1, CMake 4.5.0, Vulkan-Headers 1.4.363.0 (`/opt/homebrew/include`). **What I could run** - Configure with Vulkan headers (the normal case): `cmake -S runtime -B /tmp/b2311v -DCMAKE_BUILD_TYPE=RelWithDebInfo` succeeds, and the reordered `if(TARGET Vulkan::Headers)` block still defines the Vulkan tests (`vulkan_device_fault_test`, `vulkan_device_markers_test`, the `vk_*` tools) - the move did not accidentally take them out of the guard. - Configure with Vulkan headers deliberately unavailable (`-DCMAKE_DISABLE_FIND_PACKAGE_Vulkan=ON -DCMAKE_IGNORE_PATH=/opt/homebrew/include -DCMAKE_IGNORE_PREFIX_PATH=/opt/homebrew -DBUILD_TESTING=OFF`): succeeds with the existing warning, `title_hud_test` is not defined, and `spirv_capability_test` (the one test that documents itself as needing no Vulkan header) still builds. On macOS the old code also skipped `title_hud_test` because of the `if(WIN32)` around it, so this configure does **not** distinguish main from the fix - the failure the PR describes is a Windows one (`target_link_libraries(... Vulkan::Headers ...)` before that imported target exists) and cannot be reproduced without MSVC/Wine. I am taking the runtime behaviour on Windows from the PR's report, not from a run of my own; the CMake ordering itself is right (the block is now after `find_package`/the `find_path` fallback at `runtime/CMakeLists.txt:1938-1961`). - `python -I tests/test_ctest_registration.py`: still OK (no test target lost its `add_test`). **Finding: the moved block is no longer inside `if(BUILD_TESTING)`** The old declaration sat inside the big `if(BUILD_TESTING)` that closes at `runtime/CMakeLists.txt:1902` (and inside its `if(WIN32)`). The new one is at `:1960-1971`, inside `if(TARGET Vulkan::Headers)` only. So on Windows with Vulkan headers and `-DBUILD_TESTING=OFF`, `title_hud_test` is now compiled and linked (user32/psapi), and `add_test(NAME title_hud ...)` is issued with testing disabled - a target that used to disappear with the tests now costs build time in a testless build, which is precisely the property the surrounding block was keeping. The guard should be `if(BUILD_TESTING AND WIN32)` (or the `if(WIN32)` block wrapped in `if(BUILD_TESTING)`) inside the `TARGET Vulkan::Headers` check. This is the only regression I can see in the reorder; the no-Vulkan Windows fix itself reads correctly. **Nits** - The comment "The HUD test exercises the Vulkan memory-budget formatter with synthetic data (no GPU needed)" is accurate but the test also links `user32`/`psapi`, so "no GPU" is not "portable": it stays Windows-only, which the `WIN32` guard says. - `title_hud_test` was not run by either side here (it needs user32/psapi), so the PR's "No tests were run" is the honest state; nothing in the move changes what the test compiles against. **Not run**: a Windows/MSVC configure without Vulkan headers (the actual bug), `title_hud_test` itself, and the full runtime build. `python -I scripts/check_no_game_data.py runtime/CMakeLists.txt`: clean. No game files. AI-assisted.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2311/head:github-bot/gh-2311'
git switch 'github-bot/gh-2311'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2311'
git switch 'github-bot/gh-2311'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2311'
git switch 'github-bot/gh-2311'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2311'
git switch 'main'
git merge --squash 'github-bot/gh-2311'
git switch 'main'
git merge --ff-only 'github-bot/gh-2311'
git switch 'main'
git merge 'github-bot/gh-2311'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.