Skip to content

Cache Windows compilations with sccache - #899

Draft
mjcarroll wants to merge 2 commits into
masterfrom
mjcarroll/windows-compiler-cache-v2
Draft

mjcarroll wants to merge 2 commits into
masterfrom
mjcarroll/windows-compiler-cache-v2

Conversation

@mjcarroll

@mjcarroll mjcarroll commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Description

Run Windows compilations through sccache. Stacked on #900.

  • CMAKE_C_COMPILER_LAUNCHER, CMAKE_CXX_COMPILER_LAUNCHER and RUSTC_WRAPPER are exported rather than passed as -D, so they reach ament_vendor sub-builds too.
  • CMAKE_TRY_COMPILE_CONFIGURATION=Release, since sccache can't cache Debug's /Zi.
  • The cache is .sccache in the Jenkins workspace: it persists between builds and is separate per job.
  • sccache --show-stats is printed before and after the build.

Blocked on ros2/ros2#1854, and on gazebosim/gz-cmake#586: gz_math_vendor and gz_utils_vendor hardcode /Zi, which fails to compile under sccache.

Is this user-facing behavior change?

No

Did you use Generative AI?

Yes, Claude Code (Claude Opus 5).

Additional Information

@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-compiler-cache-v2 branch from 2b22f6f to c49f32d Compare September 9, 2026 21:45
@mjcarroll
mjcarroll changed the base branch from master to mjcarroll/windows-ninja September 9, 2026 21:46
@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-ninja branch from fb3ad92 to 70e12c9 Compare September 9, 2026 21:57
@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-compiler-cache-v2 branch from c49f32d to a929858 Compare September 9, 2026 21:57
@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-ninja branch from 70e12c9 to 224ba3b Compare September 14, 2026 21:08
@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-compiler-cache-v2 branch from a929858 to 77c9598 Compare September 14, 2026 21:08
@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-ninja branch from 224ba3b to c1790f5 Compare September 23, 2026 20:24
@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-compiler-cache-v2 branch from 77c9598 to 255403b Compare September 23, 2026 20:24
CMake ignores CMAKE_<LANG>_COMPILER_LAUNCHER under the Visual Studio
generator, so this is needed before Windows CI can use a compiler cache.

Ninja is single-config, so default CMAKE_BUILD_TYPE to Release when it
is unset, matching the previous --config Release. Packaging jobs keep
the Visual Studio generator.

Ninja's object paths are longer and overrun MAX_PATH on some rosidl
sources, so subst the workspace onto W:.

ninja comes from the buildfarm environment in ros2/ros2#1854.

Signed-off-by: Michael Carroll <mjcarroll.oss@gmail.com>
Assisted-by: Claude Code (Claude Opus 5)
Export CMAKE_C_COMPILER_LAUNCHER, CMAKE_CXX_COMPILER_LAUNCHER and
RUSTC_WRAPPER instead of passing -D, so they also reach ament_vendor
sub-builds, which only forward an allow-list of CMake variables.
try_compile() defaults to Debug, whose /Zi sccache can't cache, so build
it as Release.

The cache lives in .sccache in the Jenkins workspace, which persists
between builds and is separate per job.

sccache comes from the buildfarm environment in ros2/ros2#1854.

Signed-off-by: Michael Carroll <mjcarroll.oss@gmail.com>
Assisted-by: Claude Code (Claude Opus 5)
@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-ninja branch from c1790f5 to eff50b4 Compare September 28, 2026 19:38
@mjcarroll
mjcarroll force-pushed the mjcarroll/windows-compiler-cache-v2 branch from 255403b to 4474e24 Compare September 28, 2026 19:38
Base automatically changed from mjcarroll/windows-ninja to master September 30, 2026 12:58
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