test: support sccache for pytest builds#1610
Merged
Conversation
Replace USE_CCACHE=1 with USE_SCCACHE=1 as the compiler launcher for pytest builds. sccache works on all platforms including Windows, making ccache redundant. On Windows, this automatically switches to the Ninja generator (VS generator doesn't support compiler launchers) and uses /Z7 debug info format via CMP0141 policy (sccache can't handle /Zi shared PDBs). Cache stats are printed at the end of the pytest session. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
`append("-G Ninja")` passed the flag and value as a single argv entry,
causing CMake to look for a generator named " Ninja" (with leading space).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a new CI matrix entry that builds with Ninja and sccache on Windows. This requires setting up the MSVC environment via vcvarsall.bat since Ninja doesn't auto-detect it like the Visual Studio generator does. The sccache cache is persisted across CI runs using actions/cache. Also fix install-zlib.ps1 to preserve existing CMAKE_DEFINES. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mujacica
approved these changes
Mar 31, 2026
jpnurmi
added a commit
that referenced
this pull request
Apr 9, 2026
3442a21 (#1610) added CMP0141 NEW for sccache support. This policy defaults CMAKE_MSVC_DEBUG_INFORMATION_FORMAT to ProgramDatabase (/Zi) for Debug and RelWithDebInfo configurations: https://cmake.org/cmake/help/latest/policy/CMP0141.html This causes static libraries to reference an external PDB. Since static libraries are distributed without a PDB, consumers get LNK4099 warnings when linking, which breaks builds using MSBuildTreatWarningsAsErrors or TreatWarningsAsErrors. Set the MSVC_DEBUG_INFORMATION_FORMAT target property to Embedded (/Z7) for static builds so debug types are embedded directly in the .obj files and no external PDB is needed.
This was referenced Apr 9, 2026
jpnurmi
added a commit
that referenced
this pull request
Apr 9, 2026
3442a21 (#1610) added CMP0141 NEW for sccache support. This policy defaults CMAKE_MSVC_DEBUG_INFORMATION_FORMAT to ProgramDatabase (/Zi) for Debug and RelWithDebInfo configurations: https://cmake.org/cmake/help/latest/policy/CMP0141.html This causes static libraries to reference an external PDB. Since static libraries are distributed without a PDB, consumers get LNK4099 warnings when linking, which breaks builds using MSBuildTreatWarningsAsErrors or TreatWarningsAsErrors. Set the MSVC_DEBUG_INFORMATION_FORMAT target property to Embedded (/Z7) for static builds so debug types are embedded directly in the .obj files and no external PDB is needed.
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.

In the series of making it more pleasant to work on Windows, replace the previously undocumented
ccachesupport with Windows-compatiblesccacheas the compilation cache for pytest builds, and document it inCONTRIBUTING.md.sccache works on all platforms including Windows, making ccache redundant (added in #1529, was it used by anyone else?). On Windows,
USE_SCCACHE=1automatically switches to the Ninja generator (VS generator doesn't support compiler launchers) and uses/Z7debug info format viaCMP0141policy (sccache can't handle/Zishared PDBs).YMMV, but on my old dedicated Windows laptop (Surface 4), this cuts the full pytest run from roughly 14-15 minutes to somewhere around 11-12 minutes:
pytest -v tests
And in the CI (Note: these can vary a lot depending on the time of day):