summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-01-16 16:01:17 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-01-16 16:01:17 (GMT)
commit743085a5795ae666a56a3eeea59c5467a0b714a8 (patch)
treeee61e65cf322f1060924e935d22a0be16b5e9d80 /Tests
parent94332a3ed8398202e4d8f985bcfba31ea0fa71e6 (diff)
parent8d1f9e5b850e02d304e4c209e720f06e25837470 (diff)
downloadCMake-743085a5795ae666a56a3eeea59c5467a0b714a8.zip
CMake-743085a5795ae666a56a3eeea59c5467a0b714a8.tar.gz
CMake-743085a5795ae666a56a3eeea59c5467a0b714a8.tar.bz2
Merge topic 'cuda_propagate_flags_when_dlink_on_executables'
8d1f9e5b CUDA: Now pass correct FLAGS when device link cuda executables. dc5051f1 CUDA: Test that CUDA flags are used when device linking executables.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Cuda/CMakeLists.txt1
-rw-r--r--Tests/Cuda/ProperLinkFlags/CMakeLists.txt20
-rw-r--r--Tests/Cuda/ProperLinkFlags/file1.cu11
-rw-r--r--Tests/Cuda/ProperLinkFlags/file1.h7
-rw-r--r--Tests/Cuda/ProperLinkFlags/main.cxx9
5 files changed, 48 insertions, 0 deletions
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 5772fcf..40c9675 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -2,3 +2,4 @@
ADD_TEST_MACRO(Cuda.Complex CudaComplex)
ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
+ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
diff --git a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
new file mode 100644
index 0000000..a9eb8bd
--- /dev/null
+++ b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
@@ -0,0 +1,20 @@
+
+cmake_minimum_required(VERSION 3.7)
+project (ProperLinkFlags CUDA CXX)
+
+#Goal for this example:
+#Verify that when we have CXX and CUDA enabled and we link an executable that
+#has CUDA and CXX we use the CUDA link flags when doing the device link
+#step
+
+#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
+set(CMAKE_CUDA_FLAGS "-arch=sm_35 --use_fast_math")
+set(CMAKE_CXX_FLAGS "-Wall")
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CUDA_STANDARD 11)
+add_executable(ProperLinkFlags file1.cu main.cxx)
+
+set_target_properties( ProperLinkFlags
+ PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
diff --git a/Tests/Cuda/ProperLinkFlags/file1.cu b/Tests/Cuda/ProperLinkFlags/file1.cu
new file mode 100644
index 0000000..d93dc9f
--- /dev/null
+++ b/Tests/Cuda/ProperLinkFlags/file1.cu
@@ -0,0 +1,11 @@
+
+#include "file1.h"
+
+result_type __device__ file1_func(int x)
+{
+ __ldg(&x);
+ result_type r;
+ r.input = x;
+ r.sum = x*x;
+ return r;
+}
diff --git a/Tests/Cuda/ProperLinkFlags/file1.h b/Tests/Cuda/ProperLinkFlags/file1.h
new file mode 100644
index 0000000..ff1945c
--- /dev/null
+++ b/Tests/Cuda/ProperLinkFlags/file1.h
@@ -0,0 +1,7 @@
+
+#pragma once
+struct result_type
+{
+ int input;
+ int sum;
+};
diff --git a/Tests/Cuda/ProperLinkFlags/main.cxx b/Tests/Cuda/ProperLinkFlags/main.cxx
new file mode 100644
index 0000000..7c0ee9e
--- /dev/null
+++ b/Tests/Cuda/ProperLinkFlags/main.cxx
@@ -0,0 +1,9 @@
+
+#include <iostream>
+
+#include "file1.h"
+
+int main(int argc, char** argv)
+{
+ return 0;
+}