Skip to content

Add Ninja build support for precompiled headers - #5299

Merged
randombit merged 2 commits into
jack/precompiled-headersfrom
copilot/sub-pr-5298
Feb 8, 2026
Merged

Add Ninja build support for precompiled headers#5299
randombit merged 2 commits into
jack/precompiled-headersfrom
copilot/sub-pr-5298

Conversation

Copilot AI commented Feb 8, 2026

Copy link
Copy Markdown

Adds PCH support to the Ninja build system, matching the existing Makefile implementation.

Changes

  • configure.py: Added pch_target variable that evaluates to "pch" when enabled, empty string otherwise. Enables conditional order-only dependencies in Ninja without nested conditionals.

  • ninja.in:

    • Added compile_pch_lib and compile_pch_exe rules for compiling separate PCH files for library vs executables/tests
    • Added build targets for pch_lib.h.{gch|pch} and pch_exe.h.{gch|pch}
    • Added phony pch target alias
    • Injected %{pch_include_for_lib} and %{pch_include_for_exe} flags into compilation rules
    • Added order-only dependency | %{pch_target} to all object file builds

When PCH is disabled, the include flags and target variable expand to empty strings, maintaining backward compatibility.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: randombit <469092+randombit@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for precompiled headers Add Ninja build support for precompiled headers Feb 8, 2026
Copilot AI requested a review from randombit February 8, 2026 16:59
@randombit
randombit marked this pull request as ready for review February 8, 2026 17:39
@randombit
randombit merged commit 4c9547c into jack/precompiled-headers Feb 8, 2026
@randombit
randombit deleted the copilot/sub-pr-5298 branch February 8, 2026 17:39
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.

2 participants