Skip to content

Commit

Permalink
Add support for using sccache on Unix (#76889)
Browse files Browse the repository at this point in the history
* Add support for using sccache on Unix

sccache (https://github.com/mozilla/sccache) is a compiler
caching tool that supports local or remote storage. It's
useful in /runtime for caching the results of the C++ components of
the build.

This PR adds support for dotnet/runtime by recognizing a =true
environment variable, which then instructs CMake to look for a the
sccache binary in the PATH.
  • Loading branch information
agocke authored Oct 13, 2022
1 parent 546fad9 commit fc0e636
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/coreclr/build-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ if [[ "$__TargetArch" != "$__HostArch" ]]; then
__CMakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__TargetArch $__CMakeArgs"
fi

if [[ "$USE_SCCACHE" == "true" ]]; then
__CMakeArgs="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache $__CMakeArgs"
fi

eval "$__RepoRootDir/eng/native/version/copy_version_files.sh"

build_native "$__TargetOS" "$__HostArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs" "CoreCLR component"
Expand Down

0 comments on commit fc0e636

Please sign in to comment.