cmake: wire up fastcache-cc / sccache / ccache compiler-cache selection - #125
Merged
Conversation
Vendors cmake/CompileCache.cmake from LASTRADA-Software/fastcached (self-contained, no dependency on that project) and includes it before any fetched dependency, so both morph's own targets and the FetchContent-fetched glaze get compiler-cache coverage. Selection order: fastcache-cc when a fastcached daemon answers (probed end-to-end with a throwaway translation unit, not just presence on PATH), else sccache, else ccache, else no cache. Off entirely with -DUSE_COMPILER_CACHE=OFF; the daemon address defaults to 127.0.0.1:6674 and is overridable via FASTCACHE_ADDR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Vendors
cmake/CompileCache.cmakefrom LASTRADA-Software/fastcached — a self-contained module with no dependency on that project, meant to be dropped into any CMake project'scmake/directory (seecmake/portable/README.mdthere).What it does
Selects a compiler-cache launcher in preference order, wired via
CMAKE_<LANG>_COMPILER_LAUNCHER:fastcache-cc— used only when afastcacheddaemon actually answers. This is verified end-to-end at configure time by compiling a throwaway translation unit through the launcher and requiring a reportedHIT/MISS, not just presence onPATH(a launcher that can't reach its daemon still compiles fine, silently paying a failed connect per TU otherwise). Address defaults to127.0.0.1:6674, overridable viaFASTCACHE_ADDR.sccache— used whenfastcache-ccis unavailable/unconfigured.ccache— the local fallback.-DUSE_COMPILER_CACHE=OFF.include(cmake/CompileCache.cmake)is placed right aftercompiler_options.cmake, before theFetchContent-fetchedglazedependency, so that gets cached too.Why fastcache-cc is preferred over sccache
fastcache-ccisn't just "another sccache" — when it's selected, the compile cache is served over fastcached's own dedicated0xFCbinary wire protocol (CompileCacheWire/CompileCacheHandler), purpose-built for this job: canonicalize-on-store / serve-canonical-on-fetch, cohort-based leading-key prefetch, and a framing that lets a rejection be a reply instead of a silent connection drop. sccache talks a generic key/value protocol against whatever backend (Redis, S3, ...) it's pointed at — it works, but it isn't using our protocol. We want our own protocol used whenever afastcacheddaemon is available, and this preference order is how that's expressed: tryfastcache-ccfirst, fall back only when it can't be used.Both launchers are portable across checkout paths (unlike raw
ccachein some configurations), so a CI runner and a developer working from different directories can share cache hits. This has no effect on a machine with nothing installed — it's a pure opt-in speedup when a cache is available.🤖 Generated with Claude Code