mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
StorageTags are now always exported to resolve future dynamic_cast issues.
Class that need to be passed across dynamic library boundaries such as DynamicArrayHandle need to be properly export. One of 'tricks' of this is that templated classes such as PolymorphicArrayHandleContainer need the Type and Storage types to have public visibility. This makes sure that all vtkm storage tags have public visibility so in the future we can transfer dynamic array handles across libraries.
This commit is contained in:
parent
a16f9fedbe
commit
d8d6fd1741
@ -110,7 +110,7 @@ macro(vtkm_configure_component_Base)
|
||||
|
||||
vtkm_finish_configure_component(Base
|
||||
DEPENDENT_VARIABLES VTKm_base_vtkm_target_FOUND
|
||||
ADD_LIBRARIES vtkm
|
||||
ADD_LIBRARIES vtkm vtkm_cont
|
||||
)
|
||||
endmacro()
|
||||
|
||||
|
@ -630,7 +630,13 @@ function(vtkm_library)
|
||||
set_property(TARGET ${lib_name} APPEND PROPERTY
|
||||
INCLUDE_DIRECTORIES ${VTKm_INCLUDE_DIRS} )
|
||||
|
||||
target_link_libraries(${lib_name} ${VTKm_LIBRARIES})
|
||||
set(lib_subset)
|
||||
foreach(lib ${VTKm_LIBRARIES})
|
||||
if(NOT lib STREQUAL lib_name)
|
||||
list(APPEND lib_subset ${lib})
|
||||
endif()
|
||||
endforeach()
|
||||
target_link_libraries(${lib_name} ${lib_subset})
|
||||
|
||||
set(cxx_args ${VTKm_COMPILE_OPTIONS})
|
||||
separate_arguments(cxx_args)
|
||||
@ -660,11 +666,17 @@ function(vtkm_library)
|
||||
#template classes. This
|
||||
string(TOUPPER ${lib_name} BASE_NAME_UPPER)
|
||||
set(EXPORT_MACRO_NAME "${BASE_NAME_UPPER}")
|
||||
set(EXPORT_IS_BUILT_STATIC false)
|
||||
|
||||
set(EXPORT_IS_BUILT_STATIC 0)
|
||||
get_target_property(is_static ${lib_name} TYPE)
|
||||
if(${is_static} STREQUAL "STATIC_LIBRARY")
|
||||
#If we are building statically set the define symbol
|
||||
set(EXPORT_IS_BUILT_STATIC 1)
|
||||
endif()
|
||||
unset(is_static)
|
||||
|
||||
get_target_property(EXPORT_IMPORT_CONDITION ${lib_name} DEFINE_SYMBOL)
|
||||
if(NOT EXPORT_IMPORT_CONDITION)
|
||||
#If we are building statically set the define symbol
|
||||
set(EXPORT_IS_BUILT_STATIC true)
|
||||
#set EXPORT_IMPORT_CONDITION to what the DEFINE_SYMBOL would be when
|
||||
#building shared
|
||||
set(EXPORT_IMPORT_CONDITION ${lib_name}_EXPORTS)
|
||||
@ -676,8 +688,8 @@ function(vtkm_library)
|
||||
@ONLY)
|
||||
|
||||
unset(EXPORT_MACRO_NAME)
|
||||
unset(EXPORT_IMPORT_CONDITION)
|
||||
unset(EXPORT_IS_BUILT_STATIC)
|
||||
unset(EXPORT_IMPORT_CONDITION)
|
||||
|
||||
install(TARGETS ${lib_name}
|
||||
EXPORT ${VTKm_EXPORT_NAME}
|
||||
|
@ -221,7 +221,7 @@ struct GetTypeInParentheses<void(T)>
|
||||
template<
|
||||
typename T,
|
||||
typename StorageTag_ = VTKM_DEFAULT_STORAGE_TAG>
|
||||
class ArrayHandle : public internal::ArrayHandleBase
|
||||
class VTKM_ALWAYS_EXPORT ArrayHandle : public internal::ArrayHandleBase
|
||||
{
|
||||
private:
|
||||
typedef vtkm::cont::internal::ArrayHandleExecutionManagerBase<T,StorageTag_>
|
||||
|
@ -151,7 +151,7 @@ namespace cont {
|
||||
namespace internal {
|
||||
|
||||
template<typename FirstHandleType, typename SecondHandleType, typename ThirdHandleType>
|
||||
struct StorageTagCartesianProduct { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagCartesianProduct { };
|
||||
|
||||
/// This helper struct defines the value type for a zip container containing
|
||||
/// the given two array handles.
|
||||
|
@ -219,7 +219,7 @@ private:
|
||||
};
|
||||
|
||||
template<typename SignatureWithArrays>
|
||||
struct StorageTagCompositeVector { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagCompositeVector { };
|
||||
|
||||
/// A convenience class that provides a typedef to the appropriate tag for
|
||||
/// a composite storage.
|
||||
|
@ -115,7 +115,7 @@ namespace cont {
|
||||
namespace internal {
|
||||
|
||||
template<typename SourceArrayHandleType, vtkm::IdComponent NUM_COMPONENTS>
|
||||
struct StorageTagGroupVec { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagGroupVec { };
|
||||
|
||||
template<typename SourceArrayHandleType,
|
||||
vtkm::IdComponent NUM_COMPONENTS>
|
||||
|
@ -180,7 +180,7 @@ namespace cont {
|
||||
namespace internal {
|
||||
|
||||
template<typename SourceArrayHandleType, typename OffsetsArrayHandleType>
|
||||
struct StorageTagGroupVecVariable { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagGroupVecVariable { };
|
||||
|
||||
template<typename SourceArrayHandleType, typename OffsetsArrayHandleType>
|
||||
class Storage<
|
||||
|
@ -104,7 +104,7 @@ namespace cont {
|
||||
namespace internal {
|
||||
|
||||
template<typename IndexArrayType, typename ValueArrayType>
|
||||
struct StorageTagPermutation { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagPermutation { };
|
||||
|
||||
template<typename IndexArrayType, typename ValueArrayType>
|
||||
class Storage<
|
||||
|
@ -97,7 +97,7 @@ private:
|
||||
} // internal
|
||||
|
||||
template<typename ArrayHandleInputType>
|
||||
struct StorageTagStreaming { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagStreaming { };
|
||||
|
||||
namespace internal {
|
||||
|
||||
|
@ -155,7 +155,7 @@ namespace internal {
|
||||
|
||||
template<typename ValueType, typename ArrayHandleType, typename FunctorType,
|
||||
typename InverseFunctorType=NullFunctorType>
|
||||
struct StorageTagTransform {};
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagTransform {};
|
||||
|
||||
template<typename T, typename ArrayHandleType, typename FunctorType>
|
||||
class Storage<T, StorageTagTransform<T, ArrayHandleType, FunctorType, NullFunctorType > >
|
||||
|
@ -101,7 +101,7 @@ namespace cont {
|
||||
namespace internal {
|
||||
|
||||
template<typename FirstHandleType, typename SecondHandleType>
|
||||
struct StorageTagZip { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagZip { };
|
||||
|
||||
/// This helper struct defines the value type for a zip container containing
|
||||
/// the given two array handles.
|
||||
|
@ -33,20 +33,20 @@
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
struct CellSetListTagStructured1D
|
||||
struct VTKM_ALWAYS_EXPORT CellSetListTagStructured1D
|
||||
: vtkm::ListTagBase<vtkm::cont::CellSetStructured<1> > { };
|
||||
|
||||
struct CellSetListTagStructured2D
|
||||
struct VTKM_ALWAYS_EXPORT CellSetListTagStructured2D
|
||||
: vtkm::ListTagBase<vtkm::cont::CellSetStructured<2> > { };
|
||||
|
||||
struct CellSetListTagStructured3D
|
||||
struct VTKM_ALWAYS_EXPORT CellSetListTagStructured3D
|
||||
: vtkm::ListTagBase<vtkm::cont::CellSetStructured<3> > { };
|
||||
|
||||
template<typename ShapeStorageTag = VTKM_DEFAULT_SHAPE_STORAGE_TAG,
|
||||
typename NumIndicesStorageTag = VTKM_DEFAULT_NUM_INDICES_STORAGE_TAG,
|
||||
typename ConnectivityStorageTag = VTKM_DEFAULT_CONNECTIVITY_STORAGE_TAG,
|
||||
typename OffsetsStorageTag = VTKM_DEFAULT_OFFSETS_STORAGE_TAG >
|
||||
struct CellSetListTagExplicit
|
||||
struct VTKM_ALWAYS_EXPORT CellSetListTagExplicit
|
||||
: vtkm::ListTagBase<
|
||||
vtkm::cont::CellSetExplicit<
|
||||
ShapeStorageTag,
|
||||
@ -54,11 +54,11 @@ struct CellSetListTagExplicit
|
||||
ConnectivityStorageTag,
|
||||
OffsetsStorageTag> > { };
|
||||
|
||||
struct CellSetListTagExplicitDefault
|
||||
struct VTKM_ALWAYS_EXPORT CellSetListTagExplicitDefault
|
||||
: CellSetListTagExplicit<> { };
|
||||
|
||||
|
||||
struct CellSetListTagCommon
|
||||
struct VTKM_ALWAYS_EXPORT CellSetListTagCommon
|
||||
: vtkm::ListTagBase<
|
||||
vtkm::cont::CellSetStructured<2>,
|
||||
vtkm::cont::CellSetStructured<3>,
|
||||
@ -66,13 +66,13 @@ struct CellSetListTagCommon
|
||||
vtkm::cont::CellSetSingleType<>
|
||||
> { };
|
||||
|
||||
struct CellSetListTagStructured
|
||||
struct VTKM_ALWAYS_EXPORT CellSetListTagStructured
|
||||
: vtkm::ListTagBase<
|
||||
vtkm::cont::CellSetStructured<2>,
|
||||
vtkm::cont::CellSetStructured<3>
|
||||
> { };
|
||||
|
||||
struct CellSetListTagUnstructured
|
||||
struct VTKM_ALWAYS_EXPORT CellSetListTagUnstructured
|
||||
: vtkm::ListTagBase<
|
||||
vtkm::cont::CellSetExplicit<>,
|
||||
vtkm::cont::CellSetSingleType<>
|
||||
|
@ -63,7 +63,7 @@ struct PolymorphicArrayHandleContainerBase
|
||||
/// simple questions about the object.
|
||||
///
|
||||
template<typename T, typename Storage>
|
||||
struct PolymorphicArrayHandleContainer
|
||||
struct VTKM_ALWAYS_EXPORT PolymorphicArrayHandleContainer
|
||||
: public PolymorphicArrayHandleContainerBase
|
||||
{
|
||||
typedef vtkm::cont::ArrayHandle<T, Storage> ArrayHandleType;
|
||||
@ -184,7 +184,7 @@ DynamicArrayHandleTryCast(
|
||||
/// lists.
|
||||
///
|
||||
template<typename TypeList, typename StorageList>
|
||||
class DynamicArrayHandleBase
|
||||
class VTKM_ALWAYS_EXPORT DynamicArrayHandleBase
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
|
@ -116,7 +116,7 @@ DynamicCellSetTryCast(
|
||||
/// with the default cell set list.
|
||||
///
|
||||
template<typename CellSetList>
|
||||
class DynamicCellSetBase
|
||||
class VTKM_ALWAYS_EXPORT DynamicCellSetBase
|
||||
{
|
||||
VTKM_IS_LIST_TAG(CellSetList);
|
||||
public:
|
||||
|
@ -55,11 +55,11 @@ namespace cont {
|
||||
/// StorageTagBasic.
|
||||
///
|
||||
/// To implement your own StorageTag, you first must create a tag class (an
|
||||
/// empty struct) defining your tag (i.e. struct StorageTagMyAlloc { };). Then
|
||||
/// empty struct) defining your tag (i.e. struct VTKM_ALWAYS_EXPORT StorageTagMyAlloc { };). Then
|
||||
/// provide a partial template specialization of vtkm::cont::internal::Storage
|
||||
/// for your new tag.
|
||||
///
|
||||
struct StorageTag___ { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTag___ { };
|
||||
#endif // VTKM_DOXYGEN_ONLY
|
||||
|
||||
namespace internal {
|
||||
|
@ -58,7 +58,7 @@ namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
/// A tag for the basic implementation of a Storage object.
|
||||
struct StorageTagBasic { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagBasic { };
|
||||
|
||||
namespace internal {
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace cont {
|
||||
/// any operation that tries to modify it.
|
||||
///
|
||||
template<class ArrayPortalType>
|
||||
struct StorageTagImplicit
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagImplicit
|
||||
{
|
||||
typedef ArrayPortalType PortalType;
|
||||
};
|
||||
|
@ -32,7 +32,7 @@
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
struct StorageListTagBasic
|
||||
struct VTKM_ALWAYS_EXPORT StorageListTagBasic
|
||||
: vtkm::ListTagBase<vtkm::cont::StorageTagBasic> { };
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace vtkm {
|
||||
namespace cont {
|
||||
namespace cuda {
|
||||
|
||||
struct StorageTagCuda { };
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagCuda { };
|
||||
|
||||
} // namespace cuda
|
||||
} // namespace cont
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef vtk_m_cont_internal_SimplePolymorphicContainer_h
|
||||
#define vtk_m_cont_internal_SimplePolymorphicContainer_h
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <memory>
|
||||
|
||||
@ -49,7 +51,7 @@ struct SimplePolymorphicContainerBase {
|
||||
/// allows for safer dynamic downcasts.
|
||||
///
|
||||
template<typename T>
|
||||
struct SimplePolymorphicContainer : public SimplePolymorphicContainerBase
|
||||
struct VTKM_ALWAYS_EXPORT SimplePolymorphicContainer : public SimplePolymorphicContainerBase
|
||||
{
|
||||
T Item;
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef vtkm_cont_internal_StorageError_h
|
||||
#define vtkm_cont_internal_StorageError_h
|
||||
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
@ -30,7 +31,7 @@ namespace internal {
|
||||
/// point, you have to specify an appropriate Storage or else get a compile
|
||||
/// error.
|
||||
///
|
||||
struct StorageTagError
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagError
|
||||
{
|
||||
// Not implemented.
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user