Commit fc074f57 authored by Robert Maynard's avatar Robert Maynard

CUDA: Support CUDA_DEVICE_LINK_OPTIONS target property for device linking

parent fc35ed1c
......@@ -3381,7 +3381,18 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
}
std::vector<EvaluatedTargetPropertyEntry> entries;
if (!isCudaDeviceLink) {
if (isCudaDeviceLink ) {
if(const char* linkOptions = this->GetProperty(linkPropertyName)) {
std::vector<std::string> options;
cmSystemTools::ExpandListArgument(linkOptions, options);
for (const auto& option : options) {
std::unique_ptr<TargetPropertyEntry> entry(
CreateTargetPropertyEntry(option));
entries.emplace_back(EvaluateTargetPropertyEntry(
this, config, language, &dagChecker, entry.get()));
}}
}
else{
entries =
EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
this->LinkOptionsEntries);
......
......@@ -15,7 +15,7 @@ project (Complex CXX CUDA)
#and also building cpp targets that need cuda implicit libraries
#verify that we can pass explicit cuda arch flags
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
add_compile_options("$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-gencode arch=compute_30,code=compute_30>")
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
......@@ -24,9 +24,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
add_library(CudaComplexCppBase SHARED dynamic.cpp)
add_library(CudaComplexSeperableLib STATIC file1.cu file2.cu file3.cu)
set_target_properties(CudaComplexSeperableLib
PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties( CudaComplexSeperableLib
PROPERTIES POSITION_INDEPENDENT_CODE ON)
PROPERTIES CUDA_SEPARABLE_COMPILATION ON
POSITION_INDEPENDENT_CODE ON)
add_library(CudaComplexSharedLib SHARED dynamic.cu)
target_link_libraries(CudaComplexSharedLib PUBLIC CudaComplexCppBase)
......@@ -34,6 +33,7 @@ target_link_libraries(CudaComplexSharedLib PUBLIC CudaComplexCppBase)
add_library(CudaComplexMixedLib SHARED mixed.cpp mixed.cu)
set_target_properties(CudaComplexMixedLib
PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
CUDA_DEVICE_LINK_OPTIONS "SHELL:-gencode arch=compute_30,code=compute_30")
target_link_libraries(CudaComplexMixedLib
PUBLIC CudaComplexSharedLib
PRIVATE CudaComplexSeperableLib)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment