summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2024-05-31 00:21:43 +0200
committerEli Schwartz <eschwartz93@gmail.com>2024-05-30 18:53:04 -0400
commitf4577911b4c608f11e01e6fca26c1c78f46e5797 (patch)
tree2bc0e82a1e34f45d48408a43ad8d261e8c14877a
parent6f3841e98636b8460b8dc4e57a14a36fb7ddb815 (diff)
downloadmeson-f4577911b4c608f11e01e6fca26c1c78f46e5797.tar.gz
cuda: avoid test failure without GPU available
Fixes #13269
-rw-r--r--test cases/cuda/17 separate compilation linking/meson.build8
1 files changed, 6 insertions, 2 deletions
diff --git a/test cases/cuda/17 separate compilation linking/meson.build b/test cases/cuda/17 separate compilation linking/meson.build
index 8e90ddd7f..7ba7e2208 100644
--- a/test cases/cuda/17 separate compilation linking/meson.build
+++ b/test cases/cuda/17 separate compilation linking/meson.build
@@ -11,7 +11,7 @@ add_languages('cuda')
nvcc = meson.get_compiler('cuda')
cuda = import('unstable-cuda')
-arch_flags = cuda.nvcc_arch_flags(nvcc.version(), 'Auto', detected : ['8.0'])
+arch_flags = cuda.nvcc_arch_flags(nvcc.version(), 'Common')
message('NVCC version: ' + nvcc.version())
message('NVCC flags: ' + ' '.join(arch_flags))
@@ -19,4 +19,8 @@ message('NVCC flags: ' + ' '.join(arch_flags))
# test device linking with -dc (which is equivalent to `--relocatable-device-code true`)
lib = static_library('devicefuncs', ['b.cu'], cuda_args : ['-dc'] + arch_flags)
exe = executable('app', 'main.cu', cuda_args : ['-dc'] + arch_flags, link_with : lib, link_args : arch_flags)
-test('cudatest', exe)
+
+# if we don't have a CUDA-capable GPU available, avoid creating the test
+if run_command('__nvcc_device_query', check : false).returncode() == 0
+ test('cudatest', exe)
+endif