aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorPetr Machacek <machacek@2n.com>2023-09-12 09:11:50 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2024-03-12 20:38:30 +0200
commiteb74bb8dbf74ac22a02e369b6622ee0ef8b5d6a3 (patch)
treea4569279dd3dc926bb8fff9b9d095c1fe9223a1b /mesonbuild
parent7399be4ab263f7729e0f516aba3bbfea07aa593d (diff)
downloadmeson-eb74bb8dbf74ac22a02e369b6622ee0ef8b5d6a3.zip
meson-eb74bb8dbf74ac22a02e369b6622ee0ef8b5d6a3.tar.gz
meson-eb74bb8dbf74ac22a02e369b6622ee0ef8b5d6a3.tar.bz2
Added support for Texas Instruments C6000 compiler.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/build.py4
-rw-r--r--mesonbuild/compilers/c.py3
-rw-r--r--mesonbuild/compilers/cpp.py3
-rw-r--r--mesonbuild/compilers/detect.py38
-rw-r--r--mesonbuild/compilers/mixins/clike.py4
-rw-r--r--mesonbuild/envconfig.py1
-rw-r--r--mesonbuild/linkers/linkers.py6
7 files changed, 43 insertions, 16 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 3c9d3a0..2b6ce88 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1976,8 +1976,8 @@ class Executable(BuildTarget):
self.suffix = 'abs'
elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('xc16')):
self.suffix = 'elf'
- elif ('c' in self.compilers and self.compilers['c'].get_id() in {'ti', 'c2000'} or
- 'cpp' in self.compilers and self.compilers['cpp'].get_id() in {'ti', 'c2000'}):
+ elif ('c' in self.compilers and self.compilers['c'].get_id() in {'ti', 'c2000', 'c6000'} or
+ 'cpp' in self.compilers and self.compilers['cpp'].get_id() in {'ti', 'c2000', 'c6000'}):
self.suffix = 'out'
elif ('c' in self.compilers and self.compilers['c'].get_id() in {'mwccarm', 'mwcceppc'} or
'cpp' in self.compilers and self.compilers['cpp'].get_id() in {'mwccarm', 'mwcceppc'}):
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index a943552..8c76a21 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -735,6 +735,9 @@ class C2000CCompiler(TICCompiler):
# Required for backwards compat with projects created before ti-cgt support existed
id = 'c2000'
+class C6000CCompiler(TICCompiler):
+ id = 'c6000'
+
class MetrowerksCCompilerARM(MetrowerksCompiler, CCompiler):
id = 'mwccarm'
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index 0ff89a3..c5c2735 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -960,6 +960,9 @@ class C2000CPPCompiler(TICPPCompiler):
# Required for backwards compat with projects created before ti-cgt support existed
id = 'c2000'
+class C6000CPPCompiler(TICPPCompiler):
+ id = 'c6000'
+
class MetrowerksCPPCompilerARM(MetrowerksCompiler, CPPCompiler):
id = 'mwccarm'
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index c117c22..f047242 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -198,6 +198,8 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
if any(os.path.basename(x) in {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'} for x in linker):
arg = '/?'
+ elif linker_name in {'ar2000', 'ar2000.exe', 'ar430', 'ar430.exe', 'armar', 'armar.exe', 'ar6x', 'ar6x.exe'}:
+ arg = '?'
else:
arg = '--version'
try:
@@ -231,6 +233,9 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
return linkers.C2000Linker(linker)
else:
return linkers.TILinker(linker)
+ if 'Texas Instruments Incorporated' in out:
+ if 'ar6000' in linker_name:
+ return linkers.C6000Linker(linker)
if out.startswith('The CompCert'):
return linkers.CompCertLinker(linker)
if out.strip().startswith('Metrowerks') or out.strip().startswith('Freescale'):
@@ -308,7 +313,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
arg = '--version'
elif 'ccomp' in compiler_name:
arg = '-version'
- elif compiler_name in {'cl2000', 'cl2000.exe', 'cl430', 'cl430.exe', 'armcl', 'armcl.exe'}:
+ elif compiler_name in {'cl2000', 'cl2000.exe', 'cl430', 'cl430.exe', 'armcl', 'armcl.exe', 'cl6x', 'cl6x.exe'}:
# TI compiler
arg = '-version'
elif compiler_name in {'icl', 'icl.exe'}:
@@ -428,6 +433,24 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
return cls(
compiler, version, for_machine, is_cross, info, target,
exe_wrap, linker=linker)
+
+ # must be detected here before clang because TI compilers contain 'clang' in their output and so that they can be detected as 'clang'
+ ti_compilers = {
+ 'TMS320C2000 C/C++': (c.C2000CCompiler, cpp.C2000CPPCompiler, linkers.C2000DynamicLinker),
+ 'TMS320C6x C/C++': (c.C6000CCompiler, cpp.C6000CPPCompiler, linkers.C6000DynamicLinker),
+ 'TI ARM C/C++ Compiler': (c.TICCompiler, cpp.TICPPCompiler, linkers.TIDynamicLinker),
+ 'MSP430 C/C++': (c.TICCompiler, cpp.TICPPCompiler, linkers.TIDynamicLinker)
+ }
+ for indentifier, compiler_classes in ti_compilers.items():
+ if indentifier in out:
+ cls = compiler_classes[0] if lang == 'c' else compiler_classes[1]
+ lnk = compiler_classes[2]
+ 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 'clang' in out or 'Clang' in out:
linker = None
@@ -525,19 +548,6 @@ 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:
- if 'TMS320C2000 C/C++' in out:
- cls = c.C2000CCompiler if lang == 'c' else cpp.C2000CPPCompiler
- lnk = linkers.C2000DynamicLinker
- else:
- cls = c.TICCompiler if lang == 'c' else cpp.TICPPCompiler
- lnk = linkers.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 and not ('Metrowerks' in out or 'Freescale' in out):
cls = c.ArmCCompiler if lang == 'c' else cpp.ArmCPPCompiler
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index 25feb5c..5e6aded 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -1052,6 +1052,10 @@ class CLikeCompiler(Compiler):
elif env.machines[self.for_machine].is_cygwin():
shlibext = ['dll', 'dll.a']
prefixes = ['cyg'] + prefixes
+ elif self.id.lower() == 'c6000' or self.id.lower() == 'ti':
+ # TI C6000 compiler can use both extensions for static or dynamic libs.
+ stlibext = ['a', 'lib']
+ shlibext = ['dll', 'so']
else:
# Linux/BSDs
shlibext = ['so']
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
index 0e9cd23..86bad9b 100644
--- a/mesonbuild/envconfig.py
+++ b/mesonbuild/envconfig.py
@@ -34,6 +34,7 @@ known_cpu_families = (
'arm',
'avr',
'c2000',
+ 'c6000',
'csky',
'dspic',
'e2k',
diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py
index 2048268..657e361 100644
--- a/mesonbuild/linkers/linkers.py
+++ b/mesonbuild/linkers/linkers.py
@@ -492,6 +492,9 @@ class C2000Linker(TILinker):
# Required for backwards compat with projects created before ti-cgt support existed
id = 'ar2000'
+class C6000Linker(TILinker):
+ id = 'ar6000'
+
class AIXArLinker(ArLikeLinker, StaticLinker):
id = 'aixar'
@@ -1094,6 +1097,9 @@ class C2000DynamicLinker(TIDynamicLinker):
# Required for backwards compat with projects created before ti-cgt support existed
id = 'cl2000'
+class C6000DynamicLinker(TIDynamicLinker):
+ id = 'cl6000'
+
class ArmDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):