From c0d86024f5e647858f88bc400b45b3ad88a25c97 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 8 Jun 2024 23:16:36 +0300 Subject: Rename option variable to optstore to make it unique. --- mesonbuild/compilers/cuda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/compilers/cuda.py') diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 954040e..5a93551 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -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(): -- cgit v1.1 From 9a6fcd4d9a0c7bb248c5d0587632b741a3301e03 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 9 Jun 2024 01:03:49 +0300 Subject: Replace direct indexing with named methods. --- mesonbuild/compilers/cuda.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'mesonbuild/compilers/cuda.py') diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 5a93551..2e9218e 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 @@ -655,15 +655,15 @@ 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'} return coredata.OptionsView(host_options, overrides=overrides) @@ -674,9 +674,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 +792,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: -- cgit v1.1 From 181c3499fde491650269c236ea639c92f10c6914 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Tue, 11 Jun 2024 21:20:33 +0300 Subject: Fix mypy. --- mesonbuild/compilers/cuda.py | 1 + 1 file changed, 1 insertion(+) (limited to 'mesonbuild/compilers/cuda.py') diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 2e9218e..dc9cf8a 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -665,6 +665,7 @@ class CudaCompiler(Compiler): 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]: -- cgit v1.1