diff options
author | alanNz <alangrimmer@gmail.com> | 2020-03-21 09:13:42 +1300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-03-21 00:47:24 +0200 |
commit | 74602928100394f6129e064f8e0bfe6c9e08c9d2 (patch) | |
tree | e3ae62b782a91ade9d68210a52cea35f18211d8e /mesonbuild/environment.py | |
parent | 24227a95531b21a04bf2514a5b8f61ae29d47043 (diff) | |
download | meson-74602928100394f6129e064f8e0bfe6c9e08c9d2.zip meson-74602928100394f6129e064f8e0bfe6c9e08c9d2.tar.gz meson-74602928100394f6129e064f8e0bfe6c9e08c9d2.tar.bz2 |
-Add xc16 and c2000 C,Cpp toolchain support
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 31510ff..323180b 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -18,7 +18,7 @@ import shlex import typing as T from . import coredata -from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, DLinker, CcrxLinker, IntelVisualStudioLinker +from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, DLinker, CcrxLinker, Xc16Linker, C2000Linker, IntelVisualStudioLinker from . import mesonlib from .mesonlib import ( MesonException, EnvironmentException, MachineChoice, Popen_safe, @@ -45,6 +45,8 @@ from .linkers import ( ArmClangDynamicLinker, ArmDynamicLinker, CcrxDynamicLinker, + Xc16DynamicLinker, + C2000DynamicLinker, ClangClDynamicLinker, DynamicLinker, GnuBFDDynamicLinker, @@ -105,6 +107,9 @@ from .compilers import ( RustCompiler, CcrxCCompiler, CcrxCPPCompiler, + Xc16CCompiler, + C2000CCompiler, + C2000CPPCompiler, SunFortranCompiler, ValaCompiler, VisualStudioCCompiler, @@ -922,6 +927,10 @@ class Environment: arg = '--vsn' elif 'ccrx' in compiler_name: arg = '-v' + elif 'xc16' in compiler_name: + arg = '--version' + elif 'cl2000' in compiler_name: + arg = '-version' elif compiler_name in {'icl', 'icl.exe'}: # if you pass anything to icl you get stuck in a pager arg = '' @@ -945,6 +954,9 @@ class Environment: guess_gcc_or_lcc = 'gcc' if 'e2k' in out and 'lcc' in out: guess_gcc_or_lcc = 'lcc' + if 'Microchip Technology' in out: + # this output has "Free Software Foundation" in its version + guess_gcc_or_lcc = False if guess_gcc_or_lcc: defines = self.get_gnu_compiler_defines(compiler) @@ -1107,6 +1119,22 @@ class Environment: ccache + compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) + if 'Microchip Technology' in out: + cls = Xc16CCompiler if lang == 'c' else Xc16CCompiler + self.coredata.add_lang_args(cls.language, cls, for_machine, self) + linker = Xc16DynamicLinker(for_machine, version=version) + return cls( + 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 + self.coredata.add_lang_args(cls.language, cls, for_machine, self) + linker = C2000DynamicLinker(for_machine, version=version) + return cls( + ccache + compiler, version, for_machine, is_cross, info, + exe_wrap, full_version=full_version, linker=linker) + self._handle_exceptions(popen_exceptions, compilers) def detect_c_compiler(self, for_machine): @@ -1663,6 +1691,8 @@ class Environment: for linker in linkers: if not {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'}.isdisjoint(linker): arg = '/?' + elif not {'ar2000', 'ar2000.exe'}.isdisjoint(linker): + arg = '?' else: arg = '--version' try: @@ -1686,6 +1716,10 @@ class Environment: return DLinker(linker, compiler.arch) if err.startswith('Renesas') and ('rlink' in linker or 'rlink.exe' in linker): return CcrxLinker(linker) + if out.startswith('GNU ar') and ('xc16-ar' in linker or 'xc16-ar.exe' in linker): + return Xc16Linker(linker) + if out.startswith('TMS320C2000') and ('ar2000' in linker or 'ar2000.exe' in linker): + return C2000Linker(linker) if p.returncode == 0: return ArLinker(linker) if p.returncode == 1 and err.startswith('usage'): # OSX |