- Updating cpp_std options similar to other compiler classes

- Updating environment.py for selecting '--vsn' option for armcc only.
- Updating build type arguments from GitHub pull request - 3157

Change-Id: Id3151e7715ec1016afdbd65391bb0d414ec7de13
pull/3186/head
Bedarkar, Malhar 7 years ago
parent 93bdbc3162
commit 831d1e4c2e
  1. 2
      mesonbuild/compilers/__init__.py
  2. 20
      mesonbuild/compilers/c.py
  3. 34
      mesonbuild/compilers/compilers.py
  4. 30
      mesonbuild/compilers/cpp.py
  5. 9
      mesonbuild/environment.py

@ -43,6 +43,7 @@ __all__ = [
'ARMCompiler', 'ARMCompiler',
'ARMCCompiler', 'ARMCCompiler',
'ARMCPPCompiler',
'CCompiler', 'CCompiler',
'ClangCCompiler', 'ClangCCompiler',
'ClangCompiler', 'ClangCompiler',
@ -125,6 +126,7 @@ from .c import (
VisualStudioCCompiler, VisualStudioCCompiler,
) )
from .cpp import ( from .cpp import (
ARMCPPCompiler,
CPPCompiler, CPPCompiler,
ClangCPPCompiler, ClangCPPCompiler,
GnuCPPCompiler, GnuCPPCompiler,

@ -917,10 +917,6 @@ class ARMCCompiler(ARMCompiler, CCompiler):
def get_coverage_link_args(self): def get_coverage_link_args(self):
return [] return []
# Override CCompiler.get_always_args
def get_always_args(self):
return []
def get_option_compile_args(self, options): def get_option_compile_args(self, options):
return [] return []
@ -928,22 +924,6 @@ class ARMCCompiler(ARMCompiler, CCompiler):
args = ['armlink'] args = ['armlink']
return args return args
# 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_compile_only_args(self): def get_compile_only_args(self):
return ['-c'] return ['-c']

@ -114,10 +114,10 @@ gnulike_buildtype_args = {'plain': [],
'minsize': ['-Os', '-g']} 'minsize': ['-Os', '-g']}
arm_buildtype_args = {'plain': [], arm_buildtype_args = {'plain': [],
'debug': ['-O0', '-g'], 'debug': ['-O0', '--debug'],
'debugoptimized': ['-O2', '-g'], 'debugoptimized': ['-O1', '--debug'],
'release': ['-O2'], 'release': ['-O3', '-Otime'],
'minsize': ['-Os', '-g'], 'minsize': ['-O3', '-Ospace'],
} }
msvc_buildtype_args = {'plain': [], msvc_buildtype_args = {'plain': [],
@ -1118,6 +1118,26 @@ class ARMCompiler:
def get_buildtype_linker_args(self, buildtype): def get_buildtype_linker_args(self, buildtype):
return arm_buildtype_linker_args[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): def get_pch_suffix(self):
# NOTE from armcc user guide: # NOTE from armcc user guide:
# "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05 # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05
@ -1128,6 +1148,12 @@ class ARMCompiler:
def split_shlib_to_parts(self, fname): def split_shlib_to_parts(self, fname):
return os.path.split(fname)[0], fname return os.path.split(fname)[0], fname
def thread_flags(self, env):
return []
def thread_link_flags(self, env):
return []
class ClangCompiler: class ClangCompiler:
def __init__(self, clang_type): def __init__(self, clang_type):

@ -26,6 +26,7 @@ from .compilers import (
ClangCompiler, ClangCompiler,
GnuCompiler, GnuCompiler,
IntelCompiler, IntelCompiler,
ARMCompiler,
) )
class CPPCompiler(CCompiler): class CPPCompiler(CCompiler):
@ -133,6 +134,35 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
return ['-fpch-preprocess', '-include', os.path.basename(header)] return ['-fpch-preprocess', '-include', os.path.basename(header)]
class ARMCPPCompiler(ARMCompiler, CPPCompiler):
def __init__(self, exelist, version, is_cross, exe_wrap=None, defines=None, **kwargs):
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs)
ARMCompiler.__init__(self, defines)
default_warn_args = []
self.warn_args = {'1': default_warn_args,
'2': default_warn_args + [],
'3': default_warn_args + []}
def get_options(self):
opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none', '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')
return args
def get_option_link_args(self, options):
return []
def get_compiler_check_args(self):
return []
class IntelCPPCompiler(IntelCompiler, CPPCompiler): class IntelCPPCompiler(IntelCompiler, CPPCompiler):
def __init__(self, exelist, version, icc_type, is_cross, exe_wrap, **kwargs): def __init__(self, exelist, version, icc_type, is_cross, exe_wrap, **kwargs):
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs) CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs)

@ -39,6 +39,7 @@ from .compilers import (
) )
from .compilers import ( from .compilers import (
ARMCCompiler, ARMCCompiler,
ARMCPPCompiler,
ClangCCompiler, ClangCCompiler,
ClangCPPCompiler, ClangCPPCompiler,
ClangObjCCompiler, ClangObjCCompiler,
@ -493,7 +494,7 @@ class Environment:
continue continue
arg = '/?' arg = '/?'
else: else:
if re.search('.*arm.*', compiler[0]): if compiler[0] == 'armcc':
arg = '--vsn' arg = '--vsn'
else: else:
arg = '--version' arg = '--version'
@ -542,7 +543,8 @@ class Environment:
cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler
return cls(ccache + compiler, version, inteltype, is_cross, exe_wrap, full_version=full_version) return cls(ccache + compiler, version, inteltype, is_cross, exe_wrap, full_version=full_version)
if 'ARM' in out: if 'ARM' in out:
return ARMCCompiler(ccache + compiler, version, is_cross, exe_wrap, full_version=full_version) cls = ARMCCompiler if lang == 'c' else ARMCPPCompiler
return cls(ccache + compiler, version, is_cross, exe_wrap, full_version=full_version)
self._handle_exceptions(popen_exceptions, compilers) self._handle_exceptions(popen_exceptions, compilers)
def detect_c_compiler(self, want_cross): def detect_c_compiler(self, want_cross):
@ -796,9 +798,6 @@ class Environment:
for linker in linkers: for linker in linkers:
if 'lib' in linker or 'lib.exe' in linker: if 'lib' in linker or 'lib.exe' in linker:
arg = '/?' arg = '/?'
else:
if re.search('.*arm.*', linker[0]):
arg = '--vsn'
else: else:
arg = '--version' arg = '--version'
try: try:

Loading…
Cancel
Save