Skip to content

Build the Windows runtime on Linux with clang-cl and xwin - #888

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
kmorales13:build/linux-cross-clang-cl
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
kmorales13:build/linux-cross-clang-cl

Conversation

@kmorales13

Copy link
Copy Markdown
Contributor

New BUILD item (claim): build the Windows runtime on Linux and run its tests under Wine or Proton.

What and why

Today gta6rt, its shims and their tests only build on Windows with Visual Studio. The Wine CI job (#747) and make_game.py --runtime-build (#768) both take a build made on a Windows machine. This lets a Linux contributor build and test the runtime locally:

  • runtime/cmake/clang-cl-xwin.cmake: a toolchain file for clang-cl + lld-link (LLVM 19+) against an MSVC CRT and Windows SDK laid out by xwin. ctest runs the tests through Wine, or Proton's wine, via CMAKE_CROSSCOMPILING_EMULATOR. llvm-ml64 stands in for ml64, so unimplemented_policy_test keeps its register-preservation check.
  • runtime/CMakeLists.txt: in a cross build, gen_d3d12_stubs.py gets the d3d12.h CMake finds (--header) instead of relying on INCLUDE. d3d12_trace names the interpreter by path, so ctest doesn't put the emulator in front of Python.
  • runtime/test/check_d3d12_trace.py: --runner starts the fixture through the emulator.
  • docs/testing.md: the build and the Wine and Proton runs.

The native Windows build is unchanged: the new branches only apply when CMAKE_CROSSCOMPILING is set, and "${Python3_EXECUTABLE}" is the same path as Python3::Interpreter. The plain Linux build (Vulkan tools only) is unchanged.

Tested

On main at 4a36bb1, CachyOS (Linux 7.3.5), AMD Ryzen 7 7700X iGPU (RDNA2, RADV, Mesa 26.3.1), clang-cl/LLD 23.1.5, CMake 4.5.1, xwin 0.10.0 (SDK 10.0.26100, CRT 14.44):

Result
Cross build 45 PE files, 0 errors
ctest, Wine 11.22 (fresh prefix) 28/32 pass
ctest, Proton Experimental 11.0 (vkd3d-proton + DXVK) 28/32 pass
Plain Linux build (runtime/build/linux) 11/11 pass

The failures are the tests that compare with the host D3D12 runtime: root_sig_test, root_sig, d3d12_vulkan_device, plus device_proxy under Wine (it passes on vkd3d-proton). Those are TEST-105 (#869). Under Proton, pe_loader_bounds also fails until #846 lands; its fix was in this branch too and was dropped because #846 had it first.

Not tested here: the native Windows MSVC build (no Windows machine); the CI on this PR covers it.

Related

AI-assisted (Claude-Opus).

runtime/cmake/clang-cl-xwin.cmake cross-compiles gta6rt, its shims and
tests with clang-cl and lld-link (LLVM 19+) against an MSVC CRT and
Windows SDK laid out by xwin, and makes ctest run them through Wine (or
Proton's wine). llvm-ml64 stands in for ml64, so the register-
preservation check in unimplemented_policy_test runs too.

Changes that let a cross build work without a Developer Prompt:
- gen_d3d12_stubs.py gets the d3d12.h CMake finds (--header) instead of
  relying on INCLUDE; without one the COM targets are skipped.
- d3d12_trace names the interpreter by path, so ctest doesn't prepend the
  emulator to Python, and check_d3d12_trace.py starts the fixture through
  the emulator (--runner).

docs/testing.md describes the build and the Wine and Proton runs.

@quackottu quackottu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 943e5f8 on NVIDIA GeForce RTX 5070, driver 621.24, Windows 11 Pro (26300), VS 2022 Build Tools, Vulkan SDK 1.4.363.0, with LEONIDA_VK_VALIDATION=1 and LEONIDA_D3D12=vulkan: pass

  • ctest -C RelWithDebInfo: 100% tests passed, 0 tests failed out of 32
  • 32 test programs in the build pass with 0 validation errors
  • d3d12_clear_test fails (R8G8B8A8_UNORM/SNORM 0.5 ties and a D16 clear byte differ from WARP) exactly as on main 4a36bb1 here, so not from this PR; #521 addresses it

Implicit Vulkan layers (overlays) were off through an empty VK_IMPLICIT_LAYER_PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants