Merge topic 'install_hooks'

c0a73159 Clean up install/VTK issues in VTKmConfig.cmake.
30f4151b Add missing headers to examples.
a2a55eda Install cuda interop headers.
85062a3a Add version info to installed cmake config files.
75f88b4c Add versioning to VTKM installed include/share dirs.
b3852e8d Add versioning to VTKM libraries.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !958
This commit is contained in:
Allison Vacanti 2017-10-04 14:55:16 +00:00 committed by Kitware Robot
commit 5ec29128de
13 changed files with 95 additions and 49 deletions

@ -50,16 +50,12 @@ if(CMAKE_CURRENT_LIST_DIR STREQUAL "@VTKm_BINARY_DIR@/@VTKm_INSTALL_CONFIG_DIR@"
set(VTKm_PACKAGE_IN_BUILD TRUE)
endif()
# The VTKm include file directories.
set_and_check(VTKm_INCLUDE_DIRS "@PACKAGE_VTKm_INSTALL_INCLUDE_DIR@")
if(VTKm_PACKAGE_IN_BUILD)
set(VTKm_INCLUDE_DIRS ${VTKm_INCLUDE_DIRS} "@VTKm_SOURCE_DIR@")
endif()
if(NOT VTKm_PACKAGE_IN_BUILD)
set_and_check(VTKm_CMAKE_MODULE_PATH "@PACKAGE_VTKm_INSTALL_CMAKE_MODULE_DIR@")
else()
set_and_check(VTKm_CMAKE_MODULE_PATH "@VTKm_SOURCE_DIR@/CMake")
set_and_check(VTKm_INCLUDE_DIRS ${VTKm_INCLUDE_DIRS} "@VTKm_SOURCE_DIR@")
else()
set_and_check(VTKm_CMAKE_MODULE_PATH "@PACKAGE_VTKm_INSTALL_CMAKE_MODULE_DIR@")
set_and_check(VTKm_INCLUDE_DIRS "@PACKAGE_VTKm_INSTALL_INCLUDE_DIR@")
endif()
set(VTKm_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
@ -70,7 +66,7 @@ set(VTKm_ENABLE_RENDERING "@VTKm_ENABLE_RENDERING@")
# Load the library exports, but only if not compiling VTK-m itself
set_and_check(VTKm_CONFIG_DIR "@PACKAGE_VTKm_INSTALL_CONFIG_DIR@")
if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "@VTKm_BINARY_DIR@")
if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "@CMAKE_BINARY_DIR@")
include(${VTKm_CONFIG_DIR}/VTKmTargets.cmake)
endif()

@ -98,6 +98,37 @@ function(vtkm_setup_msvc_properties target )
endfunction(vtkm_setup_msvc_properties)
# vtkm_target_name(<name>)
#
# This macro does some basic checking for library naming, and also adds a suffix
# to the output name with the VTKm version by default. Setting the variable
# VTKm_CUSTOM_LIBRARY_SUFFIX will override the suffix.
function(vtkm_target_name _name)
get_property(_type TARGET ${_name} PROPERTY TYPE)
if(NOT "${_type}" STREQUAL EXECUTABLE)
set_property(TARGET ${_name} PROPERTY VERSION 1)
set_property(TARGET ${_name} PROPERTY SOVERSION 1)
endif()
if("${_name}" MATCHES "^[Vv][Tt][Kk][Mm]")
set(_vtkm "")
else()
set(_vtkm "vtkm")
#message(AUTHOR_WARNING "Target [${_name}] does not start in 'vtkm'.")
endif()
# Support custom library suffix names, for other projects wanting to inject
# their own version numbers etc.
if(DEFINED VTKm_CUSTOM_LIBRARY_SUFFIX)
set(_lib_suffix "${VTKm_CUSTOM_LIBRARY_SUFFIX}")
else()
set(_lib_suffix "-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}")
endif()
set_property(TARGET ${_name} PROPERTY OUTPUT_NAME ${_vtk}${_name}${_lib_suffix})
endfunction()
function(vtkm_target _name)
vtkm_target_name(${_name})
endfunction()
# Builds a source file and an executable that does nothing other than
# compile the given header files.
function(vtkm_add_header_build_test name dir_prefix use_cuda)
@ -138,7 +169,7 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda)
endforeach()
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_DIR}/include
${VTKm_BINARY_INCLUDE_DIR}
)
cuda_add_library(TestBuild_${name} STATIC ${cxxfiles} ${hfiles})
@ -300,7 +331,7 @@ function(vtkm_unit_tests)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_DIR}/include
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_INCLUDE_DIRS}
)
@ -439,7 +470,7 @@ function(vtkm_worklet_unit_tests device_adapter)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_DIR}/include
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_INCLUDE_DIRS}
)
@ -574,7 +605,7 @@ function(vtkm_benchmarks device_adapter)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_DIR}/include
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_BACKEND_INCLUDE_DIRS}
)
@ -694,7 +725,7 @@ function(vtkm_library)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_DIR}/include
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_BACKEND_INCLUDE_DIRS}
)
@ -711,6 +742,8 @@ function(vtkm_library)
add_library(${lib_name} ${VTKm_LIB_SOURCES})
endif()
vtkm_target(${lib_name})
target_link_libraries(${lib_name} PUBLIC vtkm)
target_link_libraries(${lib_name} PRIVATE
${VTKm_BACKEND_LIBRARIES}
@ -761,7 +794,7 @@ function(vtkm_library)
configure_file(
${VTKm_SOURCE_DIR}/CMake/VTKmExportHeaderTemplate.h.in
${VTKm_BINARY_DIR}/include/${dir_prefix}/${lib_name}_export.h
${VTKm_BINARY_INCLUDE_DIR}/${dir_prefix}/${lib_name}_export.h
@ONLY)
unset(EXPORT_MACRO_NAME)
@ -775,7 +808,7 @@ function(vtkm_library)
RUNTIME DESTINATION ${VTKm_INSTALL_BIN_DIR}
)
vtkm_install_headers("${dir_prefix}"
${VTKm_BINARY_DIR}/include/${dir_prefix}/${lib_name}_export.h
${VTKm_BINARY_INCLUDE_DIR}/${dir_prefix}/${lib_name}_export.h
${VTKm_LIB_HEADERS}
)
endfunction(vtkm_library)

@ -27,30 +27,10 @@ cmake_minimum_required(VERSION 3.3)
project (VTKm)
if (NOT DEFINED VTKm_INSTALL_INCLUDE_DIR)
set(VTKm_INSTALL_INCLUDE_DIR "include")
endif()
if (NOT DEFINED VTKm_INSTALL_CONFIG_DIR)
set(VTKm_INSTALL_CONFIG_DIR "lib")
endif()
if (NOT DEFINED VTKm_INSTALL_LIB_DIR)
set(VTKm_INSTALL_LIB_DIR "lib")
endif()
if (NOT DEFINED VTKm_INSTALL_BIN_DIR)
set(VTKm_INSTALL_BIN_DIR "bin")
endif()
if (NOT DEFINED VTKm_INSTALL_CMAKE_MODULE_DIR)
set(VTKm_INSTALL_CMAKE_MODULE_DIR "share/vtkm/cmake")
endif()
set(VTKm_EXPORT_NAME "VTKmTargets")
# Update module path
set(VTKm_CMAKE_MODULE_PATH ${VTKm_SOURCE_DIR}/CMake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
# Setup default build types
include(VTKmBuildType)
# Determine VTK-m version
include(Utilities/Git/Git.cmake)
include(VTKmDetermineVersion)
@ -61,6 +41,29 @@ extract_version_components("${version_txt}" "VTKm")
# Get the version from git if we can
determine_version(${VTKm_SOURCE_DIR} ${GIT_EXECUTABLE} "VTKm")
if (NOT DEFINED VTKm_INSTALL_INCLUDE_DIR)
set(VTKm_INSTALL_INCLUDE_DIR "include/vtkm-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}")
endif()
if (NOT DEFINED VTKm_INSTALL_CONFIG_DIR)
set(VTKm_INSTALL_CONFIG_DIR "lib/cmake/vtkm-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}")
endif()
if (NOT DEFINED VTKm_INSTALL_LIB_DIR)
set(VTKm_INSTALL_LIB_DIR "lib")
endif()
if (NOT DEFINED VTKm_INSTALL_BIN_DIR)
set(VTKm_INSTALL_BIN_DIR "bin")
endif()
if (NOT DEFINED VTKm_INSTALL_CMAKE_MODULE_DIR)
set(VTKm_INSTALL_CMAKE_MODULE_DIR "share/vtkm-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}/cmake")
endif()
set(VTKm_BINARY_INCLUDE_DIR "${VTKm_BINARY_DIR}/include/vtkm-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}")
set(VTKm_EXPORT_NAME "VTKmTargets")
# Setup default build types
include(VTKmBuildType)
# include some vtkm-specific cmake code.
include(VTKmMacros)
@ -75,7 +78,7 @@ add_library(vtkm INTERFACE)
target_compile_features(vtkm INTERFACE cxx_auto_type)
target_include_directories(vtkm INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include/vtkm-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}>
$<INSTALL_INTERFACE:include>
)
install(TARGETS vtkm EXPORT ${VTKm_EXPORT_NAME})
@ -324,10 +327,10 @@ install(
# Create and install exports for external projects
export(EXPORT ${VTKm_EXPORT_NAME}
FILE ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
FILE ${VTKm_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
)
install(EXPORT ${VTKm_EXPORT_NAME}
DESTINATION ${VTKm_INSTALL_LIB_DIR}
DESTINATION ${VTKm_INSTALL_CONFIG_DIR}
FILE VTKmTargets.cmake
)

@ -18,6 +18,9 @@
// this software.
//============================================================================
// Must be included before any other GL includes:
#include <GL/glew.h>
#include <algorithm>
#include <iostream>
#include <random>

@ -24,6 +24,9 @@
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
#endif
// Must be included before any other GL includes:
#include <GL/glew.h>
#include <iostream>
#include <vtkm/Math.h>

@ -35,6 +35,10 @@
#include <chrono>
#include <vector>
#ifdef __BUILDING_TBB_VERSION__
#include <tbb/task_scheduler_init.h>
#endif
const vtkm::Id SPARSE = 0;
const vtkm::Id DENSE = 1;
const vtkm::Id MEDIUM = 2;

@ -21,10 +21,10 @@
# Configure version file. (Other configuration in internal/Configure.h)
vtkm_get_kit_name(kit_name kit_dir)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in
${VTKm_BINARY_DIR}/include/${kit_dir}/Version.h
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Version.h
@ONLY)
vtkm_install_headers(
vtkm ${VTKm_BINARY_DIR}/include/${kit_dir}/Version.h)
vtkm ${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Version.h)
set(headers
Assert.h

@ -45,7 +45,7 @@ if (VTKm_ENABLE_CUDA)
#todo we need to add a custom target and feed that as a dependency
#for vtkm_cont
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_DIR}/include
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_BACKEND_INCLUDE_DIRS}
)

@ -43,5 +43,5 @@ endif()
target_include_directories(vtkm_cont_serial PRIVATE
${VTKm_BACKEND_INCLUDE_DIRS}
${VTKm_SOURCE_DIR}
${VTKm_BINARY_DIR}/include
${VTKm_BINARY_INCLUDE_DIR}
)

@ -57,6 +57,6 @@ endif()
target_include_directories(vtkm_cont_tbb PRIVATE
"${VTKm_SOURCE_DIR}"
"${VTKm_BINARY_DIR}/include"
"${VTKm_BINARY_INCLUDE_DIR}"
${VTKm_BACKEND_INCLUDE_DIRS}
)

@ -31,10 +31,10 @@ set(VTKM_ENABLE_TBB ${VTKm_ENABLE_TBB})
vtkm_get_kit_name(kit_name kit_dir)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Configure.h.in
${VTKm_BINARY_DIR}/include/${kit_dir}/Configure.h
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Configure.h
@ONLY)
vtkm_install_headers(
vtkm/internal ${VTKm_BINARY_DIR}/include/${kit_dir}/Configure.h)
vtkm/internal ${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Configure.h)
unset(VTKM_ENABLE_TBB)
unset(VTKM_ENABLE_CUDA)

@ -31,6 +31,10 @@ endif()
#-----------------------------------------------------------------------------
add_subdirectory(internal)
if(VTKm_CUDA_FOUND)
add_subdirectory(cuda)
endif()
#-----------------------------------------------------------------------------
vtkm_declare_headers(${headers} TESTABLE FALSE)

@ -25,5 +25,5 @@ set(headers
vtkm_disable_troublesome_thrust_warnings()
#-----------------------------------------------------------------------------
vtkm_declare_headers(CUDA ${headers})
# Disable test builds because we'd need to link OpenGL libraries.
vtkm_declare_headers(CUDA ${headers} TESTABLE FALSE)