vtk-m2/vtkm/cont/CMakeLists.txt
Kenneth Moreland 63ef84ed78 Optionally remove all use of ArrayHandleVirtual
As we remove more and more virtual methods from VTK-m, I expect several
users will be interested in completely removing them from the build for
several reasons.

1. They may be compiling for hardware that does not support virtual
methods.
2. They may need to compile for CUDA but need shared libraries.
3. It should go a bit faster.

To enable this, a CMake option named `VTKm_NO_DEPRECATED_VIRTUAL` is
added. It defaults to `OFF`. But when it is `ON`, none of the code that
both uses virtuals and is deprecated will be built.

Currently, only `ArrayHandleVirtual` is deprecated, so the rest of the
virtual classes will still be built. As we move forward, more will be
removed until all virtual method functionality is removed.
2020-09-04 22:52:45 -06:00

281 lines
7.1 KiB
CMake

##============================================================================
## Copyright (c) Kitware, Inc.
## All rights reserved.
## See LICENSE.txt for details.
##
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notice for more information.
##============================================================================
set(headers
Algorithm.h
ArrayCopy.h
ArrayGetValues.h
ArrayHandle.h
ArrayHandleBasic.h
ArrayHandleBitField.h
ArrayHandleCartesianProduct.h
ArrayHandleCast.h
ArrayHandleCompositeVector.h
ArrayHandleConcatenate.h
ArrayHandleConstant.h
ArrayHandleCounting.h
ArrayHandleDecorator.h
ArrayHandleDiscard.h
ArrayHandleExtractComponent.h
ArrayHandleExtrudeCoords.h
ArrayHandleExtrudeField.h
ArrayHandleGroupVec.h
ArrayHandleGroupVecVariable.h
ArrayHandleImplicit.h
ArrayHandleIndex.h
ArrayHandleMultiplexer.h
ArrayHandlePermutation.h
ArrayHandleReverse.h
ArrayHandleRandomStandardNormal.h
ArrayHandleRandomUniformBits.h
ArrayHandleRandomUniformReal.h
ArrayHandleSOA.h
ArrayHandleSwizzle.h
ArrayHandleTransform.h
ArrayHandleUniformPointCoordinates.h
ArrayHandleView.h
ArrayHandleZip.h
ArrayPortal.h
ArrayPortalToIterators.h
ArrayRangeCompute.h
AssignerPartitionedDataSet.h
AtomicArray.h
BitField.h
BoundsCompute.h
BoundsGlobalCompute.h
CastAndCall.h
CellLocator.h
CellLocatorBoundingIntervalHierarchy.h
CellLocatorGeneral.h
CellLocatorRectilinearGrid.h
CellLocatorUniformBins.h
CellLocatorUniformGrid.h
CellSet.h
CellSetExplicit.h
CellSetExtrude.h
CellSetList.h
CellSetListTag.h
CellSetPermutation.h
CellSetSingleType.h
CellSetStructured.h
ColorTable.h
ColorTableSamples.h
CoordinateSystem.h
DataSet.h
DataSetBuilderExplicit.h
DataSetBuilderRectilinear.h
DataSetBuilderUniform.h
DataSetFieldAdd.h
DeviceAdapter.h
DeviceAdapterAlgorithm.h
DeviceAdapterList.h
DeviceAdapterListTag.h
DeviceAdapterTag.h
DynamicCellSet.h
EnvironmentTracker.h
Error.h
ErrorBadAllocation.h
ErrorBadDevice.h
ErrorBadType.h
ErrorBadValue.h
ErrorExecution.h
ErrorFilterExecution.h
ErrorInternal.h
ExecutionAndControlObjectBase.h
ExecutionObjectBase.h
Field.h
FieldRangeCompute.h
FieldRangeGlobalCompute.h
ImplicitFunctionHandle.h
Initialize.h
Invoker.h
Logging.h
ParticleArrayCopy.h
PartitionedDataSet.h
PointLocator.h
PointLocatorUniformGrid.h
RuntimeDeviceInformation.h
RuntimeDeviceTracker.h
Serialization.h
Storage.h
StorageExtrude.h
StorageImplicit.h
StorageList.h
StorageListTag.h
Timer.h
Token.h
TryExecute.h
SerializableTypeString.h
UncertainArrayHandle.h
UnknownArrayHandle.h
VariantArrayHandle.h
VirtualObjectHandle.h
)
set(template_sources
ArrayHandle.hxx
ArrayRangeCompute.hxx
CellSetExplicit.hxx
CellSetExtrude.hxx
CellSetStructured.hxx
ColorTable.hxx
FieldRangeCompute.hxx
FieldRangeGlobalCompute.hxx
ParticleArrayCopy.hxx
VirtualObjectHandle.hxx
)
set(sources
ArrayHandle.cxx
ArrayHandleBasic.cxx
ArrayHandleSOA.cxx
BitField.cxx
ColorTablePresets.cxx
DeviceAdapterTag.cxx
EnvironmentTracker.cxx
ErrorBadDevice.cxx
ErrorBadType.cxx
internal/Buffer.cxx
internal/DeviceAdapterMemoryManager.cxx
internal/DeviceAdapterMemoryManagerShared.cxx
internal/TransferInfo.cxx
internal/VirtualObjectTransfer.cxx
Initialize.cxx
Logging.cxx
RuntimeDeviceTracker.cxx
Token.cxx
TryExecute.cxx
)
# This list of sources has code that uses devices and so might need to be
# compiled with a device-specific compiler (like CUDA).
set(device_sources
ArrayRangeCompute.cxx
AssignerPartitionedDataSet.cxx
BoundsCompute.cxx
BoundsGlobalCompute.cxx
CellLocator.cxx
CellLocatorBoundingIntervalHierarchy.cxx
CellLocatorGeneral.cxx
CellLocatorRectilinearGrid.cxx
CellLocatorUniformBins.cxx
CellLocatorUniformGrid.cxx
CellSet.cxx
CellSetExplicit.cxx
CellSetExtrude.cxx
CellSetStructured.cxx
ColorTable.cxx
CoordinateSystem.cxx
DataSet.cxx
DataSetBuilderExplicit.cxx
DataSetBuilderRectilinear.cxx
DataSetBuilderUniform.cxx
Field.cxx
FieldRangeCompute.cxx
FieldRangeGlobalCompute.cxx
PartitionedDataSet.cxx
PointLocator.cxx
PointLocatorUniformGrid.cxx
RuntimeDeviceInformation.cxx
Timer.cxx
UnknownArrayHandle.cxx
)
if (NOT VTKm_NO_DEPRECATED_VIRTUAL)
set(headers ${headers}
ArrayHandleVirtual.h
ArrayHandleVirtualCoordinates.h
StorageVirtual.h
)
set(template_sources ${template_sources}
ArrayHandleVirtual.hxx
StorageVirtual.hxx
)
set(device_sources ${device_sources}
ArrayHandleVirtual.cxx
StorageVirtual.cxx
)
endif()
#-----------------------------------------------------------------------------
# Set up default types, which can be custom configured by other build systems.
vtkm_get_kit_name(kit_name kit_dir)
# Some custom types included with VTK-m
vtkm_option(VTKm_USE_DEFAULT_TYPES_FOR_VTK "Compile VTK-m algorithms for use with types from VTK." OFF)
if (VTKm_USE_DEFAULT_TYPES_FOR_VTK)
set(VTKm_DEFAULT_TYPES_HEADER "internal/DefaultTypesVTK.h.in")
endif()
mark_as_advanced(VTKm_USE_DEFAULT_TYPES_FOR_VTK)
if (VTKm_DEFAULT_TYPES_HEADER)
set(VTK_M_HAS_DEFAULT_TYPES_HEADER TRUE)
get_filename_component(VTKm_DEFAULT_TYPES_HEADER_FILENAME ${VTKm_DEFAULT_TYPES_HEADER} NAME_WE)
set(VTKm_DEFAULT_TYPES_HEADER_FILENAME "${VTKm_DEFAULT_TYPES_HEADER_FILENAME}.h")
configure_file(${VTKm_DEFAULT_TYPES_HEADER}
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/internal/${VTKm_DEFAULT_TYPES_HEADER_FILENAME}
@ONLY
)
vtkm_install_headers(vtkm/cont/internal
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/internal/${VTKm_DEFAULT_TYPES_HEADER_FILENAME}
)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DefaultTypes.h.in
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/DefaultTypes.h
@ONLY
)
vtkm_install_headers(vtkm/cont
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/DefaultTypes.h
)
#-----------------------------------------------------------------------------
vtkm_library( NAME vtkm_cont
SOURCES ${sources}
TEMPLATE_SOURCES ${template_sources}
HEADERS ${headers}
DEVICE_SOURCES ${device_sources}
)
add_subdirectory(internal)
add_subdirectory(arg)
add_subdirectory(serial)
add_subdirectory(tbb)
add_subdirectory(openmp)
add_subdirectory(cuda)
add_subdirectory(kokkos)
set(backends )
if(TARGET vtkm::tbb)
list(APPEND backends vtkm::tbb)
endif()
if(TARGET vtkm::cuda)
list(APPEND backends vtkm::cuda)
endif()
if(TARGET vtkm::openmp)
list(APPEND backends vtkm::openmp)
endif()
if(TARGET vtkm::kokkos)
list(APPEND backends vtkm::kokkos)
endif()
target_link_libraries(vtkm_cont PUBLIC vtkm_compiler_flags ${backends})
target_link_libraries(vtkm_cont PUBLIC Threads::Threads)
target_link_libraries(vtkm_cont PUBLIC vtkm_optionparser vtkm_diy vtkm_lcl)
if(TARGET vtkm_loguru)
target_link_libraries(vtkm_cont PRIVATE vtkm_loguru)
endif()
#-----------------------------------------------------------------------------
add_subdirectory(testing)