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/compilers/c.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/compilers/c.py')
-rw-r--r-- | mesonbuild/compilers/c.py | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index f98316b..82640be 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -20,6 +20,8 @@ from ..mesonlib import MachineChoice, MesonException, mlog, version_compare from .c_function_attributes import C_FUNC_ATTRIBUTES from .mixins.clike import CLikeCompiler from .mixins.ccrx import CcrxCompiler +from .mixins.xc16 import Xc16Compiler +from .mixins.c2000 import C2000Compiler from .mixins.arm import ArmCompiler, ArmclangCompiler from .mixins.visualstudio import MSVCCompiler, ClangClCompiler from .mixins.gnu import GnuCompiler @@ -424,3 +426,92 @@ class CcrxCCompiler(CcrxCompiler, CCompiler): if path == '': path = '.' return ['-include=' + path] + + +class Xc16CCompiler(Xc16Compiler, CCompiler): + def __init__(self, exelist, version, for_machine: MachineChoice, + is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs): + CCompiler.__init__(self, exelist, version, for_machine, is_cross, + info, exe_wrapper, **kwargs) + Xc16Compiler.__init__(self) + + def get_options(self): + opts = CCompiler.get_options(self) + opts.update({'c_std': coredata.UserComboOption('C language standard to use', + ['none', 'c89', 'c99', 'gnu89', 'gnu99'], + 'none')}) + return opts + + def get_no_stdinc_args(self): + return [] + + def get_option_compile_args(self, options): + args = [] + std = options['c_std'] + if std.value != 'none': + args.append('-ansi') + args.append('-std=' + std.value) + return args + + def get_compile_only_args(self): + return [] + + def get_no_optimization_args(self): + return ['-O0'] + + def get_output_args(self, target): + return ['-o%s' % target] + + def get_werror_args(self): + return ['-change_message=error'] + + def get_include_args(self, path, is_system): + if path == '': + path = '.' + return ['-I' + path] + + +class C2000CCompiler(C2000Compiler, CCompiler): + def __init__(self, exelist, version, for_machine: MachineChoice, + is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs): + CCompiler.__init__(self, exelist, version, for_machine, is_cross, + info, exe_wrapper, **kwargs) + C2000Compiler.__init__(self) + + # Override CCompiler.get_always_args + def get_always_args(self): + return [] + + def get_options(self): + opts = CCompiler.get_options(self) + opts.update({'c_std': coredata.UserComboOption('C language standard to use', + ['none', 'c89', 'c99', 'c11'], + 'none')}) + return opts + + def get_no_stdinc_args(self): + return [] + + def get_option_compile_args(self, options): + args = [] + std = options['c_std'] + if std.value != 'none': + args.append('--' + std.value) + return args + + def get_compile_only_args(self): + return [] + + def get_no_optimization_args(self): + return ['-Ooff'] + + def get_output_args(self, target): + return ['--output_file=%s' % target] + + def get_werror_args(self): + return ['-change_message=error'] + + def get_include_args(self, path, is_system): + if path == '': + path = '.' + return ['--include_path=' + path] |