ICC 17.0.0 working for Linux and Ninja Backend.

Added IntelCompiler, IntelCCompiler and IntelCCompiler.
environments.py has been changed to detect icc and icpc.
ninjabackend changed for proper pch generation.

ICC 17.0.0 does not support C++13 (that's why default arguments tests fails).
Test 25 object extraction fails due to some unescaped whitespaces.
Some test with vala fail because of successful build, although they
should fail, as warning do not exit with failure.
pull/1253/head
Philipp Geier 8 years ago committed by Nirbheek Chauhan
parent 079e43f70b
commit 54697b4130
  1. 5
      mesonbuild/backend/ninjabackend.py
  2. 141
      mesonbuild/compilers.py
  3. 8
      mesonbuild/environment.py

@ -1837,6 +1837,8 @@ rule FORTRAN_DEP_HACK
pchlist = [] pchlist = []
if len(pchlist) == 0: if len(pchlist) == 0:
pch_dep = [] pch_dep = []
elif compiler.id == 'intel':
pch_dep = []
else: else:
arr = [] arr = []
i = os.path.join(self.get_target_private_dir(target), compiler.get_pch_name(pchlist[0])) i = os.path.join(self.get_target_private_dir(target), compiler.get_pch_name(pchlist[0]))
@ -1956,6 +1958,9 @@ rule FORTRAN_DEP_HACK
src = os.path.join(self.build_to_src, target.get_source_subdir(), pch[-1]) src = os.path.join(self.build_to_src, target.get_source_subdir(), pch[-1])
(commands, dep, dst, objs) = self.generate_msvc_pch_command(target, compiler, pch) (commands, dep, dst, objs) = self.generate_msvc_pch_command(target, compiler, pch)
extradep = os.path.join(self.build_to_src, target.get_source_subdir(), pch[0]) extradep = os.path.join(self.build_to_src, target.get_source_subdir(), pch[0])
elif compiler.id == 'intel':
# Intel generates on target generation
continue
else: else:
src = os.path.join(self.build_to_src, target.get_source_subdir(), pch[0]) src = os.path.join(self.build_to_src, target.get_source_subdir(), pch[0])
(commands, dep, dst, objs) = self.generate_gcc_pch_command(target, compiler, pch[0]) (commands, dep, dst, objs) = self.generate_gcc_pch_command(target, compiler, pch[0])

@ -1923,7 +1923,7 @@ class VisualStudioCCompiler(CCompiler):
def gen_pch_args(self, header, source, pchname): def gen_pch_args(self, header, source, pchname):
objname = os.path.splitext(pchname)[0] + '.obj' objname = os.path.splitext(pchname)[0] + '.obj'
return (objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname ]) return (objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname])
def gen_import_library_args(self, implibname): def gen_import_library_args(self, implibname):
"The name of the outputted import library" "The name of the outputted import library"
@ -2064,6 +2064,10 @@ CLANG_OSX = 1
CLANG_WIN = 2 CLANG_WIN = 2
# Possibly clang-cl? # Possibly clang-cl?
ICC_STANDARD = 0
ICC_OSX = 1
ICC_WIN = 2
def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module): def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module):
if soversion is None: if soversion is None:
sostr = '' sostr = ''
@ -2223,6 +2227,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
# too strict without this and always fails. # too strict without this and always fails.
return self.get_no_optimization_args() + ['-fpermissive'] return self.get_no_optimization_args() + ['-fpermissive']
class GnuObjCCompiler(GnuCompiler, ObjCCompiler): class GnuObjCCompiler(GnuCompiler, ObjCCompiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None, defines=None): def __init__(self, exelist, version, is_cross, exe_wrapper=None, defines=None):
@ -2283,7 +2288,7 @@ class ClangCompiler():
# Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136 # Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136
# This flag is internal to Clang (or at least not documented on the man page) # This flag is internal to Clang (or at least not documented on the man page)
# so it might change semantics at any time. # so it might change semantics at any time.
return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))] return ['-include-pch', os.path.join(pch_dir, self.get_pch_name(header))]
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module):
if self.clang_type == CLANG_STANDARD: if self.clang_type == CLANG_STANDARD:
@ -2378,6 +2383,137 @@ class ClangObjCPPCompiler(ClangCompiler, GnuObjCPPCompiler):
ClangCompiler.__init__(self, cltype) ClangCompiler.__init__(self, cltype)
self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage']
# Only tested on linux for ICC 17.0.0
# * object extraction does not compile (don't know) (25 object extraction fails)
# * ICC 17.0.0 does not support c++03 and g++03 (94 default options fails)
class IntelCompiler:
def __init__(self, icc_type):
self.id = 'intel'
self.icc_type = icc_type
self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage',
'b_colorout', 'b_ndebug', 'b_staticpic', 'b_lundef', 'b_asneeded']
# Assembly
self.can_compile_suffixes.add('s')
def get_pic_args(self):
return ['-fPIC']
def get_buildtype_args(self, buildtype):
return gnulike_buildtype_args[buildtype]
def get_buildtype_linker_args(self, buildtype):
return gnulike_buildtype_linker_args[buildtype]
def get_pch_suffix(self):
return 'pchi'
def get_pch_use_args(self, pch_dir, header):
return ['-pch', '-pch_dir', os.path.join(pch_dir), '-include', header]
def get_pch_name(self, header_name):
return os.path.split(header_name)[-1] + '.' + self.get_pch_suffix()
# Not required, but possible if backend should create pch files. However Intel does it automatically
# def gen_pch_args(self, header, source, pchname):
# return ['-pch_create', os.path.join(pchname, self.get_pch_name(header)), '-include', header, source])
def split_shlib_to_parts(self, fname):
return (os.path.split(fname)[0], fname)
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module):
if self.icc_type == ICC_STANDARD:
gcc_type = GCC_STANDARD
elif self.icc_type == ICC_OSX:
gcc_type = GCC_OSX
elif self.icc_type == ICC_WIN:
gcc_type = GCC_MINGW
else:
raise MesonException('Unreachable code when converting icc type to gcc type.')
return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module)
def get_std_shared_lib_link_args(self):
# Don't know how icc works on OSX
# if self.icc_type == ICC_OSX:
# return ['-bundle']
return ['-shared']
class IntelCCompiler(IntelCompiler, CCompiler):
def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None):
CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper)
IntelCompiler.__init__(self, icc_type)
self.warn_args = {'1': ['-Wall', '-w3', '-diag-disable:remark', '-Wpch-messages'],
'2': ['-Wall', '-w3', '-diag-disable:remark', '-Wextra-tokens', '-Wpch-messages'],
'3': ['-Wall', '-w3', '-diag-disable:remark', '-Wpedantic', '-Wextra', '-Wpch-messages']}
def get_options(self):
opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
['none', 'c89', 'c99',
'gnu89', 'gnu99'],
'none')}
return opts
def get_option_compile_args(self, options):
args = []
std = options['c_std']
if std.value != 'none':
args.append('-std=' + std.value)
return args
def get_std_shared_lib_link_args(self):
return ['-shared']
def has_multi_arguments(self, args, env):
return super(IntelCCompiler, self).has_multi_arguments(args + ['-diag-error', '10006'], env)
class IntelCPPCompiler(IntelCompiler, CPPCompiler):
def __init__(self, exelist, version, icc_type, is_cross, exe_wrap):
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap)
IntelCompiler.__init__(self, icc_type)
self.warn_args = {'1': ['-Wall', '-w3', '-diag-disable:remark', '-Wpch-messages', '-Wnon-virtual-dtor'],
'2': ['-Wall', '-w3', '-diag-disable:remark', '-Wextra', '-Wpch-messages', '-Wnon-virtual-dtor'],
'3': ['-Wall', '-w3', '-diag-disable:remark', '-Wpedantic', '-Wextra', '-Wpch-messages', '-Wnon-virtual-dtor']}
def get_options(self):
if mesonlib.version_compare(self.version, '>=17.0.0'):
opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none', 'c++11', 'c++0x', 'c++14',
'gnu++98', 'gnu++11', 'gnu++0x', 'gnu++14'],
'none'),
'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
'STL debug mode',
False)}
else:
opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none', 'c++03', 'c++11', 'c++0x',
'gnu++98', 'gnu++03', 'gnu++11', 'gnu++0x'],
'none'),
'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
'STL debug mode',
False)}
return opts
def get_option_compile_args(self, options):
args = []
std = options['cpp_std']
if std.value != 'none':
args.append('-std=' + std.value)
if options['cpp_debugstl'].value:
args.append('-D_GLIBCXX_DEBUG=1')
return args
def get_option_link_args(self, options):
return []
def get_compiler_check_args(self):
return self.get_no_optimization_args()
def has_multi_arguments(self, args, env):
return super(IntelCPPCompiler, self).has_multi_arguments(args + ['-diag-error', '10006'], env)
class FortranCompiler(Compiler): class FortranCompiler(Compiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None): def __init__(self, exelist, version, is_cross, exe_wrapper=None):
self.language = 'fortran' self.language = 'fortran'
@ -2634,6 +2770,7 @@ class NAGFortranCompiler(FortranCompiler):
class VisualStudioLinker(): class VisualStudioLinker():
always_args = ['/NOLOGO'] always_args = ['/NOLOGO']
def __init__(self, exelist): def __init__(self, exelist):
self.exelist = exelist self.exelist = exelist

@ -396,6 +396,10 @@ class Environment():
# everything else to stdout. Why? Lord only knows. # everything else to stdout. Why? Lord only knows.
version = search_version(err) version = search_version(err)
return VisualStudioCCompiler([compiler], version, is_cross, exe_wrap) return VisualStudioCCompiler([compiler], version, is_cross, exe_wrap)
if '(ICC)' in out:
# TODO: add microsoft add check OSX
inteltype = ICC_STANDARD
return IntelCCompiler(ccache + [compiler], version, inteltype, is_cross, exe_wrap)
errmsg = 'Unknown compiler(s): "' + ', '.join(compilers) + '"' errmsg = 'Unknown compiler(s): "' + ', '.join(compilers) + '"'
if popen_exceptions: if popen_exceptions:
errmsg += '\nThe follow exceptions were encountered:' errmsg += '\nThe follow exceptions were encountered:'
@ -525,6 +529,10 @@ class Environment():
if 'Microsoft' in out or 'Microsoft' in err: if 'Microsoft' in out or 'Microsoft' in err:
version = search_version(err) version = search_version(err)
return VisualStudioCPPCompiler([compiler], version, is_cross, exe_wrap) return VisualStudioCPPCompiler([compiler], version, is_cross, exe_wrap)
if '(ICC)' in out:
# TODO: add microsoft add check OSX
inteltype = ICC_STANDARD
return IntelCPPCompiler(ccache + [compiler], version, inteltype, is_cross, exe_wrap)
errmsg = 'Unknown compiler(s): "' + ', '.join(compilers) + '"' errmsg = 'Unknown compiler(s): "' + ', '.join(compilers) + '"'
if popen_exceptions: if popen_exceptions:
errmsg += '\nThe follow exceptions were encountered:' errmsg += '\nThe follow exceptions were encountered:'

Loading…
Cancel
Save