diff options
author | David Seifert <soap@gentoo.org> | 2023-01-30 22:47:14 +0100 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-01-31 17:54:43 -0500 |
commit | 9e9fa8f8204fd56bd6e56c22062b8297cd65b407 (patch) | |
tree | 80902119fd3be3ce3621f22d24bc31e19921589c | |
parent | 08e722d44c7798344bd149e1a2c58877de28e655 (diff) | |
download | meson-9e9fa8f8204fd56bd6e56c22062b8297cd65b407.zip meson-9e9fa8f8204fd56bd6e56c22062b8297cd65b407.tar.gz meson-9e9fa8f8204fd56bd6e56c22062b8297cd65b407.tar.bz2 |
cuda: enable C++20 for CUDA 12
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-compilers
-rw-r--r-- | mesonbuild/compilers/cuda.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 25a7baf..d008d0c 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -22,7 +22,7 @@ from .. import coredata from .. import mlog from ..mesonlib import ( EnvironmentException, Popen_safe, OptionOverrideProxy, - is_windows, LibType, OptionKey, + is_windows, LibType, OptionKey, version_compare, ) from .compilers import (Compiler, cuda_buildtype_args, cuda_optimization_args, cuda_debug_args) @@ -615,13 +615,26 @@ class CudaCompiler(Compiler): }}''' return self.compiles(t.format_map(fargs), env, extra_args=extra_args, dependencies=dependencies) + _CPP14_VERSION = '>=9.0' + _CPP17_VERSION = '>=11.0' + _CPP20_VERSION = '>=12.0' + def get_options(self) -> 'MutableKeyedOptionDictType': opts = super().get_options() std_key = OptionKey('std', machine=self.for_machine, lang=self.language) ccbindir_key = OptionKey('ccbindir', machine=self.for_machine, lang=self.language) + + cpp_stds = ['none', 'c++03', 'c++11'] + if version_compare(self.version, self._CPP14_VERSION): + cpp_stds += ['c++14'] + if version_compare(self.version, self._CPP17_VERSION): + cpp_stds += ['c++17'] + if version_compare(self.version, self._CPP20_VERSION): + cpp_stds += ['c++20'] + opts.update({ std_key: coredata.UserComboOption('C++ language standard to use with CUDA', - ['none', 'c++03', 'c++11', 'c++14', 'c++17'], 'none'), + cpp_stds, 'none'), ccbindir_key: coredata.UserStringOption('CUDA non-default toolchain directory to use (-ccbin)', ''), }) |