diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-09-01 15:19:38 -0400 |
---|---|---|
committer | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-09-05 11:50:17 -0400 |
commit | c8d380e4ef11cd1a72c785418f41dd420fbf6d1b (patch) | |
tree | 228197eb356c56d842588e4c014945072e7ff994 | |
parent | caec875fe1922b40037e1fd9229433ede64f9f25 (diff) | |
download | meson-c8d380e4ef11cd1a72c785418f41dd420fbf6d1b.zip meson-c8d380e4ef11cd1a72c785418f41dd420fbf6d1b.tar.gz meson-c8d380e4ef11cd1a72c785418f41dd420fbf6d1b.tar.bz2 |
PGI: use ar link wrapper on Windows
-rw-r--r-- | mesonbuild/compilers/mixins/pgi.py | 2 | ||||
-rw-r--r-- | mesonbuild/environment.py | 5 | ||||
-rw-r--r-- | mesonbuild/linkers.py | 16 |
3 files changed, 20 insertions, 3 deletions
diff --git a/mesonbuild/compilers/mixins/pgi.py b/mesonbuild/compilers/mixins/pgi.py index c13c7bc..a9e30b6 100644 --- a/mesonbuild/compilers/mixins/pgi.py +++ b/mesonbuild/compilers/mixins/pgi.py @@ -56,7 +56,7 @@ class PGICompiler: def get_pic_args(self) -> typing.List[str]: # PGI -fPIC is Linux only. - if self.compiler_type.is_linux_compiler(): + if self.compiler_type.is_standard_compiler: return ['-fPIC'] return [] diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 7e1ca9d..9efc94e 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -51,6 +51,7 @@ from .linkers import ( MSVCDynamicLinker, OptlinkDynamicLinker, PGIDynamicLinker, + PGIStaticLinker, SolarisDynamicLinker, XildAppleDynamicLinker, XildLinuxDynamicLinker, @@ -1340,6 +1341,8 @@ class Environment: elif isinstance(compiler, IntelClCCompiler): # Intel has it's own linker that acts like microsoft's lib linkers = ['xilib'] + elif isinstance(compiler, (PGICCompiler, PGIFortranCompiler)) and mesonlib.is_windows(): + linkers = [self.default_static_linker] # this is just a wrapper calling link/lib on Windows, keeping things simple. else: linkers = [self.default_static_linker] popen_exceptions = {} @@ -1357,6 +1360,8 @@ class Environment: return IntelVisualStudioLinker(linker, getattr(compiler, 'machine', None)) if '/OUT:' in out.upper() or '/OUT:' in err.upper(): return VisualStudioLinker(linker, getattr(compiler, 'machine', None)) + if 'ar-Error-Unknown switch: --version' in err: + return PGIStaticLinker(linker) if p.returncode == 0 and ('armar' in linker or 'armar.exe' in linker): return ArmarLinker(linker) if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out: diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index 6cce78b..e8218b0 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -740,18 +740,30 @@ class PGIDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): # PGI -shared is Linux only. if mesonlib.is_windows(): return ['-Bdynamic', '-Mmakedll'] - elif mesonlib.is_linux: + elif mesonlib.is_linux(): return ['-shared'] return [] def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str, rpath_paths: str, build_rpath: str, install_rpath: str) -> typing.List[str]: - if env.machines[self.for_machine].is_windows(): + if not env.machines[self.for_machine].is_windows(): return ['-R' + os.path.join(build_dir, p) for p in rpath_paths] return [] +class PGIStaticLinker(StaticLinker): + def __init__(self, exelist: typing.List[str]): + super().__init__(exelist) + self.id = 'ar' + self.std_args = ['-r'] + + def get_std_link_args(self) -> typing.List[str]: + return self.std_args + + def get_output_args(self, target: str) -> typing.List[str]: + return [target] + class VisualStudioLikeLinkerMixin: _BUILDTYPE_ARGS = { |