@@ -173,12 +173,23 @@ def wasi_sdk_env(context):
173173 env = {"CC" : "clang" , "CPP" : "clang-cpp" , "CXX" : "clang++" ,
174174 "AR" : "llvm-ar" , "RANLIB" : "ranlib" }
175175
176+ # sccache available? wire it up!
177+ # used in GHA CI via .github/workflows/reusable-wasi.yaml
178+ if subprocess .call (["sccache" , "--version" ], stderr = subprocess .DEVNULL ) == 0 :
179+ env ["CC" ] = f'sccache { env ["CC" ]} '
180+ env ["CPP" ] = f'sccache { env ["CPP" ]} '
181+ env ["CXX" ] = f'sccache { env ["CXX" ]} '
182+
176183 for env_var , binary_name in list (env .items ()):
177184 env [env_var ] = os .fsdecode (wasi_sdk_path / "bin" / binary_name )
178185
186+ compiler_env_names = ("CC" , "CPP" , "CXX" )
179187 if wasi_sdk_path != pathlib .Path ("/opt/wasi-sdk" ):
180- for compiler in [ "CC" , "CPP" , "CXX" ] :
188+ for compiler in compiler_env_names :
181189 env [compiler ] += f" --sysroot={ sysroot } "
190+ if subprocess .call (("sccache" , "--version" ), stderr = subprocess .DEVNULL ) == 0 :
191+ for compiler in compiler_env_names :
192+ env [compiler ] = 'sccache ' + env [compiler ]
182193
183194 env ["PKG_CONFIG_PATH" ] = ""
184195 env ["PKG_CONFIG_LIBDIR" ] = os .pathsep .join (
0 commit comments