Skip to content

build: compile four checks' shared sources once - #1814

Closed
tedin7 wants to merge 1 commit into
R0Y00:mainfrom
tedin7:x2w-cmake-shared-objs
Closed

tedin7 wants to merge 1 commit into
R0Y00:mainfrom
tedin7:x2w-cmake-shared-objs

Conversation

@tedin7

@tedin7 tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

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 OBJECT library whose objects the executables take with $<TARGET_OBJECTS:...>, the pattern the file already uses for era_physical_lenient.

Source Executables that share it Lines Compiles saved
tests/d3d12x_device_check.cpp d3d12x_device_check, d3d12x_device_struct_return_control 712 1
tests/startup_stream_setup.cpp startup_stream_consumer, startup_stream_depth 300 1
src/startup_stubs/audio_sink.cpp startup_audio_output, startup_audio_pacing 168 1
tests/desktop_gpu.cpp d3d12x_compute_list_check, d3d12x_graphics_list_check 82 1

Four 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

Checks

Not verified

  • A real Windows configure and build (MSVC or clang-cl with Ninja), and the CTest run: I have no Windows toolchain. CI on Windows is the check. Per-config compiler options such as the debug-information flags are applied per target by CMake, so the shared objects take the OBJECT library's own; I expect no difference but have not seen it on MSVC.

AI-assisted; commands listed were executed locally.

tests/desktop_gpu.cpp (the two d3d12x list checks), src/startup_stubs/audio_sink.cpp,
tests/startup_stream_setup.cpp and tests/d3d12x_device_check.cpp were each compiled once per executable
that links them, with the same standard, include directories and definitions. They are now OBJECT
libraries whose objects the executables take with $<TARGET_OBJECTS:...>. No target, test or file name
changes; the shared-library and control variants that differ in definitions or runtime are left as
they are.

Four compiles fewer per configuration.
@tedin7

tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Closing this draft for now to help keep the open PR queue manageable; the branch stays preserved on the fork so it can be reopened once the queue clears.

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.

1 participant