aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-04-07 00:52:03 -0400
committerMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-04-27 23:19:01 -0400
commitee40533b61ba9694e783e3333362e91fff964171 (patch)
tree2903353b6169c0507a3a98864d426637c83d5b24
parent25fa5d090fab2522082280ea36484bd4ac9e9aa2 (diff)
downloadmeson-ee40533b61ba9694e783e3333362e91fff964171.zip
meson-ee40533b61ba9694e783e3333362e91fff964171.tar.gz
meson-ee40533b61ba9694e783e3333362e91fff964171.tar.bz2
better default order for fotran compiler search
correct PGI windows detection doc cleanup PGI detect
-rw-r--r--mesonbuild/compilers/c.py4
-rw-r--r--mesonbuild/compilers/compilers.py15
-rw-r--r--mesonbuild/compilers/cpp.py4
-rw-r--r--mesonbuild/compilers/fortran.py4
-rw-r--r--mesonbuild/environment.py21
5 files changed, 35 insertions, 13 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 94ef336..160e45d 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -1324,9 +1324,9 @@ class GnuCCompiler(GnuCompiler, CCompiler):
class PGICCompiler(PGICompiler, CCompiler):
- def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwargs):
+ def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, **kwargs):
CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs)
- PGICompiler.__init__(self, CompilerType.PGI_STANDARD)
+ PGICompiler.__init__(self, compiler_type)
class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler):
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 87a83e5..04cc31a 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1397,18 +1397,20 @@ class CompilerType(enum.Enum):
CCRX_WIN = 40
PGI_STANDARD = 50
+ PGI_OSX = 51
+ PGI_WIN = 52
@property
def is_standard_compiler(self):
- return self.name in ('GCC_STANDARD', 'CLANG_STANDARD', 'ICC_STANDARD')
+ return self.name in ('GCC_STANDARD', 'CLANG_STANDARD', 'ICC_STANDARD', 'PGI_STANDARD')
@property
def is_osx_compiler(self):
- return self.name in ('GCC_OSX', 'CLANG_OSX', 'ICC_OSX')
+ return self.name in ('GCC_OSX', 'CLANG_OSX', 'ICC_OSX', 'PGI_OSX')
@property
def is_windows_compiler(self):
- return self.name in ('GCC_MINGW', 'GCC_CYGWIN', 'CLANG_MINGW', 'ICC_WIN', 'ARM_WIN', 'CCRX_WIN')
+ return self.name in ('GCC_MINGW', 'GCC_CYGWIN', 'CLANG_MINGW', 'ICC_WIN', 'ARM_WIN', 'CCRX_WIN', 'PGI_WIN')
def get_macos_dylib_install_name(prefix, shlib_name, suffix, soversion):
@@ -1690,7 +1692,7 @@ class GnuCompiler(GnuLikeCompiler):
class PGICompiler:
- def __init__(self, compiler_type=None):
+ def __init__(self, compiler_type):
self.id = 'pgi'
self.compiler_type = compiler_type
@@ -1706,6 +1708,11 @@ class PGICompiler:
def get_no_warn_args(self) -> List[str]:
return ['-silent']
+ def get_pic_args(self) -> List[str]:
+ if self.compiler_type.is_osx_compiler or self.compiler_type.is_windows_compiler:
+ return [] # PGI -fPIC is Linux only.
+ return ['-fPIC']
+
def openmp_flags(self) -> List[str]:
return ['-mp']
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index 87e6ffc..55be58d 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -238,9 +238,9 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
class PGICPPCompiler(PGICompiler, CPPCompiler):
- def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwargs):
+ def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, **kwargs):
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs)
- PGICompiler.__init__(self, CompilerType.PGI_STANDARD)
+ PGICompiler.__init__(self, compiler_type)
class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler):
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index 0f7c38e..dd54fd0 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -423,9 +423,9 @@ class PathScaleFortranCompiler(FortranCompiler):
class PGIFortranCompiler(PGICompiler, FortranCompiler):
- def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags):
+ def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, **kwags):
FortranCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwags)
- PGICompiler.__init__(self, CompilerType.PGI_STANDARD)
+ PGICompiler.__init__(self, compiler_type)
class FlangFortranCompiler(ClangCompiler, FortranCompiler):
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 57fe4e5..e0cb998 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -13,6 +13,7 @@
# limitations under the License.
import os, platform, re, sys, shlex, shutil, subprocess
+from typing import List
from . import coredata
from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, DLinker, CcrxLinker
@@ -769,9 +770,16 @@ class Environment:
target = 'x86'
cls = VisualStudioCCompiler if lang == 'c' else VisualStudioCPPCompiler
return cls(compiler, version, is_cross, exe_wrap, target)
+
if 'PGI Compilers' in out:
+ if mesonlib.for_darwin(want_cross, self):
+ compiler_type = CompilerType.PGI_OSX
+ elif mesonlib.for_windows(want_cross, self):
+ compiler_type = CompilerType.PGI_WIN
+ else:
+ compiler_type = CompilerType.PGI_STANDARD
cls = PGICCompiler if lang == 'c' else PGICPPCompiler
- return cls(ccache + compiler, version, is_cross, exe_wrap)
+ return cls(ccache + compiler, version, compiler_type, is_cross, exe_wrap)
if '(ICC)' in out:
if mesonlib.for_darwin(want_cross, self):
compiler_type = CompilerType.ICC_OSX
@@ -883,7 +891,13 @@ class Environment:
return PathScaleFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)
if 'PGI Compilers' in out:
- return PGIFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)
+ if mesonlib.for_darwin(want_cross, self):
+ compiler_type = CompilerType.PGI_OSX
+ elif mesonlib.for_windows(want_cross, self):
+ compiler_type = CompilerType.PGI_WIN
+ else:
+ compiler_type = CompilerType.PGI_STANDARD
+ return PGIFortranCompiler(compiler, version, compiler_type, is_cross, exe_wrap, full_version=full_version)
if 'flang' in out or 'clang' in out:
return FlangFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)
@@ -1039,7 +1053,8 @@ 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 doesn\'t support %s as it\'s 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.' % exelist[-1])
+ raise EnvironmentException('Meson does not support {} as it is only a DMD frontend for another compiler.'.format(exelist[-1])
+ 'Please provide a valid value for DC or unset it so that Meson can resolve the compiler by itself.')
else:
for d in self.default_d:
if shutil.which(d):