Implemented some missing operation for the NAG Fortran Compiler.

pull/9239/head
Mat Cross 3 years ago committed by Eli Schwartz
parent 3f796c43df
commit 0e86258748
  1. 12
      mesonbuild/compilers/detect.py
  2. 20
      mesonbuild/compilers/fortran.py
  3. 2
      mesonbuild/linkers/__init__.py
  4. 30
      mesonbuild/linkers/linkers.py

@ -34,6 +34,7 @@ from ..linkers import (
C2000Linker, C2000Linker,
C2000DynamicLinker, C2000DynamicLinker,
DLinker, DLinker,
NAGDynamicLinker,
NvidiaHPC_DynamicLinker, NvidiaHPC_DynamicLinker,
PGIDynamicLinker, PGIDynamicLinker,
PGIStaticLinker, PGIStaticLinker,
@ -774,9 +775,14 @@ def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> C
exe_wrap, full_version=full_version, linker=linker) exe_wrap, full_version=full_version, linker=linker)
if 'NAG Fortran' in err: if 'NAG Fortran' in err:
linker = guess_nix_linker(env, full_version = err.split('\n', 1)[0]
compiler, NAGFortranCompiler, for_machine) version = full_version.split()[-1]
return NAGFortranCompiler( cls = NAGFortranCompiler
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
linker = NAGDynamicLinker(
compiler, for_machine, cls.LINKER_PREFIX, [],
version=version)
return cls(
compiler, version, for_machine, is_cross, info, compiler, version, for_machine, is_cross, info,
exe_wrap, full_version=full_version, linker=linker) exe_wrap, full_version=full_version, linker=linker)

@ -494,12 +494,28 @@ class NAGFortranCompiler(FortranCompiler):
is_cross, info, exe_wrapper, linker=linker, is_cross, info, exe_wrapper, linker=linker,
full_version=full_version) full_version=full_version)
self.id = 'nagfor' self.id = 'nagfor'
self.warn_args = {
'0': ['-w=all'],
'1': [],
'2': [],
'3': [],
}
def get_warn_args(self, level: str) -> T.List[str]: def get_always_args(self) -> T.List[str]:
return [] return self.get_nagfor_quiet(self.version)
def get_module_outdir_args(self, path: str) -> T.List[str]: def get_module_outdir_args(self, path: str) -> T.List[str]:
return ['-mdir', path] return ['-mdir', path]
@staticmethod
def get_nagfor_quiet(version: str) -> T.List[str]:
return ['-quiet'] if version_compare(version, '>=7100') else []
def get_pic_args(self) -> T.List[str]:
return ['-PIC']
def get_std_exe_link_args(self) -> T.List[str]:
return self.get_always_args()
def openmp_flags(self) -> T.List[str]: def openmp_flags(self) -> T.List[str]:
return ['-openmp'] return ['-openmp']

@ -53,6 +53,7 @@ from .linkers import (
QualcommLLVMDynamicLinker, QualcommLLVMDynamicLinker,
PGIDynamicLinker, PGIDynamicLinker,
NvidiaHPC_DynamicLinker, NvidiaHPC_DynamicLinker,
NAGDynamicLinker,
VisualStudioLikeLinkerMixin, VisualStudioLikeLinkerMixin,
MSVCDynamicLinker, MSVCDynamicLinker,
@ -110,6 +111,7 @@ __all__ = [
'QualcommLLVMDynamicLinker', 'QualcommLLVMDynamicLinker',
'PGIDynamicLinker', 'PGIDynamicLinker',
'NvidiaHPC_DynamicLinker', 'NvidiaHPC_DynamicLinker',
'NAGDynamicLinker',
'VisualStudioLikeLinkerMixin', 'VisualStudioLikeLinkerMixin',
'MSVCDynamicLinker', 'MSVCDynamicLinker',

@ -1045,6 +1045,36 @@ class QualcommLLVMDynamicLinker(LLVMDynamicLinker):
id = 'ld.qcld' id = 'ld.qcld'
class NAGDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
"""NAG Fortran linker, ld via gcc indirection."""
id = 'nag'
def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
rpath_paths: str, build_rpath: str,
install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
if not rpath_paths and not install_rpath and not build_rpath:
return ([], set())
args = []
origin_placeholder = '$ORIGIN'
processed_rpaths = prepare_rpaths(rpath_paths, build_dir, from_dir)
all_paths = mesonlib.OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths])
if build_rpath != '':
all_paths.add(build_rpath)
for rp in all_paths:
args.extend(self._apply_prefix('-Wl,-Wl,,-rpath,,' + rp))
return (args, set())
def get_allow_undefined_args(self) -> T.List[str]:
return []
def get_std_shared_lib_args(self) -> T.List[str]:
from ..compilers import NAGFortranCompiler
return NAGFortranCompiler.get_nagfor_quiet(self.version) + ['-Wl,-shared']
class PGIDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): class PGIDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
"""PGI linker.""" """PGI linker."""

Loading…
Cancel
Save