diff --git a/CMake/VTKmConfig.cmake.in b/CMake/VTKmConfig.cmake.in index 07b504c4b..7d12dd3f9 100644 --- a/CMake/VTKmConfig.cmake.in +++ b/CMake/VTKmConfig.cmake.in @@ -87,14 +87,16 @@ endif() # Load the library exports, but only if not compiling VTK-m itself set_and_check(VTKm_CONFIG_DIR "@PACKAGE_VTKm_INSTALL_CONFIG_DIR@") +set(VTKM_FROM_INSTALL_DIR FALSE) if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "@VTKm_BINARY_DIR@") + set(VTKM_FROM_INSTALL_DIR TRUE) include(${VTKm_CONFIG_DIR}/VTKmTargets.cmake) endif() # Once we can require CMake 3.15 for all cuda builds we can # replace this with setting `cuda_architecture_flags` as part of the # EXPORT_PROPERTIES of the vtkm_cuda target -if(VTKm_ENABLE_CUDA) +if(VTKm_ENABLE_CUDA AND VTKM_FROM_INSTALL_DIR) set_target_properties(vtkm::cuda PROPERTIES cuda_architecture_flags "@VTKm_CUDA_Architecture_Flags@") endif() diff --git a/CMake/VTKmWrappers.cmake b/CMake/VTKmWrappers.cmake index cb845f164..7bde0b241 100644 --- a/CMake/VTKmWrappers.cmake +++ b/CMake/VTKmWrappers.cmake @@ -166,7 +166,8 @@ endfunction() # need to be marked as going to a special compiler for certain device adapters # such as CUDA. # -# EXTENDS_VTKM: Some programming models have restrictions on how types can be extended. +# EXTENDS_VTKM: Some programming models have restrictions on how types can be used, +# passed across library boundaries, and derived from. # For example CUDA doesn't allow device side calls across dynamic library boundaries, # and requires all polymorphic classes to be reachable at dynamic library/executable # link time. @@ -177,10 +178,13 @@ endfunction() # Executable: do nothing, zero restrictions # Static library: do nothing, zero restrictions # Dynamic library: -# -> Wanting to extend VTK-m and provide these types to consumers. This -# is supported when CUDA isn't enabled. Otherwise we need to ERROR! # -> Wanting to use VTK-m as implementation detail, doesn't expose VTK-m # types to consumers. This is supported no matter if CUDA is enabled. +# -> Wanting to extend VTK-m and provide these types to consumers. +# This is only supported when CUDA isn't enabled. Otherwise we need to ERROR! +# -> Wanting to pass known VTK-m types across library boundaries for others +# to use in filters/worklets. +# This is only supported when CUDA isn't enabled. Otherwise we need to ERROR! # # For most consumers they can ignore the `EXTENDS_VTKM` property as the default # will be correct. @@ -205,7 +209,7 @@ function(vtkm_add_target_information uses_vtkm_target) get_target_property(lib_type ${uses_vtkm_target} TYPE) get_target_property(requires_static vtkm::cuda INTERFACE_REQUIRES_STATIC_BUILDS) - if(requires_static AND ${lib_type} STREQUAL "SHARED_LIBRARY") + 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 #or being called by a consumer of VTK-m. We use PROJECT_NAME so that we #produce the correct error message when VTK-m is a subdirectory include @@ -277,6 +281,7 @@ function(vtkm_library) ${VTKm_LIB_DEVICE_SOURCES} ) vtkm_add_target_information(${lib_name} + EXTENDS_VTKM DEVICE_SOURCES ${VTKm_LIB_DEVICE_SOURCES} ) if(NOT VTKm_USE_DEFAULT_SYMBOL_VISIBILITY)