summaryrefslogtreecommitdiffstats
path: root/Tests/Cuda
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-18 16:28:41 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-05-18 16:29:44 (GMT)
commitb246dee7db2e7e6fcd2a00c5b2bd6db21045025f (patch)
tree7d6c9310a65d91c49e7223de20f8df274ca93e0d /Tests/Cuda
parent4acf31d681ff25543a5d7615521a75ebe368fb24 (diff)
parenta653ca9504569eb45077ee598945b18a3c9e4ee8 (diff)
downloadCMake-b246dee7db2e7e6fcd2a00c5b2bd6db21045025f.zip
CMake-b246dee7db2e7e6fcd2a00c5b2bd6db21045025f.tar.gz
CMake-b246dee7db2e7e6fcd2a00c5b2bd6db21045025f.tar.bz2
Merge topic 'cuda-clang'
a653ca9504 Tests: Update CUDA tests to work with Clang 5df21adf46 CUDA: Add support for Clang compiler dc2eae1f91 FindCUDAToolkit: Factor out discovery code into a separate file 70be10cbf4 CUDA: Remove toolkit include dirs from implicit include dirs only with NVIDIA Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Artem Belevich <tra@google.com> Acked-by: Robert Maynard <robert.maynard@kitware.com> Acked-by: Axel Huebl <axel.huebl@plasma.ninja> Acked-by: friendnick <ikoval67@gmail.com> Acked-by: Patrik Huber <patrikhuber@gmail.com> Merge-request: !4442
Diffstat (limited to 'Tests/Cuda')
-rw-r--r--Tests/Cuda/CMakeLists.txt11
-rw-r--r--Tests/Cuda/ProperLinkFlags/CMakeLists.txt8
2 files changed, 15 insertions, 4 deletions
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 58b9b03..83f2f2d 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -1,5 +1,4 @@
-ADD_TEST_MACRO(Cuda.Complex CudaComplex)
ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
ADD_TEST_MACRO(Cuda.CXXStandardSetTwice CXXStandardSetTwice)
ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
@@ -12,10 +11,16 @@ ADD_TEST_MACRO(Cuda.NotEnabled CudaNotEnabled)
ADD_TEST_MACRO(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly)
ADD_TEST_MACRO(Cuda.Toolkit Toolkit)
ADD_TEST_MACRO(Cuda.IncludePathNoToolkit IncludePathNoToolkit)
-ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries)
-ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
ADD_TEST_MACRO(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit)
+# Separable compilation is currently only supported on NVCC. Disable tests
+# using it for other compilers.
+if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ ADD_TEST_MACRO(Cuda.Complex CudaComplex)
+ ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries)
+ ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
+endif()
+
# The CUDA only ships the shared version of the toolkit libraries
# on windows
if(NOT WIN32)
diff --git a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
index b6e0e39..d38da6d 100644
--- a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
+++ b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
@@ -9,11 +9,17 @@ project (ProperLinkFlags CUDA CXX)
#Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA )
#to make sure we don't use the CXX flags when linking CUDA executables
-string(APPEND CMAKE_CUDA_FLAGS " -arch=sm_35 --use_fast_math")
+if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ string(APPEND CMAKE_CUDA_FLAGS "--use_fast_math")
+elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
+ string(APPEND CMAKE_CUDA_FLAGS "-ffast-math")
+endif()
+
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CUDA_STANDARD 11)
+set(CMAKE_CUDA_ARCHITECTURES 35)
add_executable(ProperLinkFlags file1.cu main.cxx)
set_target_properties( ProperLinkFlags