diff options
author | Olexa Bilaniuk <obilaniu@gmail.com> | 2019-02-24 09:00:25 -0500 |
---|---|---|
committer | Olexa Bilaniuk <obilaniu@gmail.com> | 2019-02-24 09:02:57 -0500 |
commit | e54fd996bbc251e195ab4f451993d02783b267c4 (patch) | |
tree | 80b480d98af29780e791e8fcc9c16b032c374e37 /mesonbuild/modules/unstable_cuda.py | |
parent | 8838cfae7354d284f4ca2567b20e6d7a39117094 (diff) | |
download | meson-e54fd996bbc251e195ab4f451993d02783b267c4.zip meson-e54fd996bbc251e195ab4f451993d02783b267c4.tar.gz meson-e54fd996bbc251e195ab4f451993d02783b267c4.tar.bz2 |
Allow 'Auto'-mode flags to use the compiler's detected GPU
architectures.
Diffstat (limited to 'mesonbuild/modules/unstable_cuda.py')
-rw-r--r-- | mesonbuild/modules/unstable_cuda.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/mesonbuild/modules/unstable_cuda.py b/mesonbuild/modules/unstable_cuda.py index 941b15a..15f3a17 100644 --- a/mesonbuild/modules/unstable_cuda.py +++ b/mesonbuild/modules/unstable_cuda.py @@ -77,11 +77,19 @@ class CudaModule(ExtensionModule): @staticmethod def _break_arch_string(s): - s = re.sub('[ \t,;]+', ';', s) + s = re.sub('[ \t\r\n,;]+', ';', s) s = s.strip(';').split(';') return s @staticmethod + def _detected_cc_from_compiler(c): + if isinstance(c, CompilerHolder): + c = c.compiler + if isinstance(c, CudaCompiler): + return c.detected_cc + return '' + + @staticmethod def _version_from_compiler(c): if isinstance(c, CompilerHolder): c = c.compiler @@ -97,7 +105,8 @@ class CudaModule(ExtensionModule): if len(args) < 1: raise argerror else: - cuda_version = self._version_from_compiler(args[0]) + compiler = args[0] + cuda_version = self._version_from_compiler(compiler) if cuda_version == 'unknown': raise argerror @@ -108,7 +117,8 @@ class CudaModule(ExtensionModule): raise InvalidArguments('''The special architectures 'All', 'Common' and 'Auto' must appear alone, as a positional argument!''') arch_list = arch_list[0] if len(arch_list) == 1 else arch_list - detected = flatten([kwargs.get('detected', [])]) + detected = kwargs.get('detected', self._detected_cc_from_compiler(compiler)) + detected = flatten([detected]) detected = [self._break_arch_string(a) for a in detected] detected = flatten(detected) if not set(detected).isdisjoint({'All', 'Common', 'Auto'}): |