summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/CUBIN/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CudaOnly/CUBIN/CMakeLists.txt')
-rw-r--r--Tests/CudaOnly/CUBIN/CMakeLists.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/Tests/CudaOnly/CUBIN/CMakeLists.txt b/Tests/CudaOnly/CUBIN/CMakeLists.txt
index 464714b..81787e4 100644
--- a/Tests/CudaOnly/CUBIN/CMakeLists.txt
+++ b/Tests/CudaOnly/CUBIN/CMakeLists.txt
@@ -1,9 +1,17 @@
cmake_minimum_required(VERSION 3.18)
+unset(ENV{CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP}) # CUBIN needs true native arch
project(CudaCUBIN LANGUAGES CUDA)
-
set(CMAKE_CUDA_ARCHITECTURES all-major)
+# CUBIN needs the true native arch to be supported by the CUDA toolkit.
+set(unavailable_native_archs "${CMAKE_CUDA_ARCHITECTURES_NATIVE}")
+list(REMOVE_ITEM unavailable_native_archs ${CMAKE_CUDA_ARCHITECTURES_ALL})
+if(unavailable_native_archs)
+ add_executable(CudaOnlyCUBIN main_no_native_archs.cu)
+ return()
+endif()
+
add_library(CudaCUBIN OBJECT kernelA.cu kernelB.cu kernelC.cu)
set_property(TARGET CudaCUBIN PROPERTY CUDA_CUBIN_COMPILATION ON)
set_property(TARGET CudaCUBIN PROPERTY CUDA_ARCHITECTURES native)