summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Meagher <11620178+kjmeagher@users.noreply.github.com>2024-05-30 23:14:29 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2024-10-11 22:45:24 +0300
commitd3542ff690d0be723cfd3ebfaaac99290517837f (patch)
treeeeef76421910c5cdd355238ff97c9835d5713448
parent84070410f3fca7781fd1234315e06aae9966bd87 (diff)
downloadmeson-d3542ff690d0be723cfd3ebfaaac99290517837f.tar.gz
Add options for standard parameter for nvc and nvc++
fixes #13271
-rw-r--r--docs/markdown/snippets/nvc_now_support_setting_std.md6
-rw-r--r--mesonbuild/compilers/c.py8
-rw-r--r--mesonbuild/compilers/cpp.py11
3 files changed, 25 insertions, 0 deletions
diff --git a/docs/markdown/snippets/nvc_now_support_setting_std.md b/docs/markdown/snippets/nvc_now_support_setting_std.md
new file mode 100644
index 000000000..5e537ae9f
--- /dev/null
+++ b/docs/markdown/snippets/nvc_now_support_setting_std.md
@@ -0,0 +1,6 @@
+## nvc and nvc++ now support setting std
+
+The following standards are available for nvc: c89, c90, c99, c11,
+c17, c18, gnu90, gnu89, gnu99, gnu11, gnu17, gnu18. For nvc++:
+c++98, c++03, c++11, c++14, c++17, c++20, c++23, gnu++98, gnu++03,
+gnu++11, gnu++14, gnu++17, gnu++20
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index aa85f1191..f67281f04 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -361,6 +361,14 @@ class NvidiaHPC_CCompiler(PGICompiler, CCompiler):
info, linker=linker, full_version=full_version)
PGICompiler.__init__(self)
+ def get_options(self) -> 'MutableKeyedOptionDictType':
+ opts = CCompiler.get_options(self)
+ cppstd_choices = ['c89', 'c90', 'c99', 'c11', 'c17', 'c18']
+ std_opt = opts[self.form_compileropt_key('std')]
+ assert isinstance(std_opt, options.UserStdOption), 'for mypy'
+ std_opt.set_versions(cppstd_choices, gnu=True)
+ return opts
+
class ElbrusCCompiler(ElbrusCompiler, CCompiler):
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index 86bb113be..930e7b7e5 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -566,6 +566,17 @@ class NvidiaHPC_CPPCompiler(PGICompiler, CPPCompiler):
info, linker=linker, full_version=full_version)
PGICompiler.__init__(self)
+ def get_options(self) -> 'MutableKeyedOptionDictType':
+ opts = CPPCompiler.get_options(self)
+ cppstd_choices = [
+ 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++20', 'c++23',
+ 'gnu++98', 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++20'
+ ]
+ std_opt = opts[self.form_compileropt_key('std')]
+ assert isinstance(std_opt, options.UserStdOption), 'for mypy'
+ std_opt.set_versions(cppstd_choices)
+ return opts
+
class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler):
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,