@@ -17,6 +17,13 @@ declare_args() {
17
17
18
18
em_config_path = " $emsdk_dir /.emscripten"
19
19
20
+ if (use_ccache ) {
21
+ # ccache only supports compilation, not linking.
22
+ compiler_prefix = " ccache "
23
+ } else {
24
+ compiler_prefix = " "
25
+ }
26
+
20
27
template (" wasm_toolchain" ) {
21
28
gcc_toolchain (target_name ) {
22
29
extra_toolchain_args = {
@@ -27,9 +34,9 @@ template("wasm_toolchain") {
27
34
28
35
# emsdk_dir and em_config are defined in wasm.gni.
29
36
ar = " $emsdk_dir /upstream/emscripten/emar --em-config $em_config_path "
30
- cc = " $emsdk_dir /upstream/emscripten/emcc --em-config $em_config_path "
31
- cxx = " $emsdk_dir /upstream/emscripten/em++ --em-config $em_config_path "
32
- asm = cc
37
+ cc = " $compiler_prefix$ emsdk_dir /upstream/emscripten/emcc --em-config $em_config_path "
38
+ cxx = " $compiler_prefix$ emsdk_dir /upstream/emscripten/em++ --em-config $em_config_path "
39
+ asm = " $emsdk_dir /upstream/emscripten/emcc --em-config $em_config_path "
33
40
34
41
# emscripten emits this .worker.js file conditionally depending on whether
35
42
# pthreads are on or not. Unfortunately, there is no way to conditionally
@@ -39,7 +46,7 @@ template("wasm_toolchain") {
39
46
# dummy file. If the target does use pthreads, this dummy file will be
40
47
# overwritten. If the target does not, the dummy file will satisfy the
41
48
# toolchain's requirement that it has this as an output.
42
- ld = " $cxx "
49
+ ld = " $emsdk_dir /upstream/emscripten/em++ --em-config $em_config_path "
43
50
readelf = " readelf"
44
51
nm = " nm"
45
52
0 commit comments