aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-05-05 22:38:41 +0300
committerGitHub <noreply@github.com>2019-05-05 22:38:41 +0300
commit23f831a67497135091bcb44675ff5a7fb9ce8425 (patch)
treeee284561d8d053566a13f82b7e9ee447d765db9b /mesonbuild/environment.py
parenta0cf7ad3d8fbafacb7146488d8e56c301646aa92 (diff)
parent541523eebab8f62b182643296deab26a47117f6f (diff)
downloadmeson-23f831a67497135091bcb44675ff5a7fb9ce8425.zip
meson-23f831a67497135091bcb44675ff5a7fb9ce8425.tar.gz
meson-23f831a67497135091bcb44675ff5a7fb9ce8425.tar.bz2
Merge pull request #5339 from dcbaker/clike
Split up the representations of the C and C++ compilers
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py39
1 files changed, 11 insertions, 28 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 462672e..dd1d4cf 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -61,8 +61,6 @@ from .compilers import (
IntelCCompiler,
IntelCPPCompiler,
IntelFortranCompiler,
- IntelClCCompiler,
- IntelClCPPCompiler,
JavaCompiler,
MonoCompiler,
CudaCompiler,
@@ -681,7 +679,6 @@ class Environment:
arg = '-v'
else:
arg = '--version'
-
try:
p, out, err = Popen_safe(compiler + [arg])
except OSError as e:
@@ -690,11 +687,6 @@ class Environment:
if 'ccrx' in compiler[0]:
out = err
- if 'icl' in compiler[0]:
- # https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-alphabetical-list-of-compiler-options
- # https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-logo
- # most consistent way for ICL is to just let compiler error and tell version
- out = err
full_version = out.split('\n', 1)[0]
version = search_version(out)
@@ -782,9 +774,9 @@ class Environment:
return cls(compiler, version, is_cross, exe_wrap, target)
if 'PGI Compilers' in out:
- if mesonlib.for_darwin(is_cross, self):
+ if mesonlib.for_darwin(want_cross, self):
compiler_type = CompilerType.PGI_OSX
- elif mesonlib.for_windows(is_cross, self):
+ elif mesonlib.for_windows(want_cross, self):
compiler_type = CompilerType.PGI_WIN
else:
compiler_type = CompilerType.PGI_STANDARD
@@ -794,15 +786,12 @@ class Environment:
if mesonlib.for_darwin(want_cross, self):
compiler_type = CompilerType.ICC_OSX
elif mesonlib.for_windows(want_cross, self):
- raise EnvironmentException('At the time of authoring, there was no ICC for Windows')
+ # TODO: fix ICC on Windows
+ compiler_type = CompilerType.ICC_WIN
else:
compiler_type = CompilerType.ICC_STANDARD
cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler
return cls(ccache + compiler, version, compiler_type, is_cross, exe_wrap, full_version=full_version)
- if out.startswith('Intel(R) C++') and mesonlib.for_windows(want_cross, self):
- cls = IntelClCCompiler if lang == 'c' else IntelClCPPCompiler
- target = 'x64' if 'Intel(R) 64 Compiler' in out else 'x86'
- return cls(compiler, version, is_cross, exe_wrap, target)
if 'ARM' in out:
compiler_type = CompilerType.ARM_WIN
cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler
@@ -867,13 +856,6 @@ class Environment:
popen_exceptions[' '.join(compiler + [arg])] = e
continue
- if mesonlib.for_windows(is_cross, self):
- if 'ifort' in compiler[0]:
- # https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-alphabetical-list-of-compiler-options
- # https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-logo
- # most consistent way for ICL is to just let compiler error and tell version
- out = err
-
version = search_version(out)
full_version = out.split('\n', 1)[0]
@@ -904,16 +886,16 @@ class Environment:
version = search_version(err)
return SunFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)
- if 'ifort (IFORT)' in out or out.startswith('Intel(R) Visual Fortran'):
+ if 'ifort (IFORT)' in out:
return IntelFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)
if 'PathScale EKOPath(tm)' in err:
return PathScaleFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)
if 'PGI Compilers' in out:
- if mesonlib.for_darwin(is_cross, self):
+ if mesonlib.for_darwin(want_cross, self):
compiler_type = CompilerType.PGI_OSX
- elif mesonlib.for_windows(is_cross, self):
+ elif mesonlib.for_windows(want_cross, self):
compiler_type = CompilerType.PGI_WIN
else:
compiler_type = CompilerType.PGI_STANDARD
@@ -1073,8 +1055,9 @@ class Environment:
# up to date language version at time (2016).
if exelist is not None:
if os.path.basename(exelist[-1]).startswith(('ldmd', 'gdmd')):
- raise EnvironmentException('Meson does not support {} as it is only a DMD frontend for another compiler.'
- 'Please provide a valid value for DC or unset it so that Meson can resolve the compiler by itself.'.format(exelist[-1]))
+ raise EnvironmentException(
+ 'Meson does not support {} as it is only a DMD frontend for another compiler.'
+ 'Please provide a valid value for DC or unset it so that Meson can resolve the compiler by itself.'.format(exelist[-1]))
else:
for d in self.default_d:
if shutil.which(d):
@@ -1175,7 +1158,7 @@ class Environment:
linkers = [self.cuda_static_linker, self.default_static_linker]
elif evar in os.environ:
linkers = [shlex.split(os.environ[evar])]
- elif isinstance(compiler, compilers.VisualStudioCCompiler):
+ elif isinstance(compiler, compilers.VisualStudioLikeCompiler):
linkers = [self.vs_static_linker, self.clang_cl_static_linker]
elif isinstance(compiler, compilers.GnuCompiler):
# Use gcc-ar if available; needed for LTO