build: compile four checks' shared sources once #1938
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1945"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:58:50Z.
Build-time only. No target, CTest name, source file or test behavior changes.
What
Four sources were compiled once per executable that links them, with the same C++ standard, include directories (same order), definitions and runtime. Each is now an
OBJECTlibrary whose objects the executables take with$<TARGET_OBJECTS:...>, the pattern the file already uses forera_physical_lenient.tests/d3d12x_device_check.cppd3d12x_device_check,d3d12x_device_struct_return_controltests/startup_stream_setup.cppstartup_stream_consumer,startup_stream_depthsrc/startup_stubs/audio_sink.cppstartup_audio_output,startup_audio_pacingtests/desktop_gpu.cppd3d12x_compute_list_check,d3d12x_graphics_list_checkFour compiles fewer in each configuration, out of about 800. The saving is a few seconds of compiler time at most (D3D12, DXGI and WASAPI headers are the cost). I did not measure it, and I am not claiming a wall-clock number.
What I left alone, and why
tests/desktop_gpu.cppinstartup_dump_fence_check,startup_nv12_drawandstartup_plane_refreshwould save two more compiles. Their lines sit next to additions in #1641 and #1806, which conflicted when I tried it, so they are unchanged.src/startup_stubs/d3d12_xs_device.cppis in #1752.xmem_shim,d3d12_xs_shim,cpu_*providers, the archive codec) get a different<target>_EXPORTSdefinition per target, so their command lines are not identical.startup_gamesave_lock_errors_keep,cpu_startup_exe_*,xmem_shim_test_controls,d3d12_xs_rangewith different include directories) are not shared.Checks
git merge-treeof this branch against all 88 open PRs that touchCMakeLists.txt, and against #1740. For every PR the set of conflicting files and the number of conflict hunks inCMakeLists.txtmatch what the same PR already has againstorigin/mainalone (56 merge cleanly, 32 already conflict withmain). No new conflict, including #1173, #1752 and #1789. The PRs that edittests/startup_stream_setup.cpportests/desktop_gpu.h(#1808, #1726, #1779, #1568, #713) change source content only, not compile flags.$<TARGET_OBJECTS:...>in executables, same include-directory order) configured and built with CMake 3.31 and Ninja on Linux: 24 compiles before this change, 20 after, all 11 executables link. The Ninja compile lines for each shared source were identical across their targets before the change.git diff --check origin/main...HEAD,python3 -B tests/docs_links_check.pyandpython3 -B tests/bidi_controls_check.pypass.Not verified
OBJECTlibrary's own; I expect no difference but have not seen it on MSVC.AI-assisted; commands listed were executed locally.
Replaces closed draft #1814 (rebased cleanly on origin/main).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:01:54Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
b464076ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T22:09:56Z.
Built it: one compile per shared source, identical flags, tests unchanged
Windows 11 build 26300.9974, MSVC 19.44,
devpreset:Three sources, three objects, three consumers each — the compile-once claim holds on a clean build.
The claim that matters most is machine-checkable, so I checked it
"same C++ standard, include directories (same order), definitions and runtime" is the condition that makes sharing safe, and a
/MTdobject linked into an/MDdexecutable would be a real defect. From the generatedbuild.ninja:Byte-for-byte the same, including the runtime (
-MDd) and the standard (-std:c++17).Tests
d3d12x_device_*did not run for me: those CTest entries point at executables I did not build(
d3d12x_device_slots_check.exe), so ctest reports "could not find executable" — my build selection, not the PR.One thing worth saying in the description
The table lists three sources but four library names would be expected; I only verified three (
d3d12x_device_check_obj,startup_stream_setup_obj,startup_audio_sink_obj). If the fourth row isera_physical_lenient(a pre-existing pattern, not anew one) then the table is consistent and the heading "four checks' shared sources" refers to the checks, not the sources — the
wording reads either way, and it took me a second pass to be sure.
Verdict
Reviewed. Build-only, no behaviour change, one compile per source on a clean build, and the flag-identity that makes it safe is
verifiable and verified.
Notes
upstream-sync referenced this pull request2026-11-25 00:04:55 +00:00