From 02b85a846629090a0c7f18e860bab0a10ea4349b Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Sat, 6 Dec 2025 22:04:48 +0800 Subject: [PATCH] compilers/nvidia_hpc: compilers: move -std options to get_option_std_args Fixes: 6c88d9992192379511c4777c526786cbacf06167 Fixes: d3542ff690d0be723cfd3ebfaaac99290517837f Fixes: ff0c758b2a8015f7e7ca6fc627c29ef7bb4771b3 --- mesonbuild/compilers/c.py | 8 ++++++++ mesonbuild/compilers/cpp.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 7143d9e92d7a..d60ed99e83b8 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -309,6 +309,14 @@ def get_options(self) -> 'MutableKeyedOptionDictType': std_opt.set_versions(cppstd_choices, gnu=True) return opts + def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]: + args: T.List[str] = [] + std = self.get_compileropt_value('std', target, subproject) + assert isinstance(std, str) + if std != 'none': + args.append('-std=' + std) + return args + class ElbrusCCompiler(ElbrusCompiler, CCompiler): def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index bdf60f6c23a2..5ed4aea81ee2 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -572,6 +572,14 @@ def get_options(self) -> 'MutableKeyedOptionDictType': std_opt.set_versions(cppstd_choices) return opts + def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]: + args: T.List[str] = [] + std = self.get_compileropt_value('std', target, subproject) + assert isinstance(std, str) + if std != 'none': + args.append(self._find_best_cpp_std(std)) + return args + class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler): def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice,