From a65afa11ba5b9f552cc425a54c487d7871e64124 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 27 Aug 2019 13:34:49 -0400 Subject: [PATCH] Export CUDA static library requirements properly This is a work around while we wait on requiring CMake 3.15 for all cuda builds. At that point we can replace this with setting `requires_static_builds` as part of the EXPORT_PROPERTIES of the vtkm_cuda target. This has been tested with the ascent proxy --- CMake/VTKmConfig.cmake.in | 1 + CMake/VTKmDeviceAdapters.cmake | 8 ++++++-- CMake/VTKmWrappers.cmake | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMake/VTKmConfig.cmake.in b/CMake/VTKmConfig.cmake.in index 7d12dd3f9..ceba9d00f 100644 --- a/CMake/VTKmConfig.cmake.in +++ b/CMake/VTKmConfig.cmake.in @@ -98,6 +98,7 @@ endif() # EXPORT_PROPERTIES of the vtkm_cuda target if(VTKm_ENABLE_CUDA AND VTKM_FROM_INSTALL_DIR) set_target_properties(vtkm::cuda PROPERTIES cuda_architecture_flags "@VTKm_CUDA_Architecture_Flags@") + set_target_properties(vtkm::cuda PROPERTIES requires_static_builds TRUE) endif() # VTKm requires some CMake Find modules not included with CMake, so diff --git a/CMake/VTKmDeviceAdapters.cmake b/CMake/VTKmDeviceAdapters.cmake index b643d4086..09f74f47a 100644 --- a/CMake/VTKmDeviceAdapters.cmake +++ b/CMake/VTKmDeviceAdapters.cmake @@ -121,14 +121,18 @@ if(VTKm_ENABLE_CUDA) set_target_properties(vtkm_cuda PROPERTIES EXPORT_NAME vtkm::cuda) install(TARGETS vtkm_cuda EXPORT ${VTKm_EXPORT_NAME}) - # Reserve `INTERFACE_REQUIRES_STATIC_BUILDS` to potential work around issues + # Reserve `requires_static_builds` to potential work around issues # where VTK-m doesn't work when building shared as virtual functions fail # inside device code. We don't want to force BUILD_SHARED_LIBS to a specific # value as that could impact other projects that embed VTK-m. Instead what # we do is make sure that libraries built by vtkm_library() are static # if they use CUDA + # + # This needs to be lower-case for the property to be properly exported + # CMake 3.15 we can add `requires_static_builds` to the EXPORT_PROPERTIES + # target property to have this automatically exported for us set_target_properties(vtkm_cuda PROPERTIES - INTERFACE_REQUIRES_STATIC_BUILDS TRUE + requires_static_builds TRUE ) diff --git a/CMake/VTKmWrappers.cmake b/CMake/VTKmWrappers.cmake index 7bde0b241..a2feff61c 100644 --- a/CMake/VTKmWrappers.cmake +++ b/CMake/VTKmWrappers.cmake @@ -207,7 +207,7 @@ function(vtkm_add_target_information uses_vtkm_target) # dynamic library boundaries. if(TARGET vtkm::cuda) get_target_property(lib_type ${uses_vtkm_target} TYPE) - get_target_property(requires_static vtkm::cuda INTERFACE_REQUIRES_STATIC_BUILDS) + get_target_property(requires_static vtkm::cuda requires_static_builds) if(requires_static AND ${lib_type} STREQUAL "SHARED_LIBRARY" AND VTKm_TI_EXTENDS_VTKM) #We provide different error messages based on if we are building VTK-m