summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/cuda.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-04-02 14:20:44 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2025-04-04 12:46:55 +0300
commitff0c758b2a8015f7e7ca6fc627c29ef7bb4771b3 (patch)
tree49de8a9f3a3d17d4f26a7c61e984027243834092 /mesonbuild/compilers/cuda.py
parent47984f813450bcbcd102ed45d579011deb4572c1 (diff)
downloadmeson-ff0c758b2a8015f7e7ca6fc627c29ef7bb4771b3.tar.gz
compilers: move -std options to get_option_std_args, special-casing CUDA
Move building the -std option to the new get_option_std_args method, special casing CUDA to never include the option from the host compiler. This fixes again #8523, which was broken by the option refactoring (unsurprisingly, since the fix was ripped out unceremoniously without a replacement). Fixes: #14365 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/compilers/cuda.py')
-rw-r--r--mesonbuild/compilers/cuda.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index b67aa8715..509044cd4 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -663,6 +663,14 @@ class CudaCompiler(Compiler):
def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args = self.get_ccbin_args(target, env, subproject)
+
+ try:
+ host_compiler_args = self.host_compiler.get_option_compile_args(target, env, subproject)
+ except KeyError:
+ host_compiler_args = []
+ return args + self._to_host_flags(host_compiler_args)
+
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
# On Windows, the version of the C++ standard used by nvcc is dictated by
# the combination of CUDA version and MSVC version; the --std= is thus ignored
# and attempting to use it will result in a warning: https://stackoverflow.com/a/51272091/741027
@@ -670,13 +678,13 @@ class CudaCompiler(Compiler):
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
if std != 'none':
- args.append('--std=' + std)
+ return ['--std=' + std]
try:
- host_compiler_args = self.host_compiler.get_option_compile_args(target, env, subproject)
+ host_compiler_args = self.host_compiler.get_option_std_args(target, env, subproject)
except KeyError:
host_compiler_args = []
- return args + self._to_host_flags(host_compiler_args)
+ return self._to_host_flags(host_compiler_args)
def get_option_link_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args = self.get_ccbin_args(target, env, subproject)