Skip to content

Commit 1a1e0a6

Browse files
authored
Merge pull request #34096 from gottesmm/pr-e09fb1acb2d9141d06c4b2e42e33c6878c07b346
[build-toolchain] Add distcc like integration for using sccache.
2 parents 6a597d4 + e022a95 commit 1a1e0a6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

utils/build-toolchain

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ cd "$(dirname $0)/.." || exit
4545

4646
# Set defaults
4747
DISTCC_FLAG=
48+
SCCACHE_FLAG=
4849
DRY_RUN=
4950
BUNDLE_PREFIX=
5051
PRESET_FILE_FLAGS=
@@ -82,6 +83,15 @@ while [ $# -ne 0 ]; do
8283
;;
8384
--distcc)
8485
DISTCC_FLAG="--distcc"
86+
;;
87+
--sccache)
88+
SCCACHE=$(which sccache)
89+
if [[ -z "${SCCACHE}" ]]; then
90+
echo "Error! Asked to use sccache, but could not find sccache in PATH?!"
91+
usage
92+
exit 1
93+
fi
94+
SCCACHE_FLAG="--cmake-c-launcher=${SCCACHE} --cmake-cxx-launcher=${SCCACHE}"
8595
;;
8696
--preset-file)
8797
shift
@@ -140,8 +150,10 @@ SYMBOLS_PACKAGE="${RESULT_DIR}/${SYM_ARCHIVE}"
140150
DRY_RUN="${DRY_RUN}"
141151
DISTCC_FLAG="${DISTCC_FLAG}"
142152
PRESET_FILE_FLAGS="${PRESET_FILE_FLAGS}"
153+
SCCACHE_FLAG="${SCCACHE_FLAG}"
143154

144155
./utils/build-script ${DRY_RUN} ${DISTCC_FLAG} ${PRESET_FILE_FLAGS} \
156+
${SCCACHE_FLAG} \
145157
--preset="${PRESET_PREFIX}${SWIFT_PACKAGE}${PRESET_SUFFIX}" \
146158
install_destdir="${SWIFT_INSTALL_DIR}" \
147159
installable_package="${SWIFT_INSTALLABLE_PACKAGE}" \

0 commit comments

Comments
 (0)