summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-07-29 12:45:27 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-07-29 12:45:40 (GMT)
commit6064c70469740de5075b077dd04c5f95b29cd948 (patch)
treef7ecac15a820a0ed346710c1e3223b3d7b0e5d68 /Tests
parent0c028df0b47441dde56a75b22a11941191d1d7c0 (diff)
parent3975678fcc3928f2a7dcd79fe9b9e9ebf3abe2b2 (diff)
downloadCMake-6064c70469740de5075b077dd04c5f95b29cd948.zip
CMake-6064c70469740de5075b077dd04c5f95b29cd948.tar.gz
CMake-6064c70469740de5075b077dd04c5f95b29cd948.tar.bz2
Merge topic 'cuda_separable_clang_make'
3975678fcc CUDA/Clang: Simplify --register-link-binaries logic 0b1cea66cd CUDA/Clang: Fix separable compilation in non-root directories with Makefiles Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6400
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CudaOnly/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/SeparateCompilation/CMakeLists.txt19
-rw-r--r--Tests/CudaOnly/SeparateCompilation/main/CMakeLists.txt18
-rw-r--r--Tests/CudaOnly/SeparateCompilation/main/main.cu (renamed from Tests/CudaOnly/SeparateCompilation/main.cu)4
4 files changed, 22 insertions, 21 deletions
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index fdb7a6e..a3fb409 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -15,7 +15,7 @@ add_cuda_test_macro(CudaOnly.ToolkitBeforeLang CudaOnlyToolkitBeforeLang)
add_cuda_test_macro(CudaOnly.WithDefs CudaOnlyWithDefs)
add_cuda_test_macro(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
add_cuda_test_macro(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols)
-add_cuda_test_macro(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation)
+add_cuda_test_macro(CudaOnly.SeparateCompilation main/CudaOnlySeparateCompilation)
if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
# Clang doesn't have flags for selecting the runtime.
diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
index 864ecbf..17069e3 100644
--- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
+++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
@@ -34,26 +34,9 @@ add_library(CUDASeparateLibB STATIC file4.cu file5.cu)
target_compile_features(CUDASeparateLibB PRIVATE cuda_std_11)
target_link_libraries(CUDASeparateLibB PRIVATE CUDASeparateLibA)
-add_executable(CudaOnlySeparateCompilation main.cu)
-target_link_libraries(CudaOnlySeparateCompilation
- PRIVATE CUDASeparateLibB)
-set_target_properties(CudaOnlySeparateCompilation PROPERTIES CUDA_STANDARD 11)
-set_target_properties(CudaOnlySeparateCompilation PROPERTIES CUDA_STANDARD_REQUIRED TRUE)
-
set_target_properties(CUDASeparateLibA
CUDASeparateLibB
PROPERTIES CUDA_SEPARABLE_COMPILATION ON
POSITION_INDEPENDENT_CODE ON)
-if (CMAKE_GENERATOR MATCHES "^Visual Studio")
- #Visual Studio CUDA integration will not perform device linking
- #on a target that itself does not have GenerateRelocatableDeviceCode
- #enabled.
- set_target_properties(CudaOnlySeparateCompilation
- PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
-endif()
-
-if(APPLE)
- # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
- set_property(TARGET CudaOnlySeparateCompilation PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
-endif()
+add_subdirectory(main)
diff --git a/Tests/CudaOnly/SeparateCompilation/main/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/main/CMakeLists.txt
new file mode 100644
index 0000000..c181078
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/main/CMakeLists.txt
@@ -0,0 +1,18 @@
+add_executable(CudaOnlySeparateCompilation main.cu)
+target_link_libraries(CudaOnlySeparateCompilation PRIVATE CUDASeparateLibB)
+set_target_properties(CudaOnlySeparateCompilation PROPERTIES
+ CUDA_STANDARD 11
+ CUDA_STANDARD_REQUIRED TRUE
+)
+
+if(CMAKE_GENERATOR MATCHES "^Visual Studio")
+ # Visual Studio CUDA integration will not perform device linking
+ # on a target that itself does not have GenerateRelocatableDeviceCode
+ # enabled.
+ set_property(TARGET CudaOnlySeparateCompilation PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+endif()
+
+if(APPLE)
+ # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
+ set_property(TARGET CudaOnlySeparateCompilation PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
+endif()
diff --git a/Tests/CudaOnly/SeparateCompilation/main.cu b/Tests/CudaOnly/SeparateCompilation/main/main.cu
index 40dbe5d..2b6e8f4 100644
--- a/Tests/CudaOnly/SeparateCompilation/main.cu
+++ b/Tests/CudaOnly/SeparateCompilation/main/main.cu
@@ -1,8 +1,8 @@
#include <iostream>
-#include "file1.h"
-#include "file2.h"
+#include "../file1.h"
+#include "../file2.h"
int file4_launch_kernel(int x);
int file5_launch_kernel(int x);