aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/cuda.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers/cuda.py')
-rw-r--r--mesonbuild/compilers/cuda.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index 954040e..dc9cf8a 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -13,7 +13,7 @@ from .. import options
from .. import mlog
from ..mesonlib import (
EnvironmentException, Popen_safe,
- is_windows, LibType, version_compare,
+ is_windows, LibType, version_compare, OptionKey
)
from .compilers import Compiler
@@ -549,7 +549,7 @@ class CudaCompiler(Compiler):
# Use the -ccbin option, if available, even during sanity checking.
# Otherwise, on systems where CUDA does not support the default compiler,
# NVCC becomes unusable.
- flags += self.get_ccbin_args(env.coredata.options)
+ flags += self.get_ccbin_args(env.coredata.optstore)
# If cross-compiling, we can't run the sanity check, only compile it.
if env.need_exe_wrapper(self.for_machine) and not env.has_exe_wrapper():
@@ -655,16 +655,17 @@ class CudaCompiler(Compiler):
''),
)
- def _to_host_compiler_options(self, options: 'KeyedOptionDictType') -> 'KeyedOptionDictType':
+ def _to_host_compiler_options(self, master_options: 'KeyedOptionDictType') -> 'KeyedOptionDictType':
"""
Convert an NVCC Option set to a host compiler's option set.
"""
# We must strip the -std option from the host compiler option set, as NVCC has
# its own -std flag that may not agree with the host compiler's.
- host_options = {key: options.get(key, opt) for key, opt in self.host_compiler.get_options().items()}
- std_key = self.form_langopt_key('std')
+ host_options = {key: master_options.get(key, opt) for key, opt in self.host_compiler.get_options().items()}
+ std_key = OptionKey('std', machine=self.for_machine, lang=self.host_compiler.language)
overrides = {std_key: 'none'}
+ # To shut up mypy.
return coredata.OptionsView(host_options, overrides=overrides)
def get_option_compile_args(self, options: 'KeyedOptionDictType') -> T.List[str]:
@@ -674,9 +675,9 @@ class CudaCompiler(Compiler):
# and attempting to use it will result in a warning: https://stackoverflow.com/a/51272091/741027
if not is_windows():
key = self.form_langopt_key('std')
- std = options[key]
- if std.value != 'none':
- args.append('--std=' + std.value)
+ std = options.get_value(key)
+ if std != 'none':
+ args.append('--std=' + std)
return args + self._to_host_flags(self.host_compiler.get_option_compile_args(self._to_host_compiler_options(options)))
@@ -792,9 +793,9 @@ class CudaCompiler(Compiler):
def get_dependency_link_args(self, dep: 'Dependency') -> T.List[str]:
return self._to_host_flags(super().get_dependency_link_args(dep), _Phase.LINKER)
- def get_ccbin_args(self, options: 'KeyedOptionDictType') -> T.List[str]:
+ def get_ccbin_args(self, ccoptions: 'KeyedOptionDictType') -> T.List[str]:
key = self.form_langopt_key('ccbindir')
- ccbindir = options[key].value
+ ccbindir = ccoptions.get_value(key)
if isinstance(ccbindir, str) and ccbindir != '':
return [self._shield_nvcc_list_arg('-ccbin='+ccbindir, False)]
else: