mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-08 11:29:02 +00:00
EXTEND_VTKM used to determine consumers by vtkm_add_target_information
The EXTEND_VTKM is now checked to determine when a shared library consumer of VTK-m is allowed.
This commit is contained in:
parent
871b444800
commit
6b0614e577
@ -87,14 +87,16 @@ endif()
|
|||||||
|
|
||||||
# Load the library exports, but only if not compiling VTK-m itself
|
# Load the library exports, but only if not compiling VTK-m itself
|
||||||
set_and_check(VTKm_CONFIG_DIR "@PACKAGE_VTKm_INSTALL_CONFIG_DIR@")
|
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@")
|
if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "@VTKm_BINARY_DIR@")
|
||||||
|
set(VTKM_FROM_INSTALL_DIR TRUE)
|
||||||
include(${VTKm_CONFIG_DIR}/VTKmTargets.cmake)
|
include(${VTKm_CONFIG_DIR}/VTKmTargets.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Once we can require CMake 3.15 for all cuda builds we can
|
# Once we can require CMake 3.15 for all cuda builds we can
|
||||||
# replace this with setting `cuda_architecture_flags` as part of the
|
# replace this with setting `cuda_architecture_flags` as part of the
|
||||||
# EXPORT_PROPERTIES of the vtkm_cuda target
|
# 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@")
|
set_target_properties(vtkm::cuda PROPERTIES cuda_architecture_flags "@VTKm_CUDA_Architecture_Flags@")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -166,7 +166,8 @@ endfunction()
|
|||||||
# need to be marked as going to a special compiler for certain device adapters
|
# need to be marked as going to a special compiler for certain device adapters
|
||||||
# such as CUDA.
|
# 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,
|
# 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
|
# and requires all polymorphic classes to be reachable at dynamic library/executable
|
||||||
# link time.
|
# link time.
|
||||||
@ -177,10 +178,13 @@ endfunction()
|
|||||||
# Executable: do nothing, zero restrictions
|
# Executable: do nothing, zero restrictions
|
||||||
# Static library: do nothing, zero restrictions
|
# Static library: do nothing, zero restrictions
|
||||||
# Dynamic library:
|
# 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
|
# -> 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.
|
# 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
|
# For most consumers they can ignore the `EXTENDS_VTKM` property as the default
|
||||||
# will be correct.
|
# 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(lib_type ${uses_vtkm_target} TYPE)
|
||||||
get_target_property(requires_static vtkm::cuda INTERFACE_REQUIRES_STATIC_BUILDS)
|
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
|
#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
|
#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
|
#produce the correct error message when VTK-m is a subdirectory include
|
||||||
@ -277,6 +281,7 @@ function(vtkm_library)
|
|||||||
${VTKm_LIB_DEVICE_SOURCES}
|
${VTKm_LIB_DEVICE_SOURCES}
|
||||||
)
|
)
|
||||||
vtkm_add_target_information(${lib_name}
|
vtkm_add_target_information(${lib_name}
|
||||||
|
EXTENDS_VTKM
|
||||||
DEVICE_SOURCES ${VTKm_LIB_DEVICE_SOURCES}
|
DEVICE_SOURCES ${VTKm_LIB_DEVICE_SOURCES}
|
||||||
)
|
)
|
||||||
if(NOT VTKm_USE_DEFAULT_SYMBOL_VISIBILITY)
|
if(NOT VTKm_USE_DEFAULT_SYMBOL_VISIBILITY)
|
||||||
|
Loading…
Reference in New Issue
Block a user