Compilers: Keep ccache and exelist separated
Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
This commit is contained in:
parent
b0e2d00acd
commit
2961adb8c8
|
@ -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]:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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]:
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue