aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/detect.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers/detect.py')
-rw-r--r--mesonbuild/compilers/detect.py48
1 files changed, 32 insertions, 16 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 4a5e72f..9216ecf 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -33,6 +33,8 @@ from ..linkers import (
CompCertDynamicLinker,
C2000Linker,
C2000DynamicLinker,
+ TILinker,
+ TIDynamicLinker,
DLinker,
NAGDynamicLinker,
NvidiaHPC_DynamicLinker,
@@ -68,6 +70,7 @@ from .c import (
Xc16CCompiler,
CompCertCCompiler,
C2000CCompiler,
+ TICCompiler,
VisualStudioCCompiler,
)
from .cpp import (
@@ -87,6 +90,7 @@ from .cpp import (
PGICPPCompiler,
CcrxCPPCompiler,
C2000CPPCompiler,
+ TICPPCompiler,
VisualStudioCPPCompiler,
)
from .cs import MonoCompiler, VisualStudioCsCompiler
@@ -295,9 +299,11 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
linkers = default_linkers
popen_exceptions = {}
for linker in linkers:
- if not {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'}.isdisjoint(linker):
+ linker_name = os.path.basename(linker[0])
+
+ if any(os.path.basename(x) in {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'} for x in linker):
arg = '/?'
- elif not {'ar2000', 'ar2000.exe'}.isdisjoint(linker):
+ elif linker_name in {'ar2000', 'ar2000.exe', 'ar430', 'ar430.exe', 'armar', 'armar.exe'}:
arg = '?'
else:
arg = '--version'
@@ -312,7 +318,7 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
return VisualStudioLinker(linker, getattr(compiler, 'machine', None))
if 'ar-Error-Unknown switch: --version' in err:
return PGIStaticLinker(linker)
- if p.returncode == 0 and ('armar' in linker or 'armar.exe' in linker):
+ if p.returncode == 0 and 'armar' in linker_name:
return ArmarLinker(linker)
if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out:
assert isinstance(compiler, DCompiler)
@@ -323,12 +329,15 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
if 'GDC' in out and ' based on D ' in out:
assert isinstance(compiler, DCompiler)
return DLinker(linker, compiler.arch)
- if err.startswith('Renesas') and ('rlink' in linker or 'rlink.exe' in linker):
+ if err.startswith('Renesas') and 'rlink' in linker_name:
return CcrxLinker(linker)
- if out.startswith('GNU ar') and ('xc16-ar' in linker or 'xc16-ar.exe' in linker):
+ if out.startswith('GNU ar') and 'xc16-ar' in linker_name:
return Xc16Linker(linker)
- if out.startswith('TMS320C2000') and ('ar2000' in linker or 'ar2000.exe' in linker):
- return C2000Linker(linker)
+ if 'Texas Instruments Incorporated' in out:
+ if 'ar2000' in linker_name:
+ return C2000Linker(linker)
+ else:
+ return TILinker(linker)
if out.startswith('The CompCert'):
return CompCertLinker(linker)
if p.returncode == 0:
@@ -397,7 +406,8 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
arg = '--version'
elif 'ccomp' in compiler_name:
arg = '-version'
- elif 'cl2000' in compiler_name:
+ elif compiler_name in {'cl2000', 'cl2000.exe', 'cl430', 'cl430.exe', 'armcl', 'armcl.exe'}:
+ # TI compiler
arg = '-version'
elif compiler_name in {'icl', 'icl.exe'}:
# if you pass anything to icl you get stuck in a pager
@@ -602,6 +612,20 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
return cls(
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[C2000DynamicLinker], T.Type[TIDynamicLinker]]
+ if 'TMS320C2000 C/C++' in out:
+ cls = C2000CCompiler if lang == 'c' else C2000CPPCompiler
+ lnk = C2000DynamicLinker
+ else:
+ cls = TICCompiler if lang == 'c' else TICPPCompiler
+ lnk = TIDynamicLinker
+
+ 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,
+ exe_wrap, full_version=full_version, linker=linker)
if 'ARM' in out:
cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
@@ -633,14 +657,6 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
ccache + compiler, version, for_machine, is_cross, info,
exe_wrap, full_version=full_version, linker=linker)
- if 'TMS320C2000 C/C++' in out:
- cls = C2000CCompiler if lang == 'c' else C2000CPPCompiler
- env.coredata.add_lang_args(cls.language, cls, for_machine, env)
- linker = C2000DynamicLinker(compiler, for_machine, version=version)
- return cls(
- ccache + compiler, version, for_machine, is_cross, info,
- exe_wrap, full_version=full_version, linker=linker)
-
_handle_exceptions(popen_exceptions, compilers)
raise EnvironmentException(f'Unknown compiler {compilers}')