- 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',
'ARMCCompiler',
'ARMCPPCompiler',
'CCompiler',
'ClangCCompiler',
'ClangCompiler',
@ -125,6 +126,7 @@ from .c import (
VisualStudioCCompiler,
)
from .cpp import (
ARMCPPCompiler,
CPPCompiler,
ClangCPPCompiler,
GnuCPPCompiler,

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

@ -114,10 +114,10 @@ gnulike_buildtype_args = {'plain': [],
'minsize': ['-Os', '-g']}
arm_buildtype_args = {'plain': [],
'debug': ['-O0', '-g'],
'debugoptimized': ['-O2', '-g'],
'release': ['-O2'],
'minsize': ['-Os', '-g'],
'debug': ['-O0', '--debug'],
'debugoptimized': ['-O1', '--debug'],
'release': ['-O3', '-Otime'],
'minsize': ['-O3', '-Ospace'],
}
msvc_buildtype_args = {'plain': [],
@ -1118,6 +1118,26 @@ class ARMCompiler:
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
@ -1128,6 +1148,12 @@ class ARMCompiler:
def split_shlib_to_parts(self, fname):
return os.path.split(fname)[0], fname
def thread_flags(self, env):
return []
def thread_link_flags(self, env):
return []
class ClangCompiler:
def __init__(self, clang_type):

@ -26,6 +26,7 @@ from .compilers import (
ClangCompiler,
GnuCompiler,
IntelCompiler,
ARMCompiler,
)
class CPPCompiler(CCompiler):
@ -133,6 +134,35 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
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):
def __init__(self, exelist, version, icc_type, 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 (
ARMCCompiler,
ARMCPPCompiler,
ClangCCompiler,
ClangCPPCompiler,
ClangObjCCompiler,
@ -493,7 +494,7 @@ class Environment:
continue
arg = '/?'
else:
if re.search('.*arm.*', compiler[0]):
if compiler[0] == 'armcc':
arg = '--vsn'
else:
arg = '--version'
@ -542,7 +543,8 @@ class Environment:
cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler
return cls(ccache + compiler, version, inteltype, is_cross, exe_wrap, full_version=full_version)
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)
def detect_c_compiler(self, want_cross):
@ -796,9 +798,6 @@ class Environment:
for linker in linkers:
if 'lib' in linker or 'lib.exe' in linker:
arg = '/?'
else:
if re.search('.*arm.*', linker[0]):
arg = '--vsn'
else:
arg = '--version'
try:

Loading…
Cancel
Save