add ccache support for custom toolchain (#180737)

Add ccache support when building the engine using a custom toolchain.

Fixes #180736

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
This commit is contained in:
Andrew Marshall 2026-01-30 17:19:13 +00:00 committed by GitHub
parent f94d0cb3b2
commit ae0fe0d05c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,15 +3,20 @@
# found in the LICENSE file.
import("//build/toolchain/custom/custom.gni")
import("//build/toolchain/ccache.gni")
toolchain("custom") {
toolchain_bin = "${custom_toolchain}/bin"
compiler_prefix = ""
if (use_ccache) {
compiler_prefix = "ccache "
}
# We can't do string interpolation ($ in strings) on things with dots in
# them. To allow us to use $cc below, for example, we create copies of
# these values in our scope.
cc = "${toolchain_bin}/clang"
cxx = "${toolchain_bin}/clang++"
cc = "${compiler_prefix}${toolchain_bin}/clang"
cxx = "${compiler_prefix}${toolchain_bin}/clang++"
ar = "${toolchain_bin}/${custom_target_triple}-ar"
ld = "${toolchain_bin}/clang++"
readelf = "${toolchain_bin}/${custom_target_triple}-readelf"