aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-08-22 18:31:56 +0300
committerGitHub <noreply@github.com>2020-08-22 18:31:56 +0300
commitc42298e1460f838710bfe1d33b5635bec25fa8ba (patch)
treefd8ab90e7626d52698b3b6fe86c397932d8a5359
parentfbc6d50acc2c6bbe67d5ac2c5432163fb3e7bd39 (diff)
parent0c5f3c7483c147652463a024aafe4bcb6bc8946c (diff)
downloadmeson-c42298e1460f838710bfe1d33b5635bec25fa8ba.zip
meson-c42298e1460f838710bfe1d33b5635bec25fa8ba.tar.gz
meson-c42298e1460f838710bfe1d33b5635bec25fa8ba.tar.bz2
Merge pull request #7447 from scivision/nvc
Add support for NVidia HPC SDK compilers
-rw-r--r--docs/markdown/Reference-tables.md1
-rw-r--r--docs/markdown/snippets/add_nvidia_hpc_sdk_compilers.md3
-rw-r--r--mesonbuild/compilers/__init__.py6
-rw-r--r--mesonbuild/compilers/c.py9
-rw-r--r--mesonbuild/compilers/cpp.py17
-rw-r--r--mesonbuild/compilers/fortran.py17
-rw-r--r--mesonbuild/environment.py27
-rw-r--r--mesonbuild/linkers.py6
8 files changed, 78 insertions, 8 deletions
diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md
index 3be129f..55c1a99 100644
--- a/docs/markdown/Reference-tables.md
+++ b/docs/markdown/Reference-tables.md
@@ -25,6 +25,7 @@ These are return values of the `get_id` (Compiler family) and
| mono | Xamarin C# compiler | |
| msvc | Microsoft Visual Studio | msvc |
| nagfor | The NAG Fortran compiler | |
+| nvidia_hpc| NVidia HPC SDK compilers | |
| open64 | The Open64 Fortran Compiler | |
| pathscale | The Pathscale Fortran compiler | |
| pgi | Portland PGI C/C++/Fortran compilers | |
diff --git a/docs/markdown/snippets/add_nvidia_hpc_sdk_compilers.md b/docs/markdown/snippets/add_nvidia_hpc_sdk_compilers.md
new file mode 100644
index 0000000..1d9acf9
--- /dev/null
+++ b/docs/markdown/snippets/add_nvidia_hpc_sdk_compilers.md
@@ -0,0 +1,3 @@
+## Added NVidia HPC SDK compilers
+
+Added support for `nvidia_hpc` NVidia HPC SDK compilers, which are currently in public beta testing.
diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py
index fd47545..2e673da 100644
--- a/mesonbuild/compilers/__init__.py
+++ b/mesonbuild/compilers/__init__.py
@@ -85,6 +85,9 @@ __all__ = [
'ObjCPPCompiler',
'Open64FortranCompiler',
'PathScaleFortranCompiler',
+ 'NvidiaHPC_CCompiler',
+ 'NvidiaHPC_CPPCompiler',
+ 'NvidiaHPC_FortranCompiler',
'PGICCompiler',
'PGICPPCompiler',
'PGIFortranCompiler',
@@ -135,6 +138,7 @@ from .c import (
EmscriptenCCompiler,
IntelCCompiler,
IntelClCCompiler,
+ NvidiaHPC_CCompiler,
PGICCompiler,
CcrxCCompiler,
Xc16CCompiler,
@@ -153,6 +157,7 @@ from .cpp import (
EmscriptenCPPCompiler,
IntelCPPCompiler,
IntelClCPPCompiler,
+ NvidiaHPC_CPPCompiler,
PGICPPCompiler,
CcrxCPPCompiler,
C2000CPPCompiler,
@@ -177,6 +182,7 @@ from .fortran import (
NAGFortranCompiler,
Open64FortranCompiler,
PathScaleFortranCompiler,
+ NvidiaHPC_FortranCompiler,
PGIFortranCompiler,
SunFortranCompiler,
)
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 95851be..936b04c 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -255,6 +255,15 @@ class PGICCompiler(PGICompiler, CCompiler):
PGICompiler.__init__(self)
+class NvidiaHPC_CCompiler(PGICompiler, CCompiler):
+ def __init__(self, exelist, version, for_machine: MachineChoice,
+ is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
+ CCompiler.__init__(self, exelist, version, for_machine, is_cross,
+ info, exe_wrapper, **kwargs)
+ PGICompiler.__init__(self)
+ self.id = 'nvidia_hpc'
+
+
class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index f2a160b..698c71a 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -156,7 +156,7 @@ class CPPCompiler(CLikeCompiler, Compiler):
class ClangCPPCompiler(ClangCompiler, CPPCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,
- defines : T.Optional[T.List[str]] = None, **kwargs):
+ defines: T.Optional[T.List[str]] = None, **kwargs):
CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
info, exe_wrapper, **kwargs)
ClangCompiler.__init__(self, defines)
@@ -240,8 +240,8 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
CPPCompiler.__init__(self, exelist=exelist, version=version,
- for_machine=for_machine, is_cross=is_cross,
- info=info, exe_wrapper=exe_wrapper, **kwargs)
+ for_machine=for_machine, is_cross=is_cross,
+ info=info, exe_wrapper=exe_wrapper, **kwargs)
ArmclangCompiler.__init__(self)
default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
self.warn_args = {'0': [],
@@ -305,7 +305,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
'std': coredata.UserComboOption(
'C++ language standard to use',
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a',
- 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'],
+ 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'],
'none',
),
'debugstl': coredata.UserBooleanOption(
@@ -356,6 +356,15 @@ class PGICPPCompiler(PGICompiler, CPPCompiler):
PGICompiler.__init__(self)
+class NvidiaHPC_CPPCompiler(PGICompiler, CPPCompiler):
+ def __init__(self, exelist, version, for_machine: MachineChoice,
+ is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
+ CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, **kwargs)
+ PGICompiler.__init__(self)
+
+ self.id = 'nvidia_hpc'
+
+
class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index af83c0e56..7ca3073 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -418,6 +418,23 @@ class PGIFortranCompiler(PGICompiler, FortranCompiler):
return ['-lpgf90rtl', '-lpgf90', '-lpgf90_rpm1', '-lpgf902',
'-lpgf90rtl', '-lpgftnrtl', '-lrt']
+
+class NvidiaHPC_FortranCompiler(PGICompiler, FortranCompiler):
+ def __init__(self, exelist, version, for_machine: MachineChoice,
+ is_cross, info: 'MachineInfo', exe_wrapper=None,
+ **kwargs):
+ FortranCompiler.__init__(self, exelist, version, for_machine,
+ is_cross, info, exe_wrapper, **kwargs)
+ PGICompiler.__init__(self)
+
+ self.id = 'nvidia_hpc'
+ default_warn_args = ['-Minform=inform']
+ self.warn_args = {'0': [],
+ '1': default_warn_args,
+ '2': default_warn_args,
+ '3': default_warn_args + ['-Mdclchk']}
+
+
class FlangFortranCompiler(ClangCompiler, FortranCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index da2d513..18ecff4 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -58,6 +58,8 @@ from .linkers import (
QualcommLLVMDynamicLinker,
MSVCDynamicLinker,
OptlinkDynamicLinker,
+ NvidiaHPC_DynamicLinker,
+ NvidiaHPC_StaticLinker,
PGIDynamicLinker,
PGIStaticLinker,
SolarisDynamicLinker,
@@ -105,6 +107,9 @@ from .compilers import (
NAGFortranCompiler,
Open64FortranCompiler,
PathScaleFortranCompiler,
+ NvidiaHPC_CCompiler,
+ NvidiaHPC_CPPCompiler,
+ NvidiaHPC_FortranCompiler,
PGICCompiler,
PGICPPCompiler,
PGIFortranCompiler,
@@ -768,11 +773,11 @@ class Environment:
self.default_objc = []
self.default_objcpp = []
else:
- self.default_c = ['cc', 'gcc', 'clang', 'pgcc', 'icc']
- self.default_cpp = ['c++', 'g++', 'clang++', 'pgc++', 'icpc']
+ self.default_c = ['cc', 'gcc', 'clang', 'nvc', 'pgcc', 'icc']
+ self.default_cpp = ['c++', 'g++', 'clang++', 'nvc++', 'pgc++', 'icpc']
self.default_objc = ['cc', 'gcc', 'clang']
self.default_objcpp = ['c++', 'g++', 'clang++']
- self.default_fortran = ['gfortran', 'flang', 'pgfortran', 'ifort', 'g95']
+ self.default_fortran = ['gfortran', 'flang', 'nvfortran', 'pgfortran', 'ifort', 'g95']
self.default_cs = ['mcs', 'csc']
self.default_d = ['ldc2', 'ldc', 'gdc', 'dmd']
self.default_java = ['javac']
@@ -1303,6 +1308,13 @@ class Environment:
return cls(
ccache + compiler, version, for_machine, is_cross,
info, exe_wrap, linker=linker)
+ if 'NVIDIA Compilers and Tools' in out:
+ cls = NvidiaHPC_CCompiler if lang == 'c' else NvidiaHPC_CPPCompiler
+ self.coredata.add_lang_args(cls.language, cls, for_machine, self)
+ linker = NvidiaHPC_DynamicLinker(compiler, for_machine, cls.LINKER_PREFIX, [], version=version)
+ return cls(
+ ccache + compiler, version, for_machine, is_cross,
+ info, exe_wrap, linker=linker)
if '(ICC)' in out:
cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler
l = self._guess_nix_linker(compiler, cls, for_machine)
@@ -1474,6 +1486,15 @@ class Environment:
compiler, version, for_machine, is_cross, info, exe_wrap,
full_version=full_version, linker=linker)
+ if 'NVIDIA Compilers and Tools' in out:
+ cls = NvidiaHPC_FortranCompiler
+ self.coredata.add_lang_args(cls.language, cls, for_machine, self)
+ linker = PGIDynamicLinker(compiler, for_machine,
+ cls.LINKER_PREFIX, [], version=version)
+ return cls(
+ compiler, version, for_machine, is_cross, info, exe_wrap,
+ full_version=full_version, linker=linker)
+
if 'flang' in out or 'clang' in out:
linker = self._guess_nix_linker(
compiler, FlangFortranCompiler, for_machine)
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index 3ce7111..505aef6 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -712,7 +712,7 @@ class GnuDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dynam
"""Representation of GNU ld.bfd and ld.gold."""
def get_accepts_rsp(self) -> bool:
- return True;
+ return True
class GnuGoldDynamicLinker(GnuDynamicLinker):
@@ -964,6 +964,8 @@ class PGIDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
return (['-R' + os.path.join(build_dir, p) for p in rpath_paths], set())
return ([], set())
+NvidiaHPC_DynamicLinker = PGIDynamicLinker
+
class PGIStaticLinker(StaticLinker):
def __init__(self, exelist: T.List[str]):
@@ -977,6 +979,8 @@ class PGIStaticLinker(StaticLinker):
def get_output_args(self, target: str) -> T.List[str]:
return [target]
+NvidiaHPC_StaticLinker = PGIStaticLinker
+
class VisualStudioLikeLinkerMixin: