diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-04-16 23:02:09 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-04-16 23:02:09 +0300 |
commit | c58dd64f8e947f4659bcbc47d75e86e65043e714 (patch) | |
tree | 28be176b2646b02ae6cc006a00608a1152db35be /mesonbuild/compilers | |
parent | fa6ca160548d7e8df9c4c724e6c96f5e004e5316 (diff) | |
parent | 7f8908336362cccd45516f48b5320380cec0e817 (diff) | |
download | meson-c58dd64f8e947f4659bcbc47d75e86e65043e714.zip meson-c58dd64f8e947f4659bcbc47d75e86e65043e714.tar.gz meson-c58dd64f8e947f4659bcbc47d75e86e65043e714.tar.bz2 |
Merged Arm CC support.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/__init__.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/c.py | 20 | ||||
-rw-r--r-- | mesonbuild/compilers/compilers.py | 90 | ||||
-rw-r--r-- | mesonbuild/compilers/cpp.py | 28 |
4 files changed, 140 insertions, 0 deletions
diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py index 89b46b5..288b3f5 100644 --- a/mesonbuild/compilers/__init__.py +++ b/mesonbuild/compilers/__init__.py @@ -118,6 +118,7 @@ from .compilers import ( IntelCompiler, ) from .c import ( + ArmCCompiler, CCompiler, ClangCCompiler, GnuCCompiler, @@ -126,6 +127,7 @@ from .c import ( VisualStudioCCompiler, ) from .cpp import ( + ArmCPPCompiler, CPPCompiler, ClangCPPCompiler, GnuCPPCompiler, diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 151dd50..4263536 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -31,6 +31,7 @@ from .compilers import ( msvc_winlibs, vs32_instruction_set_args, vs64_instruction_set_args, + ArmCompiler, ClangCompiler, Compiler, CompilerArgs, @@ -1221,3 +1222,22 @@ class VisualStudioCCompiler(CCompiler): if 'INCLUDE' not in os.environ: return [] return os.environ['INCLUDE'].split(os.pathsep) + + +class ArmCCompiler(ArmCompiler, CCompiler): + def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwargs): + CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) + ArmCompiler.__init__(self) + + def get_options(self): + opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use', + ['none', 'c90', 'c99'], + 'none')} + return opts + + def get_option_compile_args(self, options): + args = [] + std = options['c_std'] + if std.value != 'none': + args.append('--' + std.value) + return args diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 8337621..99e9164 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -116,6 +116,13 @@ gnulike_buildtype_args = {'plain': [], 'release': ['-O3'], 'minsize': ['-Os', '-g']} +arm_buildtype_args = {'plain': [], + 'debug': ['-O0', '--debug'], + 'debugoptimized': ['-O1', '--debug'], + 'release': ['-O3', '-Otime'], + 'minsize': ['-O3', '-Ospace'], + } + msvc_buildtype_args = {'plain': [], 'debug': ["/MDd", "/ZI", "/Ob0", "/Od", "/RTC1"], 'debugoptimized': ["/MD", "/Zi", "/O2", "/Ob1"], @@ -137,6 +144,13 @@ gnulike_buildtype_linker_args = {'plain': [], 'minsize': [], } +arm_buildtype_linker_args = {'plain': [], + 'debug': [], + 'debugoptimized': [], + 'release': [], + 'minsize': [], + } + msvc_buildtype_linker_args = {'plain': [], 'debug': [], 'debugoptimized': [], @@ -671,6 +685,12 @@ class Compiler: def get_always_args(self): return [] + def can_linker_accept_rsp(self): + """ + Determines whether the linker can accept arguments using the @rsp syntax. + """ + return mesonlib.is_windows() + def get_linker_always_args(self): return [] @@ -1311,3 +1331,73 @@ class IntelCompiler: def get_default_include_dirs(self): return gnulike_default_include_dirs(self.exelist, self.language) + + +class ArmCompiler: + # Functionality that is common to all ARM family compilers. + def __init__(self): + if not self.is_cross: + raise EnvironmentException('armcc supports only cross-compilation.') + self.id = 'arm' + default_warn_args = [] + self.warn_args = {'1': default_warn_args, + '2': default_warn_args + [], + '3': default_warn_args + []} + # Assembly + self.can_compile_suffixes.add('s') + + def can_linker_accept_rsp(self): + return False + + def get_pic_args(self): + # FIXME: Add /ropi, /rwpi, /fpic etc. qualifiers to --apcs + return [] + + def get_buildtype_args(self, buildtype): + return arm_buildtype_args[buildtype] + + def get_buildtype_linker_args(self, buildtype): + return arm_buildtype_linker_args[buildtype] + + # Override CCompiler.get_always_args + def get_always_args(self): + return [] + + # Override CCompiler.get_dependency_gen_args + def get_dependency_gen_args(self, outtarget, outfile): + return [] + + # Override CCompiler.get_std_shared_lib_link_args + def get_std_shared_lib_link_args(self): + return [] + + def get_pch_use_args(self, pch_dir, header): + # FIXME: Add required arguments + # NOTE from armcc user guide: + # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05 + # onwards on all platforms. Note that ARM Compiler on Windows 8 never supported + # PCH files." + return [] + + def get_pch_suffix(self): + # NOTE from armcc user guide: + # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05 + # onwards on all platforms. Note that ARM Compiler on Windows 8 never supported + # PCH files." + return 'pch' + + def thread_flags(self, env): + return [] + + def thread_link_flags(self, env): + return [] + + def get_linker_exelist(self): + args = ['armlink'] + return args + + def get_coverage_args(self): + return [] + + def get_coverage_link_args(self): + return [] diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 3804059..8dd2306 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -27,6 +27,7 @@ from .compilers import ( GnuCompiler, ElbrusCompiler, IntelCompiler, + ArmCompiler, ) class CPPCompiler(CCompiler): @@ -239,3 +240,30 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): # Visual Studio C++ compiler doesn't support -fpermissive, # so just use the plain C args. return super(VisualStudioCCompiler, self).get_compiler_check_args() + + +class ArmCPPCompiler(ArmCompiler, CPPCompiler): + def __init__(self, exelist, version, is_cross, exe_wrap=None, **kwargs): + CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs) + ArmCompiler.__init__(self) + + def get_options(self): + opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', + ['none', 'c++03', 'c++11'], + 'none')} + return opts + + def get_option_compile_args(self, options): + args = [] + std = options['cpp_std'] + if std.value == 'c++11': + args.append('--cpp11') + elif std.value == 'c++03': + args.append('--cpp') + return args + + def get_option_link_args(self, options): + return [] + + def get_compiler_check_args(self): + return [] |