cmake: namespace vtkm export targets

This commit is contained in:
Vicente Adolfo Bolea Sanchez 2022-12-09 18:46:56 -05:00
parent d4fc84f12e
commit 049d0cca8c
50 changed files with 285 additions and 132 deletions

@ -62,6 +62,12 @@ if(TARGET vtkm_vectorization_flags)
endif()
add_library(vtkm_vectorization_flags INTERFACE)
set_target_properties(
vtkm_vectorization_flags
PROPERTIES
EXPORT_NAME vectorization_flags
)
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
install(TARGETS vtkm_vectorization_flags EXPORT ${VTKm_EXPORT_NAME})
endif()
@ -193,7 +199,7 @@ target_compile_options(vtkm_vectorization_flags
INTERFACE $<$<COMPILE_LANGUAGE:CXX>:${flags}>
)
if(TARGET vtkm::cuda AND flags AND NOT CMAKE_CUDA_HOST_COMPILER)
if(TARGET vtkm_cuda AND flags AND NOT CMAKE_CUDA_HOST_COMPILER)
# Also propagate down these optimizations when building host side code
# with cuda. To be safe we only do this when we know the C++ and CUDA
# host compiler are from the same vendor

@ -30,6 +30,11 @@ endif()
# vtkm_compiler_flags is used by all the vtkm targets and consumers of VTK-m
# The flags on vtkm_compiler_flags are needed when using/building vtk-m
add_library(vtkm_compiler_flags INTERFACE)
set_target_properties(
vtkm_compiler_flags
PROPERTIES
EXPORT_NAME compiler_flags
)
# When building libraries/tests that are part of the VTK-m repository
# inherit the properties from vtkm_vectorization_flags.
@ -50,12 +55,12 @@ target_compile_features(vtkm_compiler_flags INTERFACE cxx_std_14)
# they don't use.
if(VTKM_COMPILER_IS_MSVC)
target_compile_options(vtkm_compiler_flags INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/Gy>)
if(TARGET vtkm::cuda)
if(TARGET vtkm_cuda)
target_compile_options(vtkm_compiler_flags INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler="/Gy">)
endif()
elseif(NOT (VTKM_COMPILER_IS_PGI OR VTKM_COMPILER_IS_XL)) #can't find an equivalant PGI/XL flag
target_compile_options(vtkm_compiler_flags INTERFACE $<$<COMPILE_LANGUAGE:CXX>:-ffunction-sections>)
if(TARGET vtkm::cuda)
if(TARGET vtkm_cuda)
target_compile_options(vtkm_compiler_flags INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=-ffunction-sections>)
endif()
endif()
@ -63,7 +68,7 @@ endif()
# Enable large object support so we can have 2^32 addressable sections
if(VTKM_COMPILER_IS_MSVC)
target_compile_options(vtkm_compiler_flags INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/bigobj>)
if(TARGET vtkm::cuda)
if(TARGET vtkm_cuda)
target_compile_options(vtkm_compiler_flags INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler="/bigobj">)
endif()
endif()
@ -79,6 +84,11 @@ target_include_directories(vtkm_compiler_flags INTERFACE
# vtkm_developer_flags is used ONLY BY libraries that are built as part of this
# repository
add_library(vtkm_developer_flags INTERFACE)
set_target_properties(
vtkm_developer_flags
PROPERTIES
EXPORT_NAME developer_flags
)
# Additional warnings just for Clang 3.5+, and AppleClang 7+
# about failures to vectorize.
@ -101,7 +111,7 @@ if(VTKM_COMPILER_IS_MSVC)
#Setup MSVC warnings with CUDA and CXX
target_compile_options(vtkm_developer_flags INTERFACE $<$<COMPILE_LANGUAGE:CXX>:${cxx_flags}>)
if(TARGET vtkm::cuda)
if(TARGET vtkm_cuda)
target_compile_options(vtkm_developer_flags INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:${cuda_flags} -Xcudafe=--diag_suppress=1394,--diag_suppress=766>)
endif()
@ -109,7 +119,7 @@ if(VTKM_COMPILER_IS_MSVC)
# In VS2013 the C4127 warning has a bug in the implementation and
# generates false positive warnings for lots of template code
target_compile_options(vtkm_developer_flags INTERFACE $<$<COMPILE_LANGUAGE:CXX>:-wd4127>)
if(TARGET vtkm::cuda)
if(TARGET vtkm_cuda)
target_compile_options(vtkm_developer_flags INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=-wd4127>)
endif()
endif()
@ -165,7 +175,7 @@ elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG)
endif()
target_compile_options(vtkm_developer_flags INTERFACE $<$<COMPILE_LANGUAGE:CXX>:${cxx_flags}>)
if(TARGET vtkm::cuda)
if(TARGET vtkm_cuda)
target_compile_options(vtkm_developer_flags INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:${cuda_flags}>)
endif()
endif()
@ -176,10 +186,10 @@ function(setup_cuda_flags)
endfunction()
#common warnings for all platforms when building cuda
if ((TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda))
if ((TARGET vtkm_cuda) OR (TARGET vtkm::kokkos_cuda))
setup_cuda_flags()
endif()
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
install(TARGETS vtkm_compiler_flags vtkm_developer_flags EXPORT ${VTKm_EXPORT_NAME})
vtkm_install_targets(TARGETS vtkm_compiler_flags vtkm_developer_flags)
endif()

@ -10,22 +10,22 @@
# When this file is run by CMake through the find_package command, the
# following targets will exist:
# vtkm_cont Target that contains most of VTK-m
# vtkm::cont Target that contains most of VTK-m
#
# vtkm_rendering Target that contains all the rendering code
# vtkm::rendering Target that contains all the rendering code
#
# vtkm_filter Target that contains all of VTK-m pre-built filters
# vtkm::filter Target that contains all of VTK-m pre-built filters
#
# vtkm_source Target that contains all of VTK-m pre-built sources
# vtkm::source Target that contains all of VTK-m pre-built sources
#
# vtkm::tbb Target that contains tbb related link information
# implicitly linked to by `vtkm_cont` if tbb is enabled
# vtkm::tbb Target that contains tbb related link information
# implicitly linked to by `vtkm_cont` if tbb is enabled
#
# vtkm::openmp Target that contains openmp related link information
# implicitly linked to by `vtkm_cont` if openmp is enabled
# vtkm::openmp Target that contains openmp related link information
# implicitly linked to by `vtkm_cont` if openmp is enabled
#
# vtkm::cuda Target that contains cuda related link information
# implicitly linked to by `vtkm_cont` if cuda is enabled
# vtkm::cuda Target that contains cuda related link information
# implicitly linked to by `vtkm_cont` if cuda is enabled
#
# The following local variables will also be defined:
#
@ -47,7 +47,6 @@
# VTKm_ENABLE_OSMESA_CONTEXT Will be enabled if VTK-m rendering was built with a osmesa context
# VTKm_ENABLE_EGL_CONTEXT Will be enabled if VTK-m rendering was built with a EGL context
#
#
if (CMAKE_VERSION VERSION_LESS "3.12")
message(FATAL_ERROR "VTK-m requires CMake 3.12+")
@ -109,11 +108,20 @@ 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)
if(DEFINED PACKAGE_FIND_VERSION AND PACKAGE_FIND_VERSION VERSION_LESS 2.0)
add_library(vtkm_cont ALIAS vtkm::cont)
add_library(vtkm_filter ALIAS vtkm::filter)
add_library(vtkm_io ALIAS vtkm::io)
add_library(vtkm_rendering ALIAS vtkm::rendering)
add_library(vtkm_source ALIAS vtkm::source)
add_library(vtkm_worklet ALIAS vtkm::worklet)
endif()
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
# EXPORT_PROPERTIES of the vtkm::cuda target
if(VTKm_ENABLE_CUDA AND VTKM_FROM_INSTALL_DIR)
# Canonical way of setting CUDA arch
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)

@ -8,6 +8,14 @@
## PURPOSE. See the above copyright notice for more information.
##============================================================================
macro(vtkm_diy_get_general_target target)
if(CMAKE_PROJECT_NAME STREQUAL "VTKm")
set(${target} "vtkm_diy")
else()
set(${target} "vtkm::diy")
endif()
endmacro()
macro(_vtkm_diy_target flag target)
set(${target} "vtkmdiympi")
if (NOT ${flag})
@ -19,7 +27,8 @@ function(vtkm_diy_init_target)
set(vtkm_diy_default_flag "${VTKm_ENABLE_MPI}")
_vtkm_diy_target(vtkm_diy_default_flag vtkm_diy_default_target)
set_target_properties(vtkm_diy PROPERTIES
vtkm_diy_get_general_target(diy_target)
set_target_properties(${diy_target} PROPERTIES
vtkm_diy_use_mpi_stack ${vtkm_diy_default_flag}
vtkm_diy_target ${vtkm_diy_default_target})
endfunction()
@ -30,30 +39,33 @@ function(vtkm_diy_use_mpi_push)
if (NOT ARGC EQUAL 0)
set(topval ${ARGV0})
endif()
get_target_property(stack vtkm_diy vtkm_diy_use_mpi_stack)
vtkm_diy_get_general_target(diy_target)
get_target_property(stack ${diy_target} vtkm_diy_use_mpi_stack)
list (APPEND stack ${topval})
_vtkm_diy_target(topval target)
set_target_properties(vtkm_diy PROPERTIES
set_target_properties(${diy_target} PROPERTIES
vtkm_diy_use_mpi_stack "${stack}"
vtkm_diy_target "${target}")
endfunction()
function(vtkm_diy_use_mpi value)
get_target_property(stack vtkm_diy vtkm_diy_use_mpi_stack)
vtkm_diy_get_general_target(diy_target)
get_target_property(stack ${diy_target} vtkm_diy_use_mpi_stack)
list (REMOVE_AT stack -1)
list (APPEND stack ${value})
_vtkm_diy_target(value target)
set_target_properties(vtkm_diy PROPERTIES
set_target_properties(${diy_target} PROPERTIES
vtkm_diy_use_mpi_stack "${stack}"
vtkm_diy_target "${target}")
endfunction()
function(vtkm_diy_use_mpi_pop)
get_target_property(stack vtkm_diy vtkm_diy_use_mpi_stack)
vtkm_diy_get_general_target(diy_target)
get_target_property(stack ${diy_target} vtkm_diy_use_mpi_stack)
list (GET stack -1 value)
list (REMOVE_AT stack -1)
_vtkm_diy_target(value target)
set_target_properties(vtkm_diy PROPERTIES
set_target_properties(${diy_target} PROPERTIES
vtkm_diy_use_mpi_stack "${stack}"
vtkm_diy_target "${target}")
endfunction()

@ -41,38 +41,39 @@ function(vtkm_extract_real_library library real_library)
endif()
endfunction()
if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb)
if(VTKm_ENABLE_TBB AND NOT TARGET vtkm_tbb)
# Skip find_package(TBB) if we already have it
if (NOT TARGET TBB::tbb)
find_package(TBB REQUIRED)
endif()
add_library(vtkmTBB INTERFACE)
add_library(vtkm::tbb ALIAS vtkmTBB)
target_link_libraries(vtkmTBB INTERFACE TBB::tbb)
target_compile_definitions(vtkmTBB INTERFACE "TBB_VERSION_MAJOR=${TBB_VERSION_MAJOR}")
set_target_properties(vtkmTBB PROPERTIES EXPORT_NAME vtkm::tbb)
install(TARGETS vtkmTBB EXPORT ${VTKm_EXPORT_NAME})
add_library(vtkm_tbb INTERFACE)
target_link_libraries(vtkm_tbb INTERFACE TBB::tbb)
target_compile_definitions(vtkm_tbb INTERFACE "TBB_VERSION_MAJOR=${TBB_VERSION_MAJOR}")
set_target_properties(vtkm_tbb PROPERTIES EXPORT_NAME tbb)
install(TARGETS vtkm_tbb EXPORT ${VTKm_EXPORT_NAME})
endif()
if(VTKm_ENABLE_OPENMP AND NOT TARGET vtkm::openmp)
if(VTKm_ENABLE_OPENMP AND NOT TARGET vtkm_openmp)
find_package(OpenMP 4.0 REQUIRED COMPONENTS CXX QUIET)
add_library(vtkm::openmp INTERFACE IMPORTED GLOBAL)
add_library(vtkm_openmp INTERFACE)
set_target_properties(vtkm_openmp PROPERTIES EXPORT_NAME openmp)
if(OpenMP_CXX_FLAGS)
set_property(TARGET vtkm::openmp
set_property(TARGET vtkm_openmp
APPEND PROPERTY INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CXX>:${OpenMP_CXX_FLAGS}>)
if(VTKm_ENABLE_CUDA)
string(REPLACE ";" "," openmp_cuda_flags "-Xcompiler=${OpenMP_CXX_FLAGS}")
set_property(TARGET vtkm::openmp
set_property(TARGET vtkm_openmp
APPEND PROPERTY INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CUDA>:${openmp_cuda_flags}>)
endif()
endif()
if(OpenMP_CXX_LIBRARIES)
set_target_properties(vtkm::openmp PROPERTIES
set_target_properties(vtkm_openmp PROPERTIES
INTERFACE_LINK_LIBRARIES "${OpenMP_CXX_LIBRARIES}")
endif()
install(TARGETS vtkm_openmp EXPORT ${VTKm_EXPORT_NAME})
endif()
if(VTKm_ENABLE_CUDA)
@ -84,10 +85,9 @@ if(VTKm_ENABLE_CUDA)
message(FATAL_ERROR "VTK-m CUDA support requires version 9.2+")
endif()
if(NOT TARGET vtkm::cuda)
if(NOT TARGET vtkm_cuda)
add_library(vtkm_cuda INTERFACE)
add_library(vtkm::cuda ALIAS vtkm_cuda)
set_target_properties(vtkm_cuda PROPERTIES EXPORT_NAME vtkm::cuda)
set_target_properties(vtkm_cuda PROPERTIES EXPORT_NAME cuda)
install(TARGETS vtkm_cuda EXPORT ${VTKm_EXPORT_NAME})
# Reserve `requires_static_builds` to potential work around issues

@ -92,10 +92,9 @@ endif()
#-----------------------------------------------------------------------------
if(VTKm_ENABLE_RENDERING AND NOT TARGET vtkm_rendering_gl_context)
add_library(vtkm_rendering_gl_context INTERFACE)
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
install(TARGETS vtkm_rendering_gl_context
EXPORT ${VTKm_EXPORT_NAME}
)
vtkm_install_targets(TARGETS vtkm_rendering_gl_context)
endif()
endif()

@ -197,7 +197,7 @@ endfunction()
#
# If VTK-m was built with CMake 3.18+ and you are using CMake 3.18+ and have
# a cmake_minimum_required of 3.18 or have set policy CMP0105 to new, this will
# return an empty string as the `vtkm::cuda` target will correctly propagate
# return an empty string as the `vtkm_cuda` target will correctly propagate
# all the necessary flags.
#
# This is required for CMake < 3.18 as they don't support the `$<DEVICE_LINK>`
@ -211,11 +211,11 @@ endfunction()
#
function(vtkm_get_cuda_flags settings_var)
if(TARGET vtkm::cuda)
if(TARGET vtkm_cuda)
if(POLICY CMP0105)
cmake_policy(GET CMP0105 does_device_link)
get_property(arch_flags
TARGET vtkm::cuda
TARGET vtkm_cuda
PROPERTY INTERFACE_LINK_OPTIONS)
if(arch_flags AND CMP0105 STREQUAL "NEW")
return()
@ -223,7 +223,7 @@ function(vtkm_get_cuda_flags settings_var)
endif()
get_property(arch_flags
TARGET vtkm::cuda
TARGET vtkm_cuda
PROPERTY cuda_architecture_flags)
set(${settings_var} "${${settings_var}} ${arch_flags}" PARENT_SCOPE)
endif()
@ -259,6 +259,66 @@ function(vtkm_add_drop_unused_function_flags uses_vtkm_target)
endif()
endfunction()
#-----------------------------------------------------------------------------
# This function takes a target name and returns the mangled version of its name
# in a form that complies with the VTK-m export target naming scheme.
macro(vtkm_target_mangle output target)
string(REPLACE "vtkm_" "" ${output} ${target})
endmacro()
#-----------------------------------------------------------------------------
# Enable VTK-m targets to be installed.
#
# This function decorates the `install` CMake function mangling the exported
# target names to comply with the VTK-m exported target names scheme. Use this
# function instead of the canonical CMake `install` function for VTK-m targets.
#
# Signature:
# vtkm_install_targets(
# TARGETS <target[s]>
# [EXPORT <export_name>]
# [ARGS <cmake_install_args>]
# )
#
# Usage:
# add_library(vtkm_library)
# vtkm_install_targets(TARGETS vtkm_library ARGS COMPONENT core)
#
# TARGETS: List of targets to be installed.
#
# EXPORT: [OPTIONAL] The name of the export set to which this target will be
# added. If omitted vtkm_install_targets will use the value of
# VTKm_EXPORT_NAME by default.
#
# ARGS: [OPTIONAL] Any argument other than `TARGETS` and `EXPORT` accepted
# by the `install` CMake function:
# <https://cmake.org/cmake/help/latest/command/install.html>
#
function(vtkm_install_targets)
set(oneValueArgs EXPORT)
set(multiValueArgs TARGETS ARGS)
cmake_parse_arguments(VTKm_INSTALL "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(export_name ${VTKm_EXPORT_NAME})
if(VTKm_INSTALL_EXPORT)
set(export_name ${VTKm_INSTALL_EXPORT})
endif()
if(NOT DEFINED VTKm_INSTALL_TARGETS)
message(FATAL_ERROR "vtkm_install_targets invoked without TARGETS arguments.")
endif()
if(DEFINED VTKm_INSTALL_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "vtkm_install_targets missing ARGS keyword prepending install arguments")
endif()
foreach(tgt IN LISTS VTKm_INSTALL_TARGETS)
vtkm_target_mangle(tgt_mangled ${tgt})
set_target_properties(${tgt} PROPERTIES EXPORT_NAME ${tgt_mangled})
endforeach()
install(TARGETS ${VTKm_INSTALL_TARGETS} EXPORT ${export_name} ${VTKm_INSTALL_ARGS})
endfunction(vtkm_install_targets)
#-----------------------------------------------------------------------------
# Add a relevant information to target that wants to use VTK-m.
@ -301,7 +361,7 @@ endfunction()
#
# If VTK-m was built with CMake 3.18+ and you are using CMake 3.18+ and have
# a cmake_minimum_required of 3.18 or have set policy CMP0105 to new, this will
# return an empty string as the `vtkm::cuda` target will correctly propagate
# return an empty string as the `vtkm_cuda` target will correctly propagate
# all the necessary flags.
#
# Note: calling `vtkm_add_target_information` multiple times with
@ -374,7 +434,7 @@ function(vtkm_add_target_information uses_vtkm_target)
endforeach()
endif()
if((TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda))
if((TARGET vtkm_cuda) OR (TARGET vtkm::kokkos_cuda))
set_source_files_properties(${VTKm_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "CUDA")
elseif(TARGET vtkm::kokkos_hip)
set_source_files_properties(${VTKm_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "HIP")
@ -513,8 +573,7 @@ function(vtkm_library)
endif()
#install the library itself
install(TARGETS ${lib_name}
EXPORT ${VTKm_EXPORT_NAME}
vtkm_install_targets(TARGETS ${lib_name} ARGS
ARCHIVE DESTINATION ${VTKm_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${VTKm_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${VTKm_INSTALL_BIN_DIR}

@ -412,9 +412,11 @@ if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
# Create and install exports for external projects
export(EXPORT ${VTKm_EXPORT_NAME}
NAMESPACE vtkm::
FILE ${VTKm_BUILD_CMAKE_BASE_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
)
install(EXPORT ${VTKm_EXPORT_NAME}
NAMESPACE vtkm::
DESTINATION ${VTKm_INSTALL_CONFIG_DIR}
FILE VTKmTargets.cmake
)

@ -0,0 +1,42 @@
# VTK-m namespace for its exported CMake targets
VTK-m exported CMake targets are now prefixed with the `vtkm::` namespace.
## What it means for VTK-m users
VTK-m users will now need to prepend a `vtkm::` prefix when they refer to a
VTK-m CMake target in their projects as shown below:
```
add_executable(example example.cxx)
# Before:
target_link_libraries(example vtkm_cont vtkm_rendering)
# Now:
target_link_libraries(example vtkm::cont vtkm::rendering)
```
For compatibility purposes we still provide additional exported targets with the
previous naming scheme, in the form of `vtkm_TARGET`, when VTK-m is found
using:
```
# With any version less than 2.0
find_package(VTK-m 1.9)
add_executable(example example.cxx)
# This is still valid
target_link_libraries(example vtkm_cont vtkm_rendering)
```
Use with care since we might remove those targets in future releases.
## What it means for VTK-m developers
While VTK-m exported targets are now prefixed with the `vtkm::` prefix, internal
target names are still in the form of `vtkm_TARGET`.
To perform this name transformation in VTK-m targets a new CMake function has
been provided that decorates the canonical `install` routine. Use this functions
instead of `install` when creating new `VTK-m` targets, further information can
be found at the `vtkm_install_targets` function header at
`CMake/VTKmWrappers.cmake`.

@ -8,10 +8,27 @@
## PURPOSE. See the above copyright notice for more information.
##============================================================================
#add the directory that contains the VTK-m config file to the cmake
#path so that our examples can find VTK-m
if(VTKm_ENABLE_EXAMPLES)
# VTKm examples expects vtkm libraries to be namespaced with the prefix vtkm::.
# However as the examples are also built as just another part of the VTK-m code
# those prefix are not added to the targets (This happens during the
# installation). To workaround this issue here, we create IMPORTED libs linking
# to the vtkm libraries used by the examples with expected the vtkm:: prefix.
vtkm_module_get_list(module_list)
foreach(tgt IN LISTS module_list)
if(TARGET ${tgt})
# The reason of creating this phony IMPORTED libraries instead of making
# ALIAS libraries is that ALIAS libraries are GLOBAL whereas IMPORTED are
# local at the directory level where they are created. We do not want these
# phony targets to be visible outside of the example directory.
vtkm_target_mangle(tgt_name_mangled ${tgt})
add_library("vtkm::${tgt_name_mangled}" INTERFACE IMPORTED)
target_link_libraries("vtkm::${tgt_name_mangled}" INTERFACE ${tgt})
endif()
endforeach()
#add the directory that contains the VTK-m config file to the cmake
#path so that our examples can find VTK-m
set(CMAKE_PREFIX_PATH ${VTKm_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR})
add_subdirectory(clipping)
add_subdirectory(contour_tree)

@ -13,7 +13,7 @@ project(Clipping CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_filter_contour AND TARGET vtkm_io)
if(TARGET vtkm::filter_contour AND TARGET vtkm::io)
add_executable(Clipping Clipping.cxx)
target_link_libraries(Clipping PRIVATE vtkm_filter_contour vtkm_io)
target_link_libraries(Clipping PRIVATE vtkm::filter_contour vtkm::io)
endif()

@ -13,10 +13,10 @@ project(ContourTree CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if (TARGET vtkm_filter_scalar_topology)
if (TARGET vtkm::filter_scalar_topology)
add_executable(ContourTreeMesh2D ContourTreeMesh2D.cxx)
target_link_libraries(ContourTreeMesh2D vtkm_filter_core vtkm_filter_scalar_topology)
target_link_libraries(ContourTreeMesh2D vtkm::filter_core vtkm::filter_scalar_topology)
add_executable(ContourTreeMesh3D ContourTreeMesh3D.cxx)
target_link_libraries(ContourTreeMesh3D vtkm_filter_core vtkm_filter_scalar_topology)
target_link_libraries(ContourTreeMesh3D vtkm::filter_core vtkm::filter_scalar_topology)
endif()

@ -55,7 +55,7 @@ cmake_minimum_required(VERSION 3.12...3.15 FATAL_ERROR)
# Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(NOT TARGET vtkm_io OR NOT TARGET vtkm_filter_scalar_topology)
if(NOT TARGET vtkm::io OR NOT TARGET vtkm::filter_scalar_topology)
# Libraries needed are not built.
return()
endif()
@ -64,7 +64,7 @@ endif()
# Serial
####################################
add_executable(ContourTree_Augmented ContourTreeApp.cxx)
target_link_libraries(ContourTree_Augmented vtkm_filter_scalar_topology vtkm_io)
target_link_libraries(ContourTree_Augmented vtkm::filter_scalar_topology vtkm::io)
vtkm_add_target_information(ContourTree_Augmented
DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS
DEVICE_SOURCES ContourTreeApp.cxx)
@ -84,7 +84,7 @@ endif()
####################################
if (VTKm_ENABLE_MPI)
add_executable(ContourTree_Augmented_MPI ContourTreeApp.cxx)
target_link_libraries(ContourTree_Augmented_MPI vtkm_filter_scalar_topology vtkm_io MPI::MPI_CXX)
target_link_libraries(ContourTree_Augmented_MPI vtkm::filter_scalar_topology vtkm::io MPI::MPI_CXX)
vtkm_add_target_information(ContourTree_Augmented_MPI
MODIFY_CUDA_FLAGS
DEVICE_SOURCES ContourTreeApp.cxx)

@ -58,9 +58,9 @@ find_package(VTKm REQUIRED QUIET)
####################################
# MPI
####################################
if (VTKm_ENABLE_MPI AND TARGET vtkm_filter_scalar_topology AND TARGET vtkm_io)
if (VTKm_ENABLE_MPI AND TARGET vtkm::filter_scalar_topology AND TARGET vtkm::io)
add_executable(ContourTree_Distributed ContourTreeApp.cxx)
target_link_libraries(ContourTree_Distributed vtkm_filter_scalar_topology vtkm_io MPI::MPI_CXX)
target_link_libraries(ContourTree_Distributed vtkm::filter_scalar_topology vtkm::io MPI::MPI_CXX)
vtkm_add_target_information(ContourTree_Distributed
MODIFY_CUDA_FLAGS
DEVICE_SOURCES ContourTreeApp.cxx)
@ -78,11 +78,11 @@ if (VTKm_ENABLE_MPI AND TARGET vtkm_filter_scalar_topology AND TARGET vtkm_io)
endif()
add_executable(TreeCompiler TreeCompilerApp.cxx)
target_link_libraries(TreeCompiler vtkm_filter_core)
target_link_libraries(TreeCompiler vtkm::filter_core)
vtkm_add_target_information(TreeCompiler DROP_UNUSED_SYMBOLS)
add_executable(BranchCompiler BranchCompilerApp.cxx)
target_link_libraries(BranchCompiler vtkm_filter)
target_link_libraries(BranchCompiler vtkm::filter)
vtkm_add_target_information(BranchCompiler DROP_UNUSED_SYMBOLS)
configure_file(split_data_2d.py split_data_2d.py COPYONLY)

@ -15,8 +15,8 @@ find_package(VTKm REQUIRED QUIET)
add_executable(CosmoCenterFinder CosmoCenterFinder.cxx)
add_executable(CosmoHaloFinder CosmoHaloFinder.cxx)
target_link_libraries(CosmoCenterFinder PRIVATE vtkm_filter_core)
target_link_libraries(CosmoHaloFinder PRIVATE vtkm_filter_core)
target_link_libraries(CosmoCenterFinder PRIVATE vtkm::filter_core)
target_link_libraries(CosmoHaloFinder PRIVATE vtkm::filter_core)
vtkm_add_target_information(CosmoCenterFinder CosmoHaloFinder
DROP_UNUSED_SYMBOLS

@ -13,7 +13,7 @@ project(VTKmDemo CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_rendering AND TARGET vtkm_filter_contour AND TARGET vtkm_source)
if(TARGET vtkm::rendering AND TARGET vtkm::filter_contour AND TARGET vtkm::source)
add_executable(Demo Demo.cxx)
target_link_libraries(Demo PRIVATE vtkm_rendering vtkm_filter_contour vtkm_source)
target_link_libraries(Demo PRIVATE vtkm::rendering vtkm::filter_contour vtkm::source)
endif()

@ -19,7 +19,7 @@ if(TARGET OpenGL::GL AND
TARGET GLEW::GLEW)
add_executable(GameOfLife GameOfLife.cxx LoadShaders.h)
target_link_libraries(GameOfLife PRIVATE vtkm_filter OpenGL::GL GLEW::GLEW GLUT::GLUT)
target_link_libraries(GameOfLife PRIVATE vtkm::filter_core OpenGL::GL GLEW::GLEW GLUT::GLUT)
vtkm_add_target_information(GameOfLife
DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS
DEVICE_SOURCES GameOfLife.cxx)

@ -13,9 +13,9 @@ project(HelloWorklet CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_io)
if(TARGET vtkm::io)
add_executable(HelloWorklet HelloWorklet.cxx)
target_link_libraries(HelloWorklet PRIVATE vtkm_filter_core vtkm_io)
target_link_libraries(HelloWorklet PRIVATE vtkm::filter_core vtkm::io)
vtkm_add_target_information(HelloWorklet
DROP_UNUSED_SYMBOLS

@ -12,12 +12,12 @@ project(Histogram CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if (VTKm_ENABLE_MPI AND vtkm_filter_density_estimate)
if (VTKm_ENABLE_MPI AND vtkm::filter_density_estimate)
# TODO: this example desperately needs to be updated. The histogram filter has
# improved immensely since this has originally been written, and the code can
# be simplified a lot, which will make it more illustrative of using VTK-m.
add_executable(Histogram Histogram.cxx HistogramMPI.h HistogramMPI.cxx)
target_link_libraries(Histogram PRIVATE vtkm_filter_density_estimate MPI::MPI_CXX)
target_link_libraries(Histogram PRIVATE vtkm::filter_density_estimate MPI::MPI_CXX)
vtkm_add_target_information(Histogram
DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS
DEVICE_SOURCES HistogramMPI.cxx)

@ -13,9 +13,9 @@ project(IsingModel CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_rendering)
if(TARGET vtkm::rendering)
add_executable(Ising Ising.cxx)
target_link_libraries(Ising PRIVATE vtkm_worklet vtkm_rendering)
target_link_libraries(Ising PRIVATE vtkm::worklet vtkm::rendering)
vtkm_add_target_information(Ising
DROP_UNUSED_SYMBOLS

@ -12,7 +12,7 @@ cmake_minimum_required(VERSION 3.12...3.15 FATAL_ERROR)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_filter_flow)
if(TARGET vtkm::filter_flow)
add_executable(Lagrangian lagrangian.cxx ABCfield.h)
target_link_libraries(Lagrangian PRIVATE vtkm_filter_flow)
target_link_libraries(Lagrangian PRIVATE vtkm::filter_flow)
endif()

@ -16,7 +16,7 @@ project(ParticleAdvection CXX)
find_package(VTKm REQUIRED QUIET)
add_executable(ftle LagrangianStructures.cxx)
target_link_libraries(ftle PRIVATE vtkm_cont vtkm_worklet)
target_link_libraries(ftle PRIVATE vtkm::cont vtkm::worklet)
vtkm_add_target_information(ftle
DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS
DEVICE_SOURCES LagrangianStructures.cxx)

@ -12,9 +12,9 @@ project(LogisticMap CXX)
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_io)
if(TARGET vtkm::io)
add_executable(LogisticMap LogisticMap.cxx)
target_link_libraries(LogisticMap PRIVATE vtkm_io)
target_link_libraries(LogisticMap PRIVATE vtkm::io)
vtkm_add_target_information(LogisticMap
DROP_UNUSED_SYMBOLS

@ -25,7 +25,7 @@ project(MeshQuality CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_filter_mesh_info AND TARGET vtkm_io)
if(TARGET vtkm::filter_mesh_info AND TARGET vtkm::io)
add_executable(MeshQuality MeshQuality.cxx)
target_link_libraries(MeshQuality PRIVATE vtkm_filter_mesh_info vtkm_io)
target_link_libraries(MeshQuality PRIVATE vtkm::filter_mesh_info vtkm::io)
endif()

@ -26,9 +26,9 @@ set(srcs
IOGenerator.cxx
)
if(TARGET vtkm_filter_vector_analysis)
if(TARGET vtkm::filter_vector_analysis)
add_executable(MultiBackend ${srcs} ${headers})
target_link_libraries(MultiBackend PRIVATE vtkm_filter_vector_analysis Threads::Threads)
target_link_libraries(MultiBackend PRIVATE vtkm::filter_vector_analysis Threads::Threads)
vtkm_add_target_information(MultiBackend
DROP_UNUSED_SYMBOLS
MODIFY_CUDA_FLAGS

@ -13,7 +13,7 @@ project(Oscillator CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_source)
if(TARGET vtkm::source)
add_executable(Oscillator Oscillator.cxx)
target_link_libraries(Oscillator PRIVATE vtkm_source)
target_link_libraries(Oscillator PRIVATE vtkm::source)
endif()

@ -13,7 +13,7 @@ project(ParticleAdvection CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_filter_flow AND TARGET vtkm_io)
if(TARGET vtkm::filter_flow AND TARGET vtkm::io)
add_executable(Particle_Advection ParticleAdvection.cxx)
target_link_libraries(Particle_Advection PRIVATE vtkm_filter_flow vtkm_io)
target_link_libraries(Particle_Advection PRIVATE vtkm::filter_flow vtkm::io)
endif()

@ -12,13 +12,13 @@ project(PolyLineArchimedeanHelix CXX)
find_package(VTKm REQUIRED QUIET)
if (TARGET vtkm_rendering)
if (TARGET vtkm::rendering)
# TODO: This example should be changed from using the Tube worklet to using
# the Tube filter (in the vtkm_filter_geometry_refinement library). Then
# the Tube filter (in the vtkm::filter_geometry_refinement library). Then
# compiling it would no longer require a device compiler and the example
# would generally be simpler.
add_executable(PolyLineArchimedeanHelix PolyLineArchimedeanHelix.cxx)
target_link_libraries(PolyLineArchimedeanHelix PRIVATE vtkm_rendering)
target_link_libraries(PolyLineArchimedeanHelix PRIVATE vtkm::rendering)
vtkm_add_target_information(PolyLineArchimedeanHelix
DROP_UNUSED_SYMBOLS
MODIFY_CUDA_FLAGS

@ -13,9 +13,9 @@ project(RedistributePoints CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_io AND TARGET vtkm_filter_entity_extraction)
if(TARGET vtkm::io AND TARGET vtkm::filter_entity_extraction)
add_executable(RedistributePoints RedistributePoints.cxx RedistributePoints.h main.cxx)
target_link_libraries(RedistributePoints PRIVATE vtkm_io vtkm_filter_entity_extraction)
target_link_libraries(RedistributePoints PRIVATE vtkm::io vtkm::filter_entity_extraction)
vtkm_add_target_information(RedistributePoints
DROP_UNUSED_SYMBOLS
MODIFY_CUDA_FLAGS

@ -14,9 +14,9 @@ include(CTest)
find_package(VTKm REQUIRED)
if(TARGET vtkm_source)
if(TARGET vtkm::source)
add_executable(smoke_test smoke_test.cxx)
target_link_libraries(smoke_test PRIVATE vtkm_source)
target_link_libraries(smoke_test PRIVATE vtkm::source)
# Only add this test when this a standalone project
if (PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)

@ -13,8 +13,8 @@ project(StreamlineMPI CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if (VTKm_ENABLE_MPI AND TARGET vtkm_io AND TARGET vtkm_filter_flow)
if (VTKm_ENABLE_MPI AND TARGET vtkm::io AND TARGET vtkm::filter_flow)
add_executable(StreamlineMPI StreamlineMPI.cxx)
target_compile_definitions(StreamlineMPI PRIVATE "MPI_ENABLED")
target_link_libraries(StreamlineMPI PRIVATE vtkm_filter_flow vtkm_io MPI::MPI_CXX)
target_link_libraries(StreamlineMPI PRIVATE vtkm::filter_flow vtkm::io MPI::MPI_CXX)
endif()

@ -15,10 +15,10 @@ project(TemporalAdvection CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_filter_flow AND TARGET vtkm_io)
if(TARGET vtkm::filter_flow AND TARGET vtkm::io)
add_executable(Temporal_Advection TemporalAdvection.cxx)
vtkm_add_target_information(Temporal_Advection
DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS
DEVICE_SOURCES TemporalAdvection.cxx)
target_link_libraries(Temporal_Advection PRIVATE vtkm_filter_flow vtkm_io)
target_link_libraries(Temporal_Advection PRIVATE vtkm::filter_flow vtkm::io)
endif()

@ -13,10 +13,10 @@ project(Tetrahedra CXX)
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET)
if(TARGET vtkm_filter_geometry_refinement AND TARGET vtkm_io)
if(TARGET vtkm::filter_geometry_refinement AND TARGET vtkm::io)
add_executable(Tetrahedralize Tetrahedralize.cxx)
target_link_libraries(Tetrahedralize PRIVATE vtkm_filter_geometry_refinement vtkm_io)
target_link_libraries(Tetrahedralize PRIVATE vtkm::filter_geometry_refinement vtkm::io)
add_executable(Triangulate Triangulate.cxx)
target_link_libraries(Triangulate PRIVATE vtkm_filter_geometry_refinement vtkm_io)
target_link_libraries(Triangulate PRIVATE vtkm::filter_geometry_refinement vtkm::io)
endif()

@ -271,14 +271,14 @@ add_subdirectory(internal)
add_subdirectory(arg)
set(backends )
if(TARGET vtkm::tbb)
list(APPEND backends vtkm::tbb)
if(TARGET vtkm_tbb)
list(APPEND backends vtkm_tbb)
endif()
if(TARGET vtkm::cuda)
list(APPEND backends vtkm::cuda)
if(TARGET vtkm_cuda)
list(APPEND backends vtkm_cuda)
endif()
if(TARGET vtkm::openmp)
list(APPEND backends vtkm::openmp)
if(TARGET vtkm_openmp)
list(APPEND backends vtkm_openmp)
endif()
if(TARGET vtkm::kokkos)
list(APPEND backends vtkm::kokkos)

@ -24,7 +24,7 @@ set(headers
vtkm_declare_headers(${headers})
if (TARGET vtkm::cuda)
if (TARGET vtkm_cuda)
target_sources(vtkm_cont PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CudaAllocator.cu
${CMAKE_CURRENT_SOURCE_DIR}/DeviceAdapterAlgorithmCuda.cu

@ -6,4 +6,4 @@ DEPENDS
vtkm_cont
TEST_DEPENDS
vtkm_worklet
vtkm::cuda
vtkm_cuda

@ -29,7 +29,7 @@ target_sources(vtkm_cont PRIVATE
)
#-----------------------------------------------------------------------------
if (TARGET vtkm::openmp)
if (TARGET vtkm_openmp)
target_sources(vtkm_cont PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/DeviceAdapterAlgorithmOpenMP.cxx
${CMAKE_CURRENT_SOURCE_DIR}/ParallelRadixSortOpenMP.cxx

@ -6,4 +6,4 @@ DEPENDS
vtkm_cont
TEST_DEPENDS
vtkm_worklet
vtkm::openmp
vtkm_openmp

@ -28,7 +28,7 @@ target_sources(vtkm_cont PRIVATE
)
#-----------------------------------------------------------------------------
if (TARGET vtkm::tbb)
if (TARGET vtkm_tbb)
target_sources(vtkm_cont PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/DeviceAdapterAlgorithmTBB.cxx
${CMAKE_CURRENT_SOURCE_DIR}/ParallelSortTBB.cxx

@ -6,4 +6,4 @@ DEPENDS
vtkm_cont
TEST_DEPENDS
vtkm_worklet
vtkm::tbb
vtkm_tbb

@ -5,4 +5,4 @@ GROUPS
DEPENDS
vtkm_exec
TEST_DEPENDS
vtkm::cuda
vtkm_cuda

@ -5,4 +5,4 @@ GROUPS
DEPENDS
vtkm_exec
TEST_DEPENDS
vtkm::openmp
vtkm_openmp

@ -5,4 +5,4 @@ GROUPS
DEPENDS
vtkm_exec
TEST_DEPENDS
vtkm::tbb
vtkm_tbb

@ -47,4 +47,4 @@ target_link_libraries(vtkm_filter PUBLIC INTERFACE
vtkm_filter_core
)
install(TARGETS vtkm_filter EXPORT ${VTKm_EXPORT_NAME})
vtkm_install_targets(TARGETS vtkm_filter)

@ -82,6 +82,7 @@ endif()
include(VTKmDIYUtils)
add_library(vtkm_diy INTERFACE)
vtkm_diy_init_target()
target_include_directories(vtkm_diy INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@ -113,7 +114,7 @@ else()
endif()
#-----------------------------------------------------------------------------
install(TARGETS vtkm_diy EXPORT ${VTKm_EXPORT_NAME})
vtkm_install_targets(TARGETS vtkm_diy)
## Install headers
if (NOT VTKm_INSTALL_ONLY_LIBRARIES)

@ -18,8 +18,7 @@ target_include_directories(vtkm_lcl INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vtkmlcl>
$<INSTALL_INTERFACE:${VTKm_INSTALL_INCLUDE_DIR}/vtkm/thirdparty/lcl/vtkmlcl>)
install(TARGETS vtkm_lcl
EXPORT ${VTKm_EXPORT_NAME})
vtkm_install_targets(TARGETS vtkm_lcl)
## Install headers
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)

@ -15,4 +15,4 @@ set_target_properties(vtkm_lodepng PROPERTIES POSITION_INDEPENDENT_CODE ON)
# This will not install anything but it is needed for CMake <= 3.21 since it
# does not fully support $<TARGET_OBJECTS> in target_link_library.
install(TARGETS vtkm_lodepng EXPORT ${VTKm_EXPORT_NAME})
vtkm_install_targets(TARGETS vtkm_lodepng)

@ -20,5 +20,4 @@ target_include_directories(vtkm_loguru INTERFACE
target_link_libraries(vtkm_loguru INTERFACE ${CMAKE_DL_LIBS} Threads::Threads)
install(TARGETS vtkm_loguru
EXPORT ${VTKm_EXPORT_NAME})
vtkm_install_targets(TARGETS vtkm_loguru)

@ -15,8 +15,7 @@ target_include_directories(vtkm_optionparser INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${VTKm_INSTALL_INCLUDE_DIR}/vtkm/thirdparty/optionparser>)
install(TARGETS vtkm_optionparser
EXPORT ${VTKm_EXPORT_NAME})
vtkm_install_targets(TARGETS vtkm_optionparser)
## Install headers
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)

@ -53,7 +53,7 @@ vtkm_unit_tests(
LIBRARIES vtkm_source vtkm_worklet vtkm_filter vtkm_io
USE_VTKM_JOB_POOL
)
if (TARGET vtkm::cuda)
if (TARGET vtkm_cuda)
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND
CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 10.0.0)
set(problematic_cuda_srcs