Files
mandy/runtime/cmake/vulkan_headers_missing.cmake
skankhunt42 90f399e953 Runtime: warn loudly (or fail) when CMake finds no Vulkan headers
Without Vulkan headers everything under if(TARGET Vulkan::Headers) is left
out: the D3D12 COM objects, the Vulkan D3D12 device in gta6rt
(LEONIDA_D3D12=vulkan) and most of ctest. The only output was a STATUS line
naming four test tools, so a build whose VULKAN_SDK never reached CMake ran
45 of 125 tests and reported "100% tests passed".

- runtime/cmake/vulkan_headers_missing.cmake: a WARNING that names what is
  left out and that CMakeCache.txt keeps the failed lookup.
- LEONIDA_REQUIRE_VULKAN=ON turns it into a configure error; both CI
  configures pass it, and scripts/build_runtime.ps1 does when VULKAN_SDK is set.
- tests/test_cmake_vulkan_missing.py runs the module with cmake -P and checks
  that CMakeLists.txt and CI use it; docs/testing.md gets a troubleshooting row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:41:47 +01:00

22 lines
1.5 KiB
CMake

# Reports a configure without Vulkan headers. Everything under if(TARGET Vulkan::Headers) in runtime/CMakeLists.txt
# is then left out: not only the GPU test tools but the D3D12 COM objects and the Vulkan D3D12 device in gta6rt
# (LEONIDA_D3D12=vulkan), and with them most of ctest. A STATUS line was easy to miss: ctest then reports
# "100% tests passed" on a fraction of the suite. -DLEONIDA_REQUIRE_VULKAN=ON makes it a configure error (CI sets it).
# Kept in its own file so tests/test_cmake_vulkan_missing.py can run it with `cmake -P`.
function(leonida_vulkan_headers_missing)
set(text
"Vulkan headers not found, so this build leaves out the Vulkan D3D12 device in gta6rt (LEONIDA_D3D12=vulkan "
"is unavailable), the D3D12 COM objects and their tests, the D3D12 layer and GPU tests, the GPU test tools "
"(run_gpu_tests.py needs them), vk_pipeline_check, d3d12_state_map_test and gfx10_descriptors_test. ctest "
"then runs only the CPU tests and can still report 100% passed. Set VULKAN_SDK in the environment that runs "
"CMake (then delete CMakeCache.txt, which keeps the failed lookup), install the Vulkan headers, or pass "
"-DLEONIDA_VULKAN_HEADERS_FETCH=ON to download the pinned Khronos Vulkan-Headers release. "
"-DLEONIDA_REQUIRE_VULKAN=ON turns this warning into an error.")
string(CONCAT text ${text})
if(LEONIDA_REQUIRE_VULKAN)
message(FATAL_ERROR "${text}")
else()
message(WARNING "${text}")
endif()
endfunction()