diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-09-30 14:46:10 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-10-25 17:24:56 -0400 |
commit | 2961adb8c89fa8ccfbc8e24cd9f1115bd3abeee1 (patch) | |
tree | a52ebb2666ba207caf94ca38b4e111390a6124e1 | |
parent | b0e2d00acd67e13ac3478cb7f00a080d702bb8d7 (diff) | |
download | meson-2961adb8c89fa8ccfbc8e24cd9f1115bd3abeee1.zip meson-2961adb8c89fa8ccfbc8e24cd9f1115bd3abeee1.tar.gz meson-2961adb8c89fa8ccfbc8e24cd9f1115bd3abeee1.tar.bz2 |
Compilers: Keep ccache and exelist separated
Only combine them in the Compiler base class, this will make easier to
run compiler without ccache.
-rw-r--r-- | mesonbuild/compilers/asm.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/c.py | 64 | ||||
-rw-r--r-- | mesonbuild/compilers/compilers.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/cpp.py | 56 | ||||
-rw-r--r-- | mesonbuild/compilers/cs.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/cuda.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/d.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/detect.py | 52 | ||||
-rw-r--r-- | mesonbuild/compilers/fortran.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/java.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/objc.py | 12 | ||||
-rw-r--r-- | mesonbuild/compilers/objcpp.py | 12 | ||||
-rw-r--r-- | mesonbuild/compilers/rust.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/swift.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/vala.py | 2 | ||||
-rw-r--r-- | unittests/internaltests.py | 8 |
16 files changed, 114 insertions, 116 deletions
diff --git a/mesonbuild/compilers/asm.py b/mesonbuild/compilers/asm.py index 1bcae2d..83b6ea6 100644 --- a/mesonbuild/compilers/asm.py +++ b/mesonbuild/compilers/asm.py @@ -79,9 +79,9 @@ class NasmCompiler(Compiler): class YasmCompiler(NasmCompiler): id = 'yasm' - def get_exelist(self) -> T.List[str]: + def get_exelist(self, ccache: bool = True) -> T.List[str]: # Wrap yasm executable with an internal script that will write depfile. - exelist = super().get_exelist() + exelist = super().get_exelist(ccache) return get_meson_command() + ['--internal', 'yasm'] + exelist def get_debug_args(self, is_debug: bool) -> T.List[str]: diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index c41a7e2..0b78442 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -63,12 +63,12 @@ class CCompiler(CLikeCompiler, Compiler): language = 'c' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): # If a child ObjC or CPP class has already set it, don't set it ourselves - Compiler.__init__(self, exelist, version, for_machine, info, + Compiler.__init__(self, ccache, exelist, version, for_machine, info, is_cross=is_cross, full_version=full_version, linker=linker) CLikeCompiler.__init__(self, exe_wrapper) @@ -141,12 +141,12 @@ class _ClangCStds(CompilerMixinBase): class ClangCCompiler(_ClangCStds, ClangCompiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, defines: T.Optional[T.Dict[str, str]] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ClangCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch'] self.warn_args = {'0': [], @@ -205,14 +205,14 @@ class EmscriptenCCompiler(EmscriptenMixin, ClangCCompiler): id = 'emscripten' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, defines: T.Optional[T.Dict[str, str]] = None, full_version: T.Optional[str] = None): if not is_cross: raise MesonException('Emscripten compiler can only be used for cross compilation.') - ClangCCompiler.__init__(self, exelist, version, for_machine, is_cross, + ClangCCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper=exe_wrapper, linker=linker, defines=defines, full_version=full_version) @@ -222,11 +222,11 @@ class ArmclangCCompiler(ArmclangCompiler, CCompiler): Keil armclang ''' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ArmclangCompiler.__init__(self) default_warn_args = ['-Wall', '-Winvalid-pch'] @@ -258,12 +258,12 @@ class GnuCCompiler(GnuCompiler, CCompiler): _C2X_VERSION = '>=9.0.0' _INVALID_PCH_VERSION = ">=3.4.0" - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, defines: T.Optional[T.Dict[str, str]] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) GnuCompiler.__init__(self, defines) default_warn_args = ['-Wall'] if version_compare(self.version, self._INVALID_PCH_VERSION): @@ -316,11 +316,11 @@ class GnuCCompiler(GnuCompiler, CCompiler): class PGICCompiler(PGICompiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) PGICompiler.__init__(self) @@ -329,22 +329,22 @@ class NvidiaHPC_CCompiler(PGICompiler, CCompiler): id = 'nvidia_hpc' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) PGICompiler.__init__(self) class ElbrusCCompiler(ElbrusCompiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, defines: T.Optional[T.Dict[str, str]] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ElbrusCompiler.__init__(self) @@ -377,11 +377,11 @@ class ElbrusCCompiler(ElbrusCompiler, CCompiler): class IntelCCompiler(IntelGnuLikeCompiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) IntelGnuLikeCompiler.__init__(self) self.lang_header = 'c-header' @@ -442,12 +442,12 @@ class VisualStudioCCompiler(MSVCCompiler, VisualStudioLikeCCompilerMixin, CCompi _C11_VERSION = '>=19.28' _C17_VERSION = '>=19.28' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', target: str, exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) MSVCCompiler.__init__(self, target) @@ -491,7 +491,7 @@ class ClangClCCompiler(_ClangCStds, ClangClCompiler, VisualStudioLikeCCompilerMi exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, [], exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ClangClCompiler.__init__(self, target) @@ -513,7 +513,7 @@ class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerM exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, [], exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) IntelVisualStudioLikeCompiler.__init__(self, target) @@ -541,12 +541,12 @@ class IntelLLVMClCCompiler(IntelClCCompiler): class ArmCCompiler(ArmCompiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ArmCompiler.__init__(self) @@ -567,12 +567,12 @@ class ArmCCompiler(ArmCompiler, CCompiler): class CcrxCCompiler(CcrxCompiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) CcrxCompiler.__init__(self) @@ -618,12 +618,12 @@ class CcrxCCompiler(CcrxCompiler, CCompiler): class Xc16CCompiler(Xc16Compiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) Xc16Compiler.__init__(self) @@ -663,12 +663,12 @@ class Xc16CCompiler(Xc16Compiler, CCompiler): return ['-I' + path] class CompCertCCompiler(CompCertCompiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) CompCertCompiler.__init__(self) @@ -696,12 +696,12 @@ class CompCertCCompiler(CompCertCompiler, CCompiler): return ['-I' + path] class TICCompiler(TICompiler, CCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CCompiler.__init__(self, exelist, version, for_machine, is_cross, + CCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) TICompiler.__init__(self) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 50a2f4e..bcd5820 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -498,11 +498,11 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): warn_args: T.Dict[str, T.List[str]] mode: str = 'COMPILER' - def __init__(self, exelist: T.List[str], version: str, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, info: 'MachineInfo', linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None, is_cross: bool = False): - self.exelist = exelist + self.exelist = ccache + exelist # In case it's been overridden by a child class already if not hasattr(self, 'file_suffixes'): self.file_suffixes = lang_suffixes[self.language] diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index c9ca842..0633829 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -70,12 +70,12 @@ class CPPCompiler(CLikeCompiler, Compiler): language = 'cpp' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): # If a child ObjCPP class has already set it, don't set it ourselves - Compiler.__init__(self, exelist, version, for_machine, info, + Compiler.__init__(self, ccache, exelist, version, for_machine, info, is_cross=is_cross, linker=linker, full_version=full_version) CLikeCompiler.__init__(self, exe_wrapper) @@ -182,12 +182,12 @@ class CPPCompiler(CLikeCompiler, Compiler): class ClangCPPCompiler(ClangCompiler, CPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, defines: T.Optional[T.Dict[str, str]] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ClangCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] @@ -278,14 +278,14 @@ class EmscriptenCPPCompiler(EmscriptenMixin, ClangCPPCompiler): id = 'emscripten' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, defines: T.Optional[T.Dict[str, str]] = None, full_version: T.Optional[str] = None): if not is_cross: raise MesonException('Emscripten compiler can only be used for cross compilation.') - ClangCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + ClangCPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper=exe_wrapper, linker=linker, defines=defines, full_version=full_version) @@ -303,11 +303,11 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler): Keil armclang ''' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ArmclangCompiler.__init__(self) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] @@ -348,12 +348,12 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler): class GnuCPPCompiler(GnuCompiler, CPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, defines: T.Optional[T.Dict[str, str]] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) GnuCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] @@ -433,11 +433,11 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): class PGICPPCompiler(PGICompiler, CPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) PGICompiler.__init__(self) @@ -446,22 +446,22 @@ class NvidiaHPC_CPPCompiler(PGICompiler, CPPCompiler): id = 'nvidia_hpc' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) PGICompiler.__init__(self) class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, defines: T.Optional[T.Dict[str, str]] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ElbrusCompiler.__init__(self) @@ -527,11 +527,11 @@ class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler): class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) IntelGnuLikeCompiler.__init__(self) self.lang_header = 'c++-header' @@ -701,12 +701,12 @@ class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixi id = 'msvc' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', target: str, exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) MSVCCompiler.__init__(self, target) @@ -758,7 +758,7 @@ class ClangClCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixin, Cl exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, [], exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ClangClCompiler.__init__(self, target) @@ -774,7 +774,7 @@ class IntelClCPPCompiler(VisualStudioLikeCPPCompilerMixin, IntelVisualStudioLike exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, [], exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) IntelVisualStudioLikeCompiler.__init__(self, target) @@ -794,11 +794,11 @@ class IntelLLVMClCPPCompiler(IntelClCPPCompiler): class ArmCPPCompiler(ArmCompiler, CPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ArmCompiler.__init__(self) @@ -826,11 +826,11 @@ class ArmCPPCompiler(ArmCompiler, CPPCompiler): class CcrxCPPCompiler(CcrxCompiler, CPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) CcrxCompiler.__init__(self) @@ -854,11 +854,11 @@ class CcrxCPPCompiler(CcrxCompiler, CPPCompiler): return [] class TICPPCompiler(TICompiler, CPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + CPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) TICompiler.__init__(self) diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py index 64cca96..14fcfd7 100644 --- a/mesonbuild/compilers/cs.py +++ b/mesonbuild/compilers/cs.py @@ -45,7 +45,7 @@ class CsCompiler(BasicLinkerIsCompilerMixin, Compiler): def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, info: 'MachineInfo', runner: T.Optional[str] = None): - super().__init__(exelist, version, for_machine, info) + super().__init__([], exelist, version, for_machine, info) self.runner = runner @classmethod diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 8965644..46a86b7 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -178,12 +178,12 @@ class CudaCompiler(Compiler): id = 'nvcc' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, exe_wrapper: T.Optional['ExternalProgram'], host_compiler: Compiler, info: 'MachineInfo', linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - super().__init__(exelist, version, for_machine, info, linker=linker, full_version=full_version, is_cross=is_cross) + super().__init__(ccache, exelist, version, for_machine, info, linker=linker, full_version=full_version, is_cross=is_cross) self.exe_wrapper = exe_wrapper self.host_compiler = host_compiler self.base_options = host_compiler.base_options diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index fbdf288..b03495c 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -543,7 +543,7 @@ class DCompiler(Compiler): linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None, is_cross: bool = False): - super().__init__(exelist, version, for_machine, info, linker=linker, + super().__init__([], exelist, version, for_machine, info, linker=linker, full_version=full_version, is_cross=is_cross) self.arch = arch self.exe_wrapper = exe_wrapper diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index fcaae4a..367bcf9 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -355,7 +355,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin linker = guess_nix_linker(env, compiler, cls, version, for_machine) return cls( - ccache + compiler, version, for_machine, is_cross, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, defines=defines, full_version=full_version, linker=linker) @@ -375,7 +375,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin compiler, for_machine, cls.LINKER_PREFIX, [], version=search_version(o)) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, linker=linker, full_version=full_version) if 'Arm C/C++/Fortran Compiler' in out: @@ -388,7 +388,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin cls = cpp.ArmLtdClangCPPCompiler linker = guess_nix_linker(env, compiler, cls, version, for_machine) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, linker=linker) if 'armclang' in out: # The compiler version is not present in the first line of output, @@ -408,7 +408,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin linker = linkers.ArmClangDynamicLinker(for_machine, version=version) env.coredata.add_lang_args(cls.language, cls, for_machine, env) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) if 'CL.EXE COMPATIBILITY' in out: # if this is clang-cl masquerading as cl, detect it as cl, not @@ -453,7 +453,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin linker = guess_nix_linker(env, compiler, cls, version, for_machine) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, defines=defines, full_version=full_version, linker=linker) if 'Intel(R) C++ Intel(R)' in err: @@ -495,38 +495,36 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin cls = c.VisualStudioCCompiler if lang == 'c' else cpp.VisualStudioCPPCompiler linker = guess_win_linker(env, ['link'], cls, version, 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 + if 'sccache' not in ccache: + ccache = [] return cls( - final_compiler, version, for_machine, is_cross, info, target, + ccache, compiler, version, for_machine, is_cross, info, target, exe_wrap, full_version=cl_signature, linker=linker) if 'PGI Compilers' in out: cls = c.PGICCompiler if lang == 'c' else cpp.PGICPPCompiler env.coredata.add_lang_args(cls.language, cls, for_machine, env) linker = linkers.PGIDynamicLinker(compiler, for_machine, cls.LINKER_PREFIX, [], version=version) return cls( - ccache + compiler, version, for_machine, is_cross, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, linker=linker) if 'NVIDIA Compilers and Tools' in out: cls = c.NvidiaHPC_CCompiler if lang == 'c' else cpp.NvidiaHPC_CPPCompiler env.coredata.add_lang_args(cls.language, cls, for_machine, env) linker = linkers.NvidiaHPC_DynamicLinker(compiler, for_machine, cls.LINKER_PREFIX, [], version=version) return cls( - ccache + compiler, version, for_machine, is_cross, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, linker=linker) if '(ICC)' in out: cls = c.IntelCCompiler if lang == 'c' else cpp.IntelCPPCompiler l = guess_nix_linker(env, compiler, cls, version, for_machine) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=l) if 'Intel(R) oneAPI' in out: cls = c.IntelLLVMCCompiler if lang == 'c' else cpp.IntelLLVMCPPCompiler l = guess_nix_linker(env, compiler, cls, version, for_machine) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=l) if 'TMS320C2000 C/C++' in out or 'MSP430 C/C++' in out or 'TI ARM C/C++ Compiler' in out: lnk: T.Union[T.Type[linkers.C2000DynamicLinker], T.Type[linkers.TIDynamicLinker]] @@ -540,21 +538,21 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin env.coredata.add_lang_args(cls.language, cls, for_machine, env) linker = lnk(compiler, for_machine, version=version) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) if 'ARM' in out: cls = c.ArmCCompiler if lang == 'c' else cpp.ArmCPPCompiler env.coredata.add_lang_args(cls.language, cls, for_machine, env) linker = linkers.ArmDynamicLinker(for_machine, version=version) return cls( - ccache + compiler, version, for_machine, is_cross, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) if 'RX Family' in out: cls = c.CcrxCCompiler if lang == 'c' else cpp.CcrxCPPCompiler env.coredata.add_lang_args(cls.language, cls, for_machine, env) linker = linkers.CcrxDynamicLinker(for_machine, version=version) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) if 'Microchip Technology' in out: @@ -562,7 +560,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin env.coredata.add_lang_args(cls.language, cls, for_machine, env) linker = linkers.Xc16DynamicLinker(for_machine, version=version) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) if 'CompCert' in out: @@ -570,7 +568,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin env.coredata.add_lang_args(cls.language, cls, for_machine, env) linker = linkers.CompCertDynamicLinker(for_machine, version=version) return cls( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) _handle_exceptions(popen_exceptions, compilers) @@ -616,7 +614,7 @@ def detect_cuda_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp cls = CudaCompiler env.coredata.add_lang_args(cls.language, cls, for_machine, env) linker = CudaLinker(compiler, for_machine, CudaCompiler.LINKER_PREFIX, [], version=CudaLinker.parse_version()) - return cls(ccache + compiler, version, for_machine, is_cross, exe_wrap, host_compiler=cpp_compiler, info=info, linker=linker) + return cls(ccache, compiler, version, for_machine, is_cross, exe_wrap, host_compiler=cpp_compiler, info=info, linker=linker) raise EnvironmentException(f'Could not find suitable CUDA compiler: "{"; ".join([" ".join(c) for c in compilers])}"') def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: @@ -671,7 +669,7 @@ def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> C version = '.'.join([x for x in arm_ver_match.groups() if x is not None]) linker = guess_nix_linker(env, compiler, cls, version, for_machine) return cls( - ccache + compiler, version, for_machine, is_cross, info, + compiler, version, for_machine, is_cross, info, exe_wrap, linker=linker) if 'G95' in out: cls = fortran.G95FortranCompiler @@ -807,7 +805,7 @@ def _detect_objc_or_objcpp_compiler(env: 'Environment', lang: str, for_machine: comp = objc.GnuObjCCompiler if lang == 'objc' else objcpp.GnuObjCPPCompiler linker = guess_nix_linker(env, compiler, comp, version, for_machine) return comp( - ccache + compiler, version, for_machine, is_cross, info, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, defines, linker=linker) if 'clang' in out: linker = None @@ -829,7 +827,7 @@ def _detect_objc_or_objcpp_compiler(env: 'Environment', lang: str, for_machine: if not linker: linker = guess_nix_linker(env, compiler, comp, version, for_machine) return comp( - ccache + compiler, version, for_machine, + ccache, compiler, version, for_machine, is_cross, info, exe_wrap, linker=linker, defines=defines) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') @@ -902,7 +900,7 @@ def detect_cython_compiler(env: 'Environment', for_machine: MachineChoice) -> Co if 'Cython' in err: comp_class = CythonCompiler env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) - return comp_class(comp, version, for_machine, info, is_cross=is_cross) + return comp_class([], comp, version, for_machine, info, is_cross=is_cross) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') @@ -1198,11 +1196,11 @@ def detect_nasm_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp if 'NASM' in output: comp_class = NasmCompiler env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) - return comp_class(comp, version, for_machine, info, cc.linker, is_cross=is_cross) + return comp_class([], comp, version, for_machine, info, cc.linker, is_cross=is_cross) elif 'yasm' in output: comp_class = YasmCompiler env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) - return comp_class(comp, version, for_machine, info, cc.linker, is_cross=is_cross) + return comp_class([], comp, version, for_machine, info, cc.linker, is_cross=is_cross) _handle_exceptions(popen_exceptions, compilers) raise EnvironmentException('Unreachable code (exception to make mypy happy)') @@ -1242,7 +1240,7 @@ def detect_masm_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp output = Popen_safe(comp + [arg])[2] version = search_version(output) env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) - return comp_class(comp, version, for_machine, info, cc.linker, is_cross=is_cross) + return comp_class([], comp, version, for_machine, info, cc.linker, is_cross=is_cross) except OSError as e: popen_exceptions[' '.join(comp + [arg])] = e _handle_exceptions(popen_exceptions, [comp]) diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index bbe0b78..3f388cf 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -54,7 +54,7 @@ class FortranCompiler(CLikeCompiler, Compiler): info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - Compiler.__init__(self, exelist, version, for_machine, info, + Compiler.__init__(self, [], exelist, version, for_machine, info, is_cross=is_cross, full_version=full_version, linker=linker) CLikeCompiler.__init__(self, exe_wrapper) diff --git a/mesonbuild/compilers/java.py b/mesonbuild/compilers/java.py index 6857ea0..bfd9b1a 100644 --- a/mesonbuild/compilers/java.py +++ b/mesonbuild/compilers/java.py @@ -43,7 +43,7 @@ class JavaCompiler(BasicLinkerIsCompilerMixin, Compiler): def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, info: 'MachineInfo', full_version: T.Optional[str] = None): - super().__init__(exelist, version, for_machine, info, full_version=full_version) + super().__init__([], exelist, version, for_machine, info, full_version=full_version) self.javarunner = 'java' def get_warn_args(self, level: str) -> T.List[str]: diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py index bd358c3..fc82e15 100644 --- a/mesonbuild/compilers/objc.py +++ b/mesonbuild/compilers/objc.py @@ -35,12 +35,12 @@ class ObjCCompiler(CLikeCompiler, Compiler): language = 'objc' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrap: T.Optional['ExternalProgram'], linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - Compiler.__init__(self, exelist, version, for_machine, info, + Compiler.__init__(self, ccache, exelist, version, for_machine, info, is_cross=is_cross, full_version=full_version, linker=linker) CLikeCompiler.__init__(self, exe_wrap) @@ -55,13 +55,13 @@ class ObjCCompiler(CLikeCompiler, Compiler): class GnuObjCCompiler(GnuCompiler, ObjCCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, defines: T.Optional[T.Dict[str, str]] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - ObjCCompiler.__init__(self, exelist, version, for_machine, is_cross, + ObjCCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) GnuCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch'] @@ -72,13 +72,13 @@ class GnuObjCCompiler(GnuCompiler, ObjCCompiler): class ClangObjCCompiler(ClangCompiler, ObjCCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, defines: T.Optional[T.Dict[str, str]] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - ObjCCompiler.__init__(self, exelist, version, for_machine, is_cross, + ObjCCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ClangCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch'] diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py index 9731daf..5012ea3 100644 --- a/mesonbuild/compilers/objcpp.py +++ b/mesonbuild/compilers/objcpp.py @@ -34,12 +34,12 @@ class ObjCPPCompiler(CLikeCompiler, Compiler): language = 'objcpp' - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrap: T.Optional['ExternalProgram'], linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - Compiler.__init__(self, exelist, version, for_machine, info, + Compiler.__init__(self, ccache, exelist, version, for_machine, info, is_cross=is_cross, full_version=full_version, linker=linker) CLikeCompiler.__init__(self, exe_wrap) @@ -54,13 +54,13 @@ class ObjCPPCompiler(CLikeCompiler, Compiler): class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, defines: T.Optional[T.Dict[str, str]] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - ObjCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + ObjCPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) GnuCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] @@ -72,13 +72,13 @@ class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler): class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler): - def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, defines: T.Optional[T.Dict[str, str]] = None, linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None): - ObjCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, + ObjCPPCompiler.__init__(self, ccache, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) ClangCompiler.__init__(self, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 7456823..3cd73f7 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -58,7 +58,7 @@ class RustCompiler(Compiler): exe_wrapper: T.Optional['ExternalProgram'] = None, full_version: T.Optional[str] = None, linker: T.Optional['DynamicLinker'] = None): - super().__init__(exelist, version, for_machine, info, + super().__init__([], exelist, version, for_machine, info, is_cross=is_cross, full_version=full_version, linker=linker) self.exe_wrapper = exe_wrapper diff --git a/mesonbuild/compilers/swift.py b/mesonbuild/compilers/swift.py index 998e5df..ec4c7a3 100644 --- a/mesonbuild/compilers/swift.py +++ b/mesonbuild/compilers/swift.py @@ -45,7 +45,7 @@ class SwiftCompiler(Compiler): def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', full_version: T.Optional[str] = None, linker: T.Optional['DynamicLinker'] = None): - super().__init__(exelist, version, for_machine, info, + super().__init__([], exelist, version, for_machine, info, is_cross=is_cross, full_version=full_version, linker=linker) self.version = version diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py index 14bc39b..e56a9fc 100644 --- a/mesonbuild/compilers/vala.py +++ b/mesonbuild/compilers/vala.py @@ -33,7 +33,7 @@ class ValaCompiler(Compiler): def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo'): - super().__init__(exelist, version, for_machine, info, is_cross=is_cross) + super().__init__([], exelist, version, for_machine, info, is_cross=is_cross) self.version = version self.base_options = {OptionKey('b_colorout')} diff --git a/unittests/internaltests.py b/unittests/internaltests.py index e37eb55..29d4bb3 100644 --- a/unittests/internaltests.py +++ b/unittests/internaltests.py @@ -117,7 +117,7 @@ class InternalTests(unittest.TestCase): stat.S_IRGRP | stat.S_IXGRP) def test_compiler_args_class_none_flush(self): - cc = ClangCCompiler([], 'fake', MachineChoice.HOST, False, mock.Mock()) + cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, mock.Mock()) a = cc.compiler_args(['-I.']) #first we are checking if the tree construction deduplicates the correct -I argument a += ['-I..'] @@ -141,7 +141,7 @@ class InternalTests(unittest.TestCase): self.assertEqual(a, ['-Ifirst', '-Isecond', '-Ithird']) def test_compiler_args_class_clike(self): - cc = ClangCCompiler([], 'fake', MachineChoice.HOST, False, mock.Mock()) + cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, mock.Mock()) # Test that empty initialization works a = cc.compiler_args() self.assertEqual(a, []) @@ -223,7 +223,7 @@ class InternalTests(unittest.TestCase): def test_compiler_args_class_gnuld(self): ## Test --start/end-group linker = mesonbuild.linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', []) - gcc = GnuCCompiler([], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker) + gcc = GnuCCompiler([], [], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker) ## Ensure that the fake compiler is never called by overriding the relevant function gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include'] ## Test that 'direct' append and extend works @@ -251,7 +251,7 @@ class InternalTests(unittest.TestCase): def test_compiler_args_remove_system(self): ## Test --start/end-group linker = mesonbuild.linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', []) - gcc = GnuCCompiler([], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker) + gcc = GnuCCompiler([], [], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker) ## Ensure that the fake compiler is never called by overriding the relevant function gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include'] ## Test that 'direct' append and extend works |