Files
CoopAllTheThings/third_party/CMakeLists.txt
BlackMark 49daa1d81f M2(Vulkan): Vulkan mock-game backend + volk/Vulkan-Headers submodules
Add render_vk.cpp (selectable as `vk`): brings up a real Vulkan
instance/device/swap chain via volk (which dlopens vulkan-1.dll -- the
loader-bypass case the capture hook must handle) and clears the swap-chain image
to the frame-counter colour each frame with vkCmdClearColorImage (no pipeline,
no shaders, no SPIR-V) and presents. The whole image encodes the frame number,
so it animates and stale frames are detectable.

Adds the official Khronos Vulkan-Headers + zeux/volk submodules and a
coop_require_submodule() CMake helper that fails with a clear "git submodule
update --init --recursive" message rather than auto-cloning. volk is pinned to
the project's dynamic CRT (no LNK4098).

mock_game_test gets a vk liveness check (its present pointer is cached at init,
so late injection can't hook it -- the capture path needs the early-load path,
to come). 16/16 ctest, skips cleanly without a Vulkan driver.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 12:12:55 +02:00

44 lines
1.7 KiB
CMake

# Dear ImGui built as a static lib with the Win32 + DX11 backends the host uses.
add_library(imgui STATIC
imgui/imgui.cpp
imgui/imgui_draw.cpp
imgui/imgui_tables.cpp
imgui/imgui_widgets.cpp
imgui/imgui_demo.cpp
imgui/backends/imgui_impl_win32.cpp
imgui/backends/imgui_impl_dx11.cpp)
target_include_directories(imgui PUBLIC
imgui
imgui/backends)
# ImGui's own sources are third-party; don't subject them to /W4.
if(MSVC)
target_compile_options(imgui PRIVATE /W0)
endif()
target_link_libraries(imgui PUBLIC d3d11 dxgi dwmapi)
# --- Vulkan: official Khronos headers + volk meta-loader (submodules) -------
# volk dynamically loads vulkan-1.dll at runtime (no link-time loader lib, no SDK install),
# so the Vulkan mock backend + capture hook need only these two submodules.
coop_require_submodule("Vulkan-Headers" "third_party/Vulkan-Headers/include/vulkan/vulkan.h")
coop_require_submodule("volk" "third_party/volk/volk.h")
add_library(vulkan_headers INTERFACE)
target_include_directories(vulkan_headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include)
add_library(volk STATIC volk/volk.c)
target_include_directories(volk PUBLIC volk)
target_link_libraries(volk PUBLIC vulkan_headers)
# VK_NO_PROTOTYPES: volk provides the entry points itself (no link to a loader lib).
target_compile_definitions(volk PUBLIC VK_NO_PROTOTYPES)
if(WIN32)
target_compile_definitions(volk PUBLIC VK_USE_PLATFORM_WIN32_KHR)
endif()
if(MSVC)
target_compile_options(volk PRIVATE /W0) # third-party source
# Match the rest of the project's CRT (dynamic) so it doesn't drag in LIBCMT (LNK4098).
set_target_properties(volk PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()