summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-09-12 13:05:56 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-09-12 13:06:14 (GMT)
commit6f8746e27c57d23166859dc0e067508e2d735803 (patch)
tree3c4baa020230809acfa8c3221be7cfcadf334210
parenta159c2d3cf4f35baa5882d74b5f8ff2ae7e2ab22 (diff)
parent6ebff6ebf8850a9372786bf56af8ee79dca6860d (diff)
downloadCMake-6f8746e27c57d23166859dc0e067508e2d735803.zip
CMake-6f8746e27c57d23166859dc0e067508e2d735803.tar.gz
CMake-6f8746e27c57d23166859dc0e067508e2d735803.tar.bz2
Merge topic 'vs-cuda-object-libs' into release-3.27
6ebff6ebf8 VS: Avoid unnecessary CUDA device linking for OBJECT libraries Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8794
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx5
-rw-r--r--Tests/CudaOnly/Fatbin/CMakeLists.txt1
-rw-r--r--Tests/CudaOnly/OptixIR/CMakeLists.txt1
3 files changed, 6 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b3699ae..b011615 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3855,7 +3855,10 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
void cmVisualStudio10TargetGenerator::WriteCudaLinkOptions(
Elem& e1, std::string const& configName)
{
- if (this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) {
+ // We need to write link options for OBJECT libraries so that
+ // we override the default device link behavior ( enabled ) when
+ // building object libraries with ptx/optix-ir/etc
+ if (this->GeneratorTarget->GetType() > cmStateEnums::OBJECT_LIBRARY) {
return;
}
diff --git a/Tests/CudaOnly/Fatbin/CMakeLists.txt b/Tests/CudaOnly/Fatbin/CMakeLists.txt
index db0dc22..9974404 100644
--- a/Tests/CudaOnly/Fatbin/CMakeLists.txt
+++ b/Tests/CudaOnly/Fatbin/CMakeLists.txt
@@ -10,6 +10,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../CUBIN/kernelB.cu
${CMAKE_CURRENT_SOURCE_DIR}/../CUBIN/kernelC.cu)
set_property(TARGET CudaFATBIN PROPERTY CUDA_FATBIN_COMPILATION ON)
+set_property(TARGET CudaFATBIN PROPERTY CUDA_SEPARABLE_COMPILATION ON)
# Will use `cuModuleLoadFatBinary` to load the fatbinaries
add_executable(CudaOnlyFatbin main.cu)
diff --git a/Tests/CudaOnly/OptixIR/CMakeLists.txt b/Tests/CudaOnly/OptixIR/CMakeLists.txt
index afeabda..f408d40 100644
--- a/Tests/CudaOnly/OptixIR/CMakeLists.txt
+++ b/Tests/CudaOnly/OptixIR/CMakeLists.txt
@@ -13,6 +13,7 @@ if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "11.7.0")
set_property(TARGET CudaOptix PROPERTY CUDA_OPTIX_COMPILATION ON)
endif()
+set_property(TARGET CudaOptix PROPERTY CUDA_SEPARABLE_COMPILATION ON)
set_property(TARGET CudaOptix PROPERTY CUDA_ARCHITECTURES native)
add_executable(CudaOnlyOptixIR main.cu)