summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt
blob: 8efbb0f8ebcc217102f2a7ed8fcc469de05b3219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cmake_minimum_required(VERSION 3.7)
project (CudaOnlyCircularLinkLine CUDA)

#Goal for this example:
# Verify that we de-duplicate the device link line
# Verify that a de-duplicated link line still works with circular static libraries

string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CUDA_STANDARD 11)

add_library(CUDACircularDeviceLinking1 STATIC file1.cu)
add_library(CUDACircularDeviceLinking2 STATIC file2.cu)
add_library(CUDACircularDeviceLinking3 STATIC file3.cu)
add_executable(CudaOnlyCircularLinkLine main.cu)

target_link_libraries(CUDACircularDeviceLinking1 PUBLIC CUDACircularDeviceLinking2)
target_link_libraries(CUDACircularDeviceLinking2 PUBLIC CUDACircularDeviceLinking3)
#FIXME: complete the loop once supported
#target_link_libraries(CUDACircularDeviceLinking3 PUBLIC CUDACircularDeviceLinking1)

target_link_libraries(CudaOnlyCircularLinkLine PRIVATE CUDACircularDeviceLinking3)


set_target_properties(CUDACircularDeviceLinking1
                      PROPERTIES
                      CUDA_SEPARABLE_COMPILATION ON)

set_target_properties(CUDACircularDeviceLinking2
                      PROPERTIES
                      CUDA_SEPARABLE_COMPILATION ON)

set_target_properties(CUDACircularDeviceLinking3
                      PROPERTIES
                      CUDA_SEPARABLE_COMPILATION ON)