build: PCH + ccache launcher + fast-linker autodetect#6
Merged
Conversation
Three build-time levers, all guarded/no-op where tooling is absent: - PCH on lci_lib for the heaviest, most widely-included headers — nlohmann/json (~25k lines, 26 TUs) and absl flat_hash_map (39 TUs) plus ubiquitous std headers (<string> 134 TUs, <vector> 100). Parsed once instead of per-TU; the largest clean-build compile-time win for the 95-TU library. - ccache as CMAKE_CXX/C_COMPILER_LAUNCHER when installed, set before project(). Automatic for local dev builds (CI already passed it explicitly; guarded by NOT DEFINED so the CI override wins). - Fast linker autodetect: mold > lld via find_program, add_link_options -fuse-ld=...; no-op if neither present or on MSVC. Speeds the link of `lci` and the monolithic lci_tests (~1700 tests + all deps). lci_lib + lci_tests build clean with the PCH; full suite 1692/1692 green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mach-O has no mold support and Apple's ld64 is fine; guard the -fuse-ld override with NOT APPLE so the macOS leg keeps its default linker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build-time optimizations identified from the actual build profile. All guarded / no-op where tooling is absent.
Changes
lci_lib— the heaviest widely-included headers parsed once instead of per-TU:nlohmann/json.hpp(~25k lines, 26 TUs),absl/container/flat_hash_map.h(39 TUs), plus ubiquitous std (<string>134,<vector>100). Largest clean-build compile win for the 95-TU library.project()when installed; automatic for local dev (CI already passed it explicitly;NOT DEFINEDguard lets the CI override win).mold>lldviafind_program+-fuse-ld=; no-op if absent or MSVC. Speeds linkinglci+ the monolithiclci_tests.Verification
lci_lib+lci_testsbuild clean with PCH (a broken PCH fails the build).Follow-ups (not here, need more care): unity build for lci_lib, splitting lci_tests, and the vcpkg setup reliability/pre-bake that caused the recent Windows runner hang.
🤖 Generated with Claude Code