summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/detect.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-10-22 16:59:34 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-10-25 20:07:40 +0300
commitfcb94a6a511acf186497b60aac345231a42f8f9f (patch)
tree23065435cea9f8fa9207e9c11e7b81e08c0dde28 /mesonbuild/compilers/detect.py
parent034b3a92d97bf688be2aba5e5acfcc1e774b83e3 (diff)
downloadmeson-sccache.tar.gz
Add sccache support.sccache
Diffstat (limited to 'mesonbuild/compilers/detect.py')
-rw-r--r--mesonbuild/compilers/detect.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 5e0710ba8..272f5e46f 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -236,7 +236,7 @@ def _get_compilers(env: 'Environment', lang: str, for_machine: MachineChoice) ->
if not env.machines.matches_build_machine(for_machine):
raise EnvironmentException(f'{lang!r} compiler binary not defined in cross or native file')
compilers = [[x] for x in defaults[lang]]
- ccache = BinaryTable.detect_ccache()
+ ccache = BinaryTable.detect_compiler_cache()
if env.machines.matches_build_machine(for_machine):
exe_wrap: T.Optional[ExternalProgram] = None
@@ -554,8 +554,13 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
raise EnvironmentException(m)
cls = VisualStudioCCompiler if lang == 'c' else VisualStudioCPPCompiler
linker = guess_win_linker(env, ['link'], cls, for_machine)
+ # As of this writing, CCache does not support MSVC but sccache does.
+ if 'sccache' in ccache:
+ final_compiler = ccache + compiler
+ else:
+ final_compiler = compiler
return cls(
- compiler, version, for_machine, is_cross, info, target,
+ final_compiler, version, for_machine, is_cross, info, target,
exe_wrap, full_version=cl_signature, linker=linker)
if 'PGI Compilers' in out:
cls = PGICCompiler if lang == 'c' else PGICPPCompiler