Merge branch 'cmake-package-update' into 'master'

Update the CMake package

These commits update how the CMake configuration sets up the
find_package information (accessed in VTKmConfig.cmake). It 
establishes a bunch of components that can be used in the
find_package command to load various aspects like CUDA and
TBB.

See merge request !460
This commit is contained in:
Kenneth Moreland 2016-06-22 17:04:49 -04:00
commit 1f5a74fb30
29 changed files with 593 additions and 568 deletions

@ -45,24 +45,26 @@ if( THRUST_INCLUDE_DIR )
endif( THRUST_INCLUDE_DIR )
# Find thrust version
file( STRINGS ${THRUST_INCLUDE_DIR}/thrust/version.h
version
REGEX "#define THRUST_VERSION[ \t]+([0-9x]+)"
)
string( REGEX REPLACE
"#define THRUST_VERSION[ \t]+"
""
version
"${version}"
)
if (THRUST_INCLUDE_DIR)
file( STRINGS ${THRUST_INCLUDE_DIR}/thrust/version.h
version
REGEX "#define THRUST_VERSION[ \t]+([0-9x]+)"
)
string( REGEX REPLACE
"#define THRUST_VERSION[ \t]+"
""
version
"${version}"
)
string( REGEX MATCH "^[0-9]" major ${version} )
string( REGEX REPLACE "^${major}00" "" version "${version}" )
string( REGEX MATCH "^[0-9]" minor ${version} )
string( REGEX REPLACE "^${minor}0" "" version "${version}" )
set( THRUST_VERSION "${major}.${minor}.${version}")
set( THRUST_MAJOR_VERSION "${major}")
set( THRUST_MINOR_VERSION "${minor}")
string( REGEX MATCH "^[0-9]" major ${version} )
string( REGEX REPLACE "^${major}00" "" version "${version}" )
string( REGEX MATCH "^[0-9]" minor ${version} )
string( REGEX REPLACE "^${minor}0" "" version "${version}" )
set( THRUST_VERSION "${major}.${minor}.${version}")
set( THRUST_MAJOR_VERSION "${major}")
set( THRUST_MINOR_VERSION "${minor}")
endif()
# Check for required components
include( FindPackageHandleStandardArgs )
@ -72,4 +74,4 @@ find_package_handle_standard_args( Thrust
)
set(THRUST_INCLUDE_DIRS ${THRUST_INCLUDE_DIR})
mark_as_advanced(THRUST_INCLUDE_DIR)
mark_as_advanced(THRUST_INCLUDE_DIR)

@ -1,48 +0,0 @@
##============================================================================
## 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.
##
## Copyright 2015 Sandia Corporation.
## Copyright 2015 UT-Battelle, LLC.
## Copyright 2015 Los Alamos National Security.
##
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
# This is the base configuration for using the VTK-m library. All other
# device configurations rely on this.
if (VTKm_Base_initialize_complete)
return()
endif (VTKm_Base_initialize_complete)
# Find the Boost library.
if(NOT Boost_FOUND)
find_package(BoostHeaders ${VTKm_REQUIRED_BOOST_VERSION})
endif()
if (NOT Boost_FOUND)
message(STATUS "Boost not found")
set(VTKm_Base_FOUND)
else()
set(VTKm_Base_FOUND TRUE)
endif ()
# Set up all these dependent packages (if they were all found).
if (VTKm_Base_FOUND)
set(VTKm_INCLUDE_DIRS
${VTKm_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
set(VTKm_Base_initialize_complete TRUE)
endif (VTKm_Base_FOUND)

@ -1,158 +0,0 @@
##============================================================================
## 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.
##
## Copyright 2014 Sandia Corporation.
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
if (VTKm_CUDA_initialize_complete)
return()
endif (VTKm_CUDA_initialize_complete)
vtkm_configure_device(Base)
if (VTKm_Base_FOUND)
set(VTKm_CUDA_FOUND ${VTKm_ENABLE_CUDA})
if (NOT VTKm_CUDA_FOUND)
message(STATUS "This build of VTK-m does not include CUDA.")
endif ()
#---------------------------------------------------------------------------
# Find CUDA library.
#---------------------------------------------------------------------------
if (VTKm_CUDA_FOUND)
find_package(CUDA)
mark_as_advanced(CUDA_BUILD_CUBIN
CUDA_BUILD_EMULATION
CUDA_HOST_COMPILER
CUDA_SDK_ROOT_DIR
CUDA_SEPARABLE_COMPILATION
CUDA_TOOLKIT_ROOT_DIR
CUDA_VERBOSE_BUILD
)
if (NOT CUDA_FOUND)
message(STATUS "CUDA not found")
set(VTKm_CUDA_FOUND)
endif ()
endif ()
if(VTKm_CUDA_FOUND)
#---------------------------------------------------------------------------
# Setup build flags for CUDA
#---------------------------------------------------------------------------
# Populates CUDA_NVCC_FLAGS with the best set of flags to compile for a
# given GPU architecture. The majority of developers should leave the
# option at the default of 'native' which uses system introspection to
# determine the smallest numerous of virtual and real architectures it
# should target.
#
# The option of 'all' is provided for people generating libraries that
# will deployed to any number of machines, it will compile all CUDA code
# for all major virtual architectures, guaranteeing that the code will run
# anywhere.
#
#
# 1 - native
# - Uses system introspection to determine compile flags
# 2 - fermi
# - Uses: --generate-code arch=compute_20,code=compute_20
# 3 - kepler
# - Uses: --generate-code arch=compute_30,code=compute_30
# - Uses: --generate-code arch=compute_35,code=compute_35
# 4 - maxwell
# - Uses: --generate-code arch=compute_50,code=compute_50
# - Uses: --generate-code arch=compute_52,code=compute_52
# 5 - all
# - Uses: --generate-code arch=compute_20,code=compute_20
# - Uses: --generate-code arch=compute_30,code=compute_30
# - Uses: --generate-code arch=compute_35,code=compute_35
# - Uses: --generate-code arch=compute_50,code=compute_50
#
#specify the property
set(VTKm_CUDA_Architecture "native" CACHE STRING "Which GPU Architecture(s) to compile for")
set_property(CACHE VTKm_CUDA_Architecture PROPERTY STRINGS native fermi kepler maxwell all)
#detect what the propery is set too
if(VTKm_CUDA_Architecture STREQUAL "native")
#run execute_process to do auto_detection
set(command ${CUDA_NVCC_EXECUTABLE})
set(args "-ccbin" "${CMAKE_CXX_COMPILER}" "--run" "${CMAKE_CURRENT_LIST_DIR}/VTKmDetectCUDAVersion.cxx")
execute_process(COMMAND ${command} ${args}
RESULT_VARIABLE ran_properly
OUTPUT_VARIABLE run_output
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if(ran_properly EQUAL 0)
#find the position of the "--generate-code" output. With some compilers such as
#msvc we get compile output plus run output. So we need to strip out just the
#run output
string(FIND "${run_output}" "--generate-code" position)
string(SUBSTRING "${run_output}" ${position} -1 run_output)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} ${run_output}")
else()
message(STATUS "Unable to run \"${CUDA_NVCC_EXECUTABLE}\" to autodetect GPU architecture."
"Falling back to fermi, please manually specify if you want something else.")
set(VTKm_CUDA_Architecture "fermi")
endif()
endif()
#since when we are native we can fail, and fall back to "fermi" these have
#to happen after, and separately of the native check
if(VTKm_CUDA_Architecture STREQUAL "fermi")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_20,code=compute_20")
elseif(VTKm_CUDA_Architecture STREQUAL "kepler")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_30,code=compute_30")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_35,code=compute_35")
elseif(VTKm_CUDA_Architecture STREQUAL "maxwell")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_50,code=compute_50")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_52,code=compute_52")
elseif(VTKm_CUDA_Architecture STREQUAL "all")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_20,code=compute_20")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_30,code=compute_30")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_35,code=compute_35")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_50,code=compute_50")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_52,code=compute_52")
endif()
endif()
#---------------------------------------------------------------------------
# Find Thrust library.
#---------------------------------------------------------------------------
if (VTKm_CUDA_FOUND)
find_package(Thrust)
if (NOT THRUST_FOUND)
message(STATUS "Thrust not found")
set(VTKm_CUDA_FOUND)
endif ()
endif ()
endif () # VTKm_Base_FOUND
#-----------------------------------------------------------------------------
# Set up all these dependent packages (if they were all found).
#-----------------------------------------------------------------------------
if (VTKm_CUDA_FOUND)
set(VTKm_INCLUDE_DIRS
${VTKm_INCLUDE_DIRS}
${THRUST_INCLUDE_DIRS}
)
set(VTKm_CUDA_initialize_complete TRUE)
endif (VTKm_CUDA_FOUND)

@ -1,41 +0,0 @@
##============================================================================
## 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.
##
## Copyright 2014 Sandia Corporation.
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
if (VTKm_Serial_initialize_complete)
return()
endif (VTKm_Serial_initialize_complete)
vtkm_configure_device(Base)
if (VTKm_Base_FOUND)
# Serial only relies on base configuration
set(VTKm_Serial_FOUND TRUE)
else () # !VTKm_Base_FOUND
set(VTKm_Serial_FOUND)
endif ()
#-----------------------------------------------------------------------------
# Set up the compiler flag optimizations
#-----------------------------------------------------------------------------
include(VTKmCompilerOptimizations)
if (VTKm_Serial_FOUND)
set(VTKm_Serial_initialize_complete TRUE)
endif ()

@ -1,63 +0,0 @@
##============================================================================
## 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.
##
## Copyright 2014 Sandia Corporation.
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
if (VTKm_TBB_initialize_complete)
return()
endif (VTKm_TBB_initialize_complete)
vtkm_configure_device(Base)
if (VTKm_Base_FOUND)
set(VTKm_TBB_FOUND ${VTKm_ENABLE_TBB})
if (NOT VTKm_TBB_FOUND)
message(STATUS "This build of VTK-m does not include TBB.")
endif ()
#---------------------------------------------------------------------------
# Find TBB.
#---------------------------------------------------------------------------
if (VTKm_TBB_FOUND)
find_package(TBB)
if (NOT TBB_FOUND)
message(STATUS "TBB not found")
set(VTKm_TBB_FOUND)
endif ()
endif()
endif ()
#-----------------------------------------------------------------------------
# Set up the compiler flag optimizations
#-----------------------------------------------------------------------------
include(VTKmCompilerOptimizations)
#-----------------------------------------------------------------------------
# Set up all these dependent packages (if they were all found).
#-----------------------------------------------------------------------------
if (VTKm_TBB_FOUND)
set(VTKm_INCLUDE_DIRS
${VTKm_INCLUDE_DIRS}
${TBB_INCLUDE_DIRS}
)
set(VTKm_LIBRARIES ${TBB_LIBRARIES})
set(VTKm_TBB_initialize_complete TRUE)
endif()

50
CMake/VTKmConfig.cmake.in Normal file → Executable file

@ -24,49 +24,51 @@
# VTKm_INCLUDE_DIRS - Directories containing VTK-m and dependent headers
# VTKm_LIBRARIES - The libraries required when using VTK-m
# This file should be installed in the include directory.
# Find the root directory.
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_install_dir "${_dir}/.." ABSOLUTE)
# The VTKm include file directories.
set(VTKm_INCLUDE_DIRS "@VTKm_INCLUDE_DIRS_CONFIG@")
@PACKAGE_INIT@
# The VTKm version number
set(VTKm_MAJOR_VERSION "@VTKm_MAJOR_VERSION@")
set(VTKm_MINOR_VERSION "@VTKm_MINOR_VERSION@")
set(VTKm_PATCH_VERSION "@VTKm_PATCH_VERSION@")
set(VTKm_VERSION "@VTKm_VERSION@")
# This is true when the package is still in the build directory (not installed)
if(CMAKE_CURRENT_LIST_DIR STREQUAL "@VTKm_BINARY_DIR@/@VTKm_INSTALL_CONFIG_DIR@")
set(VTKm_PACKAGE_IN_BUILD)
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()
set(VTKm_REQUIRED_BOOST_VERSION "@VTKm_REQUIRED_BOOST_VERSION@")
set(VTKm_CMAKE_MODULE_PATH "@VTKm_CMAKE_MODULE_PATH_CONFIG@")
if(NOT VTKm_PACKAGE_IN_BUILD)
set_and_check(VTKm_CMAKE_MODULE_PATH "@PACKAGE_VTKm_INSTALL_CMAKE_MODULE_DIR@")
else()
set(VTKm_CMAKE_MODULE_PATH "@VTKm_SOURCE_DIR@/CMake")
endif()
set(VTKm_ENABLE_CUDA "@VTKm_ENABLE_CUDA@")
set(VTKm_ENABLE_TBB "@VTKm_ENABLE_TBB@")
set(VTKm_ENABLE_OPENGL_INTEROP "@VTKm_ENABLE_OPENGL_INTEROP@")
set(VTKm_BUILD_RENDERING "@VTKm_BUILD_RENDERING@")
# VTKm requires some CMake Find modules not included with CMake, so
# include the CMake modules distributed with VTKm.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
# This includes a host of macros used by VTK-m CMake.
include(VTKmMacros)
if(VTKm_FIND_REQUIRED)
set(vtkm_is_required REQUIRED)
else()
set(vtkm_is_required)
endif()
vtkm_configure_device(Serial ${vtkm_is_required})
if(VTKm_ENABLE_CUDA)
vtkm_configure_device(CUDA)
endif()
if(VTKm_ENABLE_TBB)
# If configured with TBB, the VTK-m header files might choose TBB as the
# default device. In that case, the TBB device is required.
vtkm_configure_device(TBB ${vtkm_is_required})
endif()
# Extra compile options that VTKm has generated, such as vectorization settings.
# This should be specified to any target with the CMake command target_compile_options
# that uses VTK-m.
set(VTKm_COMPILE_OPTIONS "@VTKm_COMPILE_OPTIONS@")
# Load the selected components
@VTKm_LOAD_COMPONENTS_COMMANDS@
check_required_components(VTKm)

@ -1,10 +0,0 @@
set(PACKAGE_VERSION "@VTKm_VERSION@")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" STREQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

@ -0,0 +1,284 @@
##============================================================================
## 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.
##
## Copyright 2016 Sandia Corporation.
## Copyright 2016 UT-Battelle, LLC.
## Copyright 2016 Los Alamos National Security.
##
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
# This file provides all the component-specific configuration. To add a
# component to this list, first add the name of the component to
# VTKm_AVAILABLE_COMPONENTS. Then add a macro (or function) named
# vtkm_configure_component_<name> that configures the given component. At a
# minimum, this macro should set (or clear) the variable VTKm_<name>_FOUND. It
# should also modify other apropos variables such as VTKm_INCLUDE_DIRS and
# VTKm_LIBRARIES.
#
# Components generally rely on other components, and should call
# vtkm_configure_component_<name> for those components as necessary.
#
# Any component configuration added to VTKm_AVAILABLE_COMPONENTS will
# automatically be added to the components available to find_package(VTKm).
#
set(VTKm_AVAILABLE_COMPONENTS
Base
Serial
OpenGL
OSMesa
EGL
Interop
TBB
CUDA
)
#-----------------------------------------------------------------------------
# Support function for making vtkm_configure_component<name> functions.
#-----------------------------------------------------------------------------
macro(vtkm_finish_configure_component component)
if(NOT VTKm_${component}_FOUND)
cmake_parse_arguments(VTKm_FCC
""
""
"DEPENDENT_VARIABLES;ADD_INCLUDES;ADD_LIBRARIES"
${ARGN}
)
set(VTKm_${component}_FOUND TRUE)
foreach(var ${VTKm_FCC_DEPENDENT_VARIABLES})
if(NOT ${var})
message(STATUS "Failed to configure VTK-m component ${component}: !${var}")
set(VTKm_${component}_FOUND)
break()
endif()
endforeach(var)
if (VTKm_${component}_FOUND)
set(VTKm_INCLUDE_DIRS ${VTKm_INCLUDE_DIRS} ${VTKm_FCC_ADD_INCLUDES})
set(VTKm_LIBRARIES ${VTKm_LIBRARIES} ${VTKm_FCC_ADD_LIBRARIES})
endif()
endif()
endmacro()
#-----------------------------------------------------------------------------
# The configuration macros
#-----------------------------------------------------------------------------
macro(vtkm_configure_component_Base)
# Find the Boost library.
if(NOT Boost_FOUND)
find_package(BoostHeaders ${VTKm_REQUIRED_BOOST_VERSION})
endif()
vtkm_finish_configure_component(Base
DEPENDENT_VARIABLES Boost_FOUND
ADD_INCLUDES ${Boost_INCLUDE_DIRS}
)
endmacro()
macro(vtkm_configure_component_Serial)
vtkm_configure_component_Base()
vtkm_finish_configure_component(Serial
DEPENDENT_VARIABLES VTKm_Base_FOUND
)
endmacro(vtkm_configure_component_Serial)
macro(vtkm_configure_component_OpenGL)
vtkm_configure_component_Base()
find_package(OpenGL)
vtkm_finish_configure_component(OpenGL
DEPENDENT_VARIABLES VTKm_Base_FOUND OPENGL_FOUND
ADD_INCLUDES ${OPENGL_INCLUDE_DIR}
ADD_LIBRARIES ${OPENGL_LIBRARIES}
)
endmacro(vtkm_configure_component_OpenGL)
macro(vtkm_configure_component_OSMesa)
vtkm_configure_component_OpenGL()
if (UNIX AND NOT APPLE)
find_package(MESA)
vtkm_finish_configure_component(OSMesa
DEPENDENT_VARIABLES VTKm_OpenGL_FOUND OSMESA_FOUND
ADD_INCLUDES ${OSMESA_INCLUDE_DIR}
ADD_LIBRARIES ${OSMESA_LIBRARY}
)
else()
message(STATUS "OSMesa not supported on this platform.")
endif()
endmacro(vtkm_configure_component_OSMesa)
macro(vtkm_configure_component_EGL)
vtkm_configure_component_OpenGL()
find_package(EGL)
vtkm_finish_configure_component(EGL
DEPENDENT_VARIABLES VTKm_OpenGL_FOUND EGL_FOUND
ADD_INCLUDES ${EGL_INCLUDE_DIR}
ADD_LIBRARIES ${EGL_LIBRARY}
)
endmacro(vtkm_configure_component_EGL)
macro(vtkm_configure_component_Interop)
vtkm_configure_component_OpenGL()
find_package(GLEW)
set(vtkm_interop_dependent_vars
VTKm_OpenGL_FOUND
VTKm_ENABLE_OPENGL_INTEROP
GLEW_FOUND
)
#on unix/linux Glew uses pthreads, so we need to find that, and link to it
#explicitly or else in release mode we get sigsegv on launch
if (VTKm_Interop_FOUND AND UNIX)
find_package(Threads)
set(vtkm_interop_dependent_vars ${vtkm_interop_dependent_vars} CMAKE_USE_PTHREADS_INIT)
endif()
vtkm_finish_configure_component(Interop
DEPENDENT_VARIABLES ${vtkm_interop_dependent_vars}
ADD_INCLUDES ${GLEW_INCLUDE_DIRS}
ADD_LIBRARIES ${GLEW_LIBRARIES}
)
endmacro(vtkm_configure_component_Interop)
macro(vtkm_configure_component_TBB)
if(VTKm_ENABLE_TBB)
vtkm_configure_component_Base()
find_package(TBB)
endif()
vtkm_finish_configure_component(TBB
DEPENDENT_VARIABLES VTKm_ENABLE_TBB VTKm_Base_FOUND TBB_FOUND
ADD_INCLUDES ${TBB_INCLUDE_DIRS}
ADD_LIBRARIES ${TBB_LIBRARIES}
)
endmacro(vtkm_configure_component_TBB)
macro(vtkm_configure_component_CUDA)
if(VTKm_ENABLE_CUDA)
vtkm_configure_component_Base()
find_package(CUDA)
mark_as_advanced(
CUDA_BUILD_CUBIN
CUDA_BUILD_EMULATION
CUDA_HOST_COMPILER
CUDA_SDK_ROOT_DIR
CUDA_SEPARABLE_COMPILATION
CUDA_TOOLKIT_ROOT_DIR
CUDA_VERBOSE_BUILD
)
find_package(Thrust)
endif()
vtkm_finish_configure_component(CUDA
DEPENDENT_VARIABLES
VTKm_ENABLE_CUDA
VTKm_Base_FOUND
CUDA_FOUND
THRUST_FOUND
ADD_INCLUDES ${THRUST_INCLUDE_DIRS}
)
if(VTKm_CUDA_FOUND)
#---------------------------------------------------------------------------
# Setup build flags for CUDA
#---------------------------------------------------------------------------
# Populates CUDA_NVCC_FLAGS with the best set of flags to compile for a
# given GPU architecture. The majority of developers should leave the
# option at the default of 'native' which uses system introspection to
# determine the smallest numerous of virtual and real architectures it
# should target.
#
# The option of 'all' is provided for people generating libraries that
# will deployed to any number of machines, it will compile all CUDA code
# for all major virtual architectures, guaranteeing that the code will run
# anywhere.
#
#
# 1 - native
# - Uses system introspection to determine compile flags
# 2 - fermi
# - Uses: --generate-code arch=compute_20,code=compute_20
# 3 - kepler
# - Uses: --generate-code arch=compute_30,code=compute_30
# - Uses: --generate-code arch=compute_35,code=compute_35
# 4 - maxwell
# - Uses: --generate-code arch=compute_50,code=compute_50
# - Uses: --generate-code arch=compute_52,code=compute_52
# 5 - all
# - Uses: --generate-code arch=compute_20,code=compute_20
# - Uses: --generate-code arch=compute_30,code=compute_30
# - Uses: --generate-code arch=compute_35,code=compute_35
# - Uses: --generate-code arch=compute_50,code=compute_50
#
#specify the property
set(VTKm_CUDA_Architecture "native" CACHE STRING "Which GPU Architecture(s) to compile for")
set_property(CACHE VTKm_CUDA_Architecture PROPERTY STRINGS native fermi kepler maxwell all)
#detect what the propery is set too
if(VTKm_CUDA_Architecture STREQUAL "native")
#run execute_process to do auto_detection
set(command ${CUDA_NVCC_EXECUTABLE})
set(args "-ccbin" "${CMAKE_CXX_COMPILER}" "--run" "${CMAKE_CURRENT_LIST_DIR}/VTKmDetectCUDAVersion.cxx")
execute_process(
COMMAND ${command} ${args}
RESULT_VARIABLE ran_properly
OUTPUT_VARIABLE run_output
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if(ran_properly EQUAL 0)
#find the position of the "--generate-code" output. With some compilers such as
#msvc we get compile output plus run output. So we need to strip out just the
#run output
string(FIND "${run_output}" "--generate-code" position)
string(SUBSTRING "${run_output}" ${position} -1 run_output)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} ${run_output}")
else()
message(STATUS "Unable to run \"${CUDA_NVCC_EXECUTABLE}\" to autodetect GPU architecture."
"Falling back to fermi, please manually specify if you want something else.")
set(VTKm_CUDA_Architecture "fermi")
endif()
endif()
#since when we are native we can fail, and fall back to "fermi" these have
#to happen after, and separately of the native check
if(VTKm_CUDA_Architecture STREQUAL "fermi")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_20,code=compute_20")
elseif(VTKm_CUDA_Architecture STREQUAL "kepler")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_30,code=compute_30")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_35,code=compute_35")
elseif(VTKm_CUDA_Architecture STREQUAL "maxwell")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_50,code=compute_50")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_52,code=compute_52")
elseif(VTKm_CUDA_Architecture STREQUAL "all")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_20,code=compute_20")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_30,code=compute_30")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_35,code=compute_35")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_50,code=compute_50")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_52,code=compute_52")
endif()
endif()
endmacro(vtkm_configure_component_CUDA)

@ -104,6 +104,8 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda)
#test. this might not happen when everything depends on thrust.
list(LENGTH cxxfiles cxxfiles_len)
if (use_cuda AND ${cxxfiles_len} GREATER 0)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_library(TestBuild_${name} ${cxxfiles} ${hfiles})
elseif (${cxxfiles_len} GREATER 0)
add_library(TestBuild_${name} ${cxxfiles} ${hfiles})
@ -114,6 +116,8 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda)
)
endif(VTKm_EXTRA_COMPILER_WARNINGS)
endif ()
target_include_directories(TestBuild_${name} PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(TestBuild_${name} ${VTKm_LIBRARIES})
set_source_files_properties(${hfiles}
PROPERTIES HEADER_FILE_ONLY TRUE
)
@ -233,19 +237,9 @@ function(vtkm_unit_tests)
${ARGN}
)
#set up what we possibly need to link too.
list(APPEND VTKm_UT_LIBRARIES ${VTKm_LIBRARIES})
#set up storage for the include dirs
set(VTKm_UT_INCLUDE_DIRS )
if(VTKm_ENABLE_OPENGL_INTEROP)
list(APPEND VTKm_UT_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIR} )
list(APPEND VTKm_UT_LIBRARIES ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
endif()
if(VTKm_ENABLE_OPENGL_TESTS)
list(APPEND VTKm_UT_INCLUDE_DIRS ${GLUT_INCLUDE_DIR} )
list(APPEND VTKm_UT_LIBRARIES ${GLUT_LIBRARIES} )
list(APPEND VTKm_INCLUDE_DIRS ${GLUT_INCLUDE_DIR} )
list(APPEND VTKm_LIBRARIES ${GLUT_LIBRARIES} )
endif()
if (VTKm_ENABLE_TESTING)
@ -264,6 +258,9 @@ function(vtkm_unit_tests)
if (VTKm_UT_CUDA)
vtkm_setup_nvcc_flags( old_nvcc_flags )
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(${test_prog} ${TestSources})
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
@ -275,9 +272,9 @@ function(vtkm_unit_tests)
#do it as a property value so we don't pollute the include_directories
#for any other targets
set_property(TARGET ${test_prog} APPEND PROPERTY
INCLUDE_DIRECTORIES ${VTKm_UT_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES ${VTKm_INCLUDE_DIRS} )
target_link_libraries(${test_prog} ${VTKm_UT_LIBRARIES})
target_link_libraries(${test_prog} ${VTKm_LIBRARIES})
target_compile_options(${test_prog} PRIVATE ${VTKm_COMPILE_OPTIONS})
@ -400,13 +397,19 @@ function(vtkm_worklet_unit_tests device_adapter)
get_property(unit_test_srcs GLOBAL PROPERTY vtkm_worklet_unit_tests_cu_sources )
vtkm_setup_nvcc_flags( old_nvcc_flags )
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(${test_prog} ${unit_test_drivers} ${unit_test_srcs})
set(CUDA_NVCC_FLAGS ${old_nvcc_flags} )
else()
add_executable(${test_prog} ${unit_test_drivers} ${unit_test_srcs})
target_link_libraries(${test_prog} ${VTKm_LIBRARIES})
endif()
set_property(TARGET ${test_prog} APPEND PROPERTY
INCLUDE_DIRECTORIES ${VTKm_INCLUDE_DIRS}
)
target_link_libraries(${test_prog} ${VTKm_LIBRARIES})
#add the specific compile options for this executable
target_compile_options(${test_prog} PRIVATE ${VTKm_COMPILE_OPTIONS})
@ -531,6 +534,9 @@ function(vtkm_benchmarks device_adapter)
set(benchmark_prog "${benchmark_prog}_${device_type}")
if(is_cuda)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(${benchmark_prog} ${file} ${benchmark_headers})
else()
add_executable(${benchmark_prog} ${file} ${benchmark_headers})
@ -539,6 +545,8 @@ function(vtkm_benchmarks device_adapter)
set_source_files_properties(${benchmark_headers}
PROPERTIES HEADER_FILE_ONLY TRUE)
set_property(TARGET ${benchmark_prog} APPEND PROPERTY
INCLUDE_DIRECTORIES ${VTKm_INCLUDE_DIRS} )
target_link_libraries(${benchmark_prog} ${VTKm_LIBRARIES})
if(MSVC)
@ -592,17 +600,4 @@ macro(vtkm_disable_troublesome_thrust_warnings_var flags_var)
set(${flags_var} "${new_flags}")
endmacro(vtkm_disable_troublesome_thrust_warnings_var)
# Set up configuration for a given device.
macro(vtkm_configure_device device)
string(TOUPPER "${device}" device_uppercase)
set(VTKm_ENABLE_${device_uppercase} ON)
include("UseVTKm${device}")
if(NOT VTKm_${device}_FOUND)
if ("${ARGV1}" STREQUAL "REQUIRED")
message(SEND_ERROR "Could not configure for using VTKm with ${device}")
else()
message(STATUS "Could not configure for using VTKm with ${device}")
endif()
endif()
endmacro(vtkm_configure_device)
include(VTKmConfigureComponents)

@ -39,7 +39,7 @@ endif()
project (VTKm)
set(VTKm_MAJOR_VERSION 0)
set(VTKm_MAJOR_VERSION 1)
set(VTKm_MINOR_VERSION 1)
set(VTKm_PATCH_VERSION 0)
set(VTKm_VERSION "${VTKm_MAJOR_VERSION}.${VTKm_MINOR_VERSION}.${VTKm_PATCH_VERSION}")
@ -50,20 +50,21 @@ set(VTKm_INSTALL_CMAKE_MODULE_DIR "share/vtkm/cmake")
set(VTKm_REQUIRED_BOOST_VERSION "1.48")
# include some vtkm-specific cmake code.
include(CMake/VTKmMacros.cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_SOURCE_DIR}/CMake)
#-----------------------------------------------------------------------------
# List of Boost features used:
# * Smart Ptr
# * Meta programming language
# We check for boost first, as the device configuration code requires boost
# to be found
find_package(BoostHeaders ${VTKm_REQUIRED_BOOST_VERSION} REQUIRED)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Please specify where to find boost headers (${VTKm_REQUIRED_BOOST_VERSION}+)" )
# include some vtkm-specific cmake code.
include(VTKmMacros)
set(VTKm_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}
)
# Load the base VTK-m configuration, which is required for some of the later
# config.
vtkm_configure_component_Base()
if(NOT VTKm_Base_FOUND)
message(SEND_ERROR "Could not load base VTK-m component. Perhaps the Boost headers were not found.")
endif()
#-----------------------------------------------------------------------------
@ -114,15 +115,22 @@ endif()
#-----------------------------------------------------------------------------
# Set up devices selected.
vtkm_configure_device(Serial)
vtkm_configure_component_Serial()
if(NOT VTKm_Serial_FOUND)
message(SEND_ERROR "Could not load serial VTK-m component.")
endif()
if (VTKm_ENABLE_TBB)
vtkm_configure_device(TBB REQUIRED)
vtkm_configure_component_TBB()
if(NOT VTKm_TBB_FOUND)
message(SEND_ERROR "Could not load TBB configuration. If TBB is not available, turn off VTKm_ENABLE_TBB.")
endif()
endif (VTKm_ENABLE_TBB)
if (VTKm_ENABLE_CUDA)
vtkm_configure_device(CUDA REQUIRED)
cuda_include_directories(${VTKm_INCLUDE_DIRS})
vtkm_configure_component_CUDA()
if(NOT VTKm_CUDA_FOUND)
message(SEND_ERROR "Could not load CUDA configuration. If CUDA is not available, turn off VTKm_ENABLE_TBB.")
endif()
endif (VTKm_ENABLE_CUDA)
include_directories(${VTKm_INCLUDE_DIRS})
#-----------------------------------------------------------------------------
@ -143,11 +151,6 @@ mark_as_advanced(
EXECUTABLE_OUTPUT_PATH
LIBRARY_OUTPUT_PATH)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
#-----------------------------------------------------------------------------
# Add "meta" tests that check the state of the repository
# SystemInformation prints out information about the current configuration
@ -186,7 +189,6 @@ include(CMakeDependentOption)
find_package(OpenGL)
find_package(GLEW)
find_package(GLUT)
find_package(EGL)
#dependent option reads, value to set, if condition is true, otherwise
#use last value
@ -202,12 +204,6 @@ CMAKE_DEPENDENT_OPTION(VTKm_ENABLE_OPENGL_TESTS
"Enable OpenGL Interop Render Window Tests"
ON "VTKm_ENABLE_OPENGL_INTEROP;GLUT_FOUND" OFF)
#on unix/linux Glew uses pthreads, so we need to find that, and link to it
#explicitly or else in release mode we get sigsegv on launch
if(UNIX AND VTKm_ENABLE_OPENGL_INTEROP)
find_package(Threads REQUIRED)
endif()
#-----------------------------------------------------------------------------
# Find the Python interpreter, which we will use during the build process
find_package(PythonInterp)
@ -235,35 +231,30 @@ if(VTKm_BUILD_EXAMPLES)
endif(VTKm_BUILD_EXAMPLES)
#-----------------------------------------------------------------------------
# Configuration for build directory.
set(VTKm_INCLUDE_DIRS_CONFIG "${VTKm_SOURCE_DIR};${VTKm_BINARY_DIR}")
set(VTKm_CMAKE_MODULE_PATH_CONFIG "${VTKm_SOURCE_DIR}/CMake")
configure_file(
# Ready files for find_package
include(CMakePackageConfigHelpers)
set(VTKm_LOAD_COMPONENTS_COMMANDS)
foreach(component ${VTKm_AVAILABLE_COMPONENTS})
set(VTKm_LOAD_COMPONENTS_COMMANDS "${VTKm_LOAD_COMPONENTS_COMMANDS}
if(${component} IN_LIST VTKm_FIND_COMPONENTS)
vtkm_configure_component_${component}()
endif()")
endforeach(component)
configure_package_config_file(
${VTKm_SOURCE_DIR}/CMake/VTKmConfig.cmake.in
${VTKm_BINARY_DIR}/VTKmConfig.cmake
@ONLY IMMEDIATE
${VTKm_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmConfig.cmake
INSTALL_DESTINATION ${VTKm_INSTALL_CONFIG_DIR}
PATH_VARS VTKm_INSTALL_INCLUDE_DIR VTKm_INSTALL_CMAKE_MODULE_DIR
)
# Configuration for install.
set(VTKm_INCLUDE_DIRS_CONFIG "\${_install_dir}/${VTKm_INSTALL_INCLUDE_DIR}")
set(VTKm_CMAKE_MODULE_PATH_CONFIG "\${_install_dir}/${VTKm_INSTALL_CMAKE_MODULE_DIR}")
configure_file(
${VTKm_SOURCE_DIR}/CMake/VTKmConfig.cmake.in
${VTKm_BINARY_DIR}/VTKmConfig.cmake.install
@ONLY IMMEDIATE
)
install(FILES ${VTKm_BINARY_DIR}/VTKmConfig.cmake.install
DESTINATION ${VTKm_INSTALL_CONFIG_DIR}
RENAME VTKmConfig.cmake
)
# Create supplemental version configuration file.
configure_file(
${VTKm_SOURCE_DIR}/CMake/VTKmConfigVersion.cmake.in
${VTKm_BINARY_DIR}/VTKmConfigVersion.cmake
@ONLY
)
install(FILES ${VTKm_BINARY_DIR}/VTKmConfigVersion.cmake
write_basic_package_version_file(
${VTKm_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmConfigVersion.cmake
VERSION ${VTKm_VERSION}
COMPATIBILITY ExactVersion )
install(
FILES ${VTKm_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmConfigVersion.cmake
DESTINATION ${VTKm_INSTALL_CONFIG_DIR}
)
@ -287,20 +278,11 @@ install(
DESTINATION ${VTKm_INSTALL_CMAKE_MODULE_DIR}
)
# Install Use files.
install(
FILES
${VTKm_SOURCE_DIR}/CMake/UseVTKmBase.cmake
${VTKm_SOURCE_DIR}/CMake/UseVTKmSerial.cmake
${VTKm_SOURCE_DIR}/CMake/UseVTKmTBB.cmake
${VTKm_SOURCE_DIR}/CMake/UseVTKmCUDA.cmake
DESTINATION ${VTKm_INSTALL_CMAKE_MODULE_DIR}
)
# Install support files.
install(
FILES
${VTKm_SOURCE_DIR}/CMake/VTKmMacros.cmake
${VTKm_SOURCE_DIR}/CMake/VTKmConfigureComponents.cmake
${VTKm_SOURCE_DIR}/CMake/VTKmCompilerOptimizations.cmake
${VTKm_SOURCE_DIR}/CMake/VTKmDetectCUDAVersion.cxx
DESTINATION ${VTKm_INSTALL_CMAKE_MODULE_DIR}

@ -20,7 +20,13 @@
##
##=============================================================================
vtkm_configure_component_Serial()
vtkm_configure_component_CUDA()
vtkm_configure_component_TBB()
add_executable(Clipping_SERIAL Clipping.cxx)
target_include_directories(Clipping_SERIAL PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Clipping_SERIAL ${VTKm_LIBRARIES})
target_compile_options(Clipping_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
set_property(
@ -35,14 +41,19 @@ if(VTKm_CUDA_FOUND)
vtkm_setup_nvcc_flags( old_nvcc_flags )
vtkm_disable_troublesome_thrust_warnings()
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(Clipping_CUDA ${cudaSource})
target_include_directories(Clipping_CUDA PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Clipping_CUDA ${VTKm_LIBRARIES})
target_compile_options(Clipping_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
endif()
if(VTKm_ENABLE_TBB)
if(VTKm_TBB_FOUND)
add_executable(Clipping_TBB Clipping.cxx)
target_include_directories(Clipping_TBB PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Clipping_TBB ${VTKm_LIBRARIES})

@ -19,17 +19,19 @@
## this software.
##
##=============================================================================
find_package(MESA)
if(MESA_FOUND)
vtkm_configure_component_OSMESA()
if(VTKm_OSMESA_FOUND)
if(VTKm_CUDA_FOUND)
cuda_add_executable(Demo Demo.cu)
else()
add_executable(Demo Demo.cxx)
endif()
if(VTKm_CUDA_FOUND)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(Demo Demo.cu)
else()
add_executable(Demo Demo.cxx)
endif()
target_include_directories(Demo PRIVATE ${OSMESA_INCLUDE_DIR})
target_link_libraries(Demo ${OSMESA_LIBRARY} ${VTKm_LIBRARIES})
target_compile_options(Demo PRIVATE ${VTKm_COMPILE_OPTIONS})
target_include_directories(Demo PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Demo ${VTKm_LIBRARIES})
target_compile_options(Demo PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()

@ -20,25 +20,36 @@
##
##=============================================================================
if(VTKm_ENABLE_OPENGL_INTEROP AND GLUT_FOUND)
find_package(GLUT)
vtkm_configure_component_OpenGL()
vtkm_configure_component_Interop()
vtkm_configure_component_Serial()
vtkm_configure_component_CUDA()
vtkm_configure_component_TBB()
if(VTKm_Interop_FOUND AND VTKm_OpenGL_FOUND AND GLUT_FOUND)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(HelloWorld_SERIAL HelloWorld.cxx LoadShaders.h)
set_source_files_properties(LoadShaders.h PROPERTIES HEADER_FILE_ONLY TRUE)
target_include_directories(HelloWorld_SERIAL PRIVATE ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
target_link_libraries(HelloWorld_SERIAL ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(HelloWorld_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(HelloWorld_SERIAL ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(HelloWorld_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
if(VTKm_CUDA_FOUND)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
vtkm_disable_troublesome_thrust_warnings()
cuda_add_executable(HelloWorld_CUDA HelloWorld.cu LoadShaders.h)
target_link_libraries(HelloWorld_CUDA ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(HelloWorld_CUDA PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(HelloWorld_CUDA ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(HelloWorld_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()
if(VTKm_TBB_FOUND)
add_executable(HelloWorld_TBB HelloWorldTBB.cxx LoadShaders.h)
target_include_directories(HelloWorld_TBB PRIVATE ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
target_link_libraries(HelloWorld_TBB ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(HelloWorld_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(HelloWorld_TBB ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(HelloWorld_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()

@ -20,24 +20,33 @@
##
##=============================================================================
if(OPENGL_FOUND AND GLUT_FOUND)
find_package(GLUT)
vtkm_configure_component_OpenGL()
vtkm_configure_component_Serial()
vtkm_configure_component_CUDA()
vtkm_configure_component_TBB()
if(VTKm_OpenGL_FOUND AND GLUT_FOUND)
add_executable(IsosurfaceUniformGrid_SERIAL IsosurfaceUniformGrid.cxx quaternion.h)
set_source_files_properties(quaternion.h PROPERTIES HEADER_FILE_ONLY TRUE)
target_include_directories(IsosurfaceUniformGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(IsosurfaceUniformGrid_SERIAL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(IsosurfaceUniformGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(IsosurfaceUniformGrid_SERIAL ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(IsosurfaceUniformGrid_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
if(VTKm_CUDA_FOUND)
vtkm_disable_troublesome_thrust_warnings()
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
cuda_add_executable(IsosurfaceUniformGrid_CUDA IsosurfaceUniformGrid.cu quaternion.h)
target_link_libraries(IsosurfaceUniformGrid_CUDA ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_link_libraries(IsosurfaceUniformGrid_CUDA ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(IsosurfaceUniformGrid_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()
if(VTKm_ENABLE_TBB)
add_executable(IsosurfaceUniformGrid_TBB IsosurfaceUniformGridTBB.cxx quaternion.h)
target_include_directories(IsosurfaceUniformGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(IsosurfaceUniformGrid_TBB ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(IsosurfaceUniformGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(IsosurfaceUniformGrid_TBB ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(IsosurfaceUniformGrid_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()

@ -20,13 +20,20 @@
##
##=============================================================================
find_package(GLUT)
vtkm_configure_component_Serial()
vtkm_configure_component_CUDA()
vtkm_configure_component_TBB()
if(VTKm_CUDA_FOUND)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(MultiBackend MultiBackend.cu)
else()
add_executable(MultiBackend MultiBackend.cxx)
endif()
target_include_directories(MultiBackend PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(MultiBackend ${VTKm_LIBRARIES})
target_compile_options(MultiBackend PRIVATE ${VTKm_COMPILE_OPTIONS})
if(VTKm_TBB_FOUND)
target_link_libraries(MultiBackend ${VTKm_LIBRARIES})
endif()

@ -20,23 +20,31 @@
##
##=============================================================================
if(OPENGL_FOUND AND GLUT_FOUND)
vtkm_configure_component_OpenGL()
vtkm_configure_component_Serial()
#vtkm_configure_component_CUDA()
#vtkm_configure_component_TBB()
if(VTKm_OpenGL_FOUND AND GLUT_FOUND)
add_executable(Rendering_SERIAL Rendering.cxx)
target_include_directories(Rendering_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(Rendering_SERIAL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(Rendering_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(Rendering_SERIAL ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(Rendering_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
# if(VTKm_CUDA_FOUND)
# vtkm_disable_troublesome_thrust_warnings()
# # Cuda compiles do not respect target_include_directories
# cuda_include_directories(${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS})
# cuda_add_executable(Rendering_CUDA Rendering.cu)
# target_link_libraries(Rendering_CUDA ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
# target_include_directories(Rendering_CUDA PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
# target_link_libraries(Rendering_CUDA ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
# target_compile_options(Rendering_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
# endif()
# if(VTKm_ENABLE_TBB)
# if(VTKm_TBB_FOUND)
# add_executable(Rendering_TBB IsosurfaceUniformGridTBB.cxx)
# target_include_directories(Rendering_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
# target_link_libraries(Rendering_TBB ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
# target_include_directories(Rendering_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
# target_link_libraries(Rendering_TBB ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
# target_compile_options(Rendering_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
# endif()

@ -20,22 +20,32 @@
##
##=============================================================================
if(OPENGL_FOUND AND GLUT_FOUND)
find_package(GLUT)
vtkm_configure_component_OpenGL()
vtkm_configure_component_Serial()
vtkm_configure_component_CUDA()
vtkm_configure_component_TBB()
if(VTKm_OpenGL_FOUND AND GLUT_FOUND)
add_executable(StreamLineUniformGrid_SERIAL StreamLineUniformGrid.cxx)
target_include_directories(StreamLineUniformGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(StreamLineUniformGrid_SERIAL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})
target_include_directories(StreamLineUniformGrid_SERIAL PRIVATE ${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
target_link_libraries(StreamLineUniformGrid_SERIAL ${VTKm_LIBRARIES} ${GLUT_LIBRARIES})
target_compile_options(StreamLineUniformGrid_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
if(VTKm_CUDA_FOUND)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
cuda_add_executable(StreamLineUniformGrid_CUDA StreamLineUniformGrid.cu)
target_link_libraries(StreamLineUniformGrid_CUDA ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})
target_include_directories(StreamLineUniformGrid_SERIAL PRIVATE ${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
target_link_libraries(StreamLineUniformGrid_CUDA ${VTKm_LIBRARIES} ${GLUT_LIBRARIES})
target_compile_options(StreamLineUniformGrid_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()
if(VTKm_ENABLE_TBB)
if(VTKm_TBB_FOUND)
add_executable(StreamLineUniformGrid_TBB StreamLineUniformGridTBB.cxx)
target_include_directories(StreamLineUniformGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${TBB_INCLUDE_DIRS})
target_link_libraries(StreamLineUniformGrid_TBB ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${TBB_LIBRARIES})
target_include_directories(StreamLineUniformGrid_TBB PRIVATE ${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
target_link_libraries(StreamLineUniformGrid_TBB ${VTKm_LIBRARIES} ${GLUT_LIBRARIES})
target_compile_options(StreamLineUniformGrid_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()

@ -20,64 +20,78 @@
##
##=============================================================================
if(OPENGL_FOUND AND GLUT_FOUND)
find_package(GLUT)
vtkm_configure_component_OpenGL()
vtkm_configure_component_Serial()
vtkm_configure_component_CUDA()
vtkm_configure_component_TBB()
if(VTKm_OpenGL_FOUND AND GLUT_FOUND)
add_executable(TetrahedralizeExplicitGrid_SERIAL TetrahedralizeExplicitGrid.cxx)
target_include_directories(TetrahedralizeExplicitGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(TetrahedralizeExplicitGrid_SERIAL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TetrahedralizeExplicitGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TetrahedralizeExplicitGrid_SERIAL ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TetrahedralizeExplicitGrid_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(TriangulateExplicitGrid_SERIAL TriangulateExplicitGrid.cxx)
target_include_directories(TriangulateExplicitGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(TriangulateExplicitGrid_SERIAL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TriangulateExplicitGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TriangulateExplicitGrid_SERIAL ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TriangulateExplicitGrid_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(TetrahedralizeUniformGrid_SERIAL TetrahedralizeUniformGrid.cxx)
target_include_directories(TetrahedralizeUniformGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(TetrahedralizeUniformGrid_SERIAL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TetrahedralizeUniformGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TetrahedralizeUniformGrid_SERIAL ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TetrahedralizeUniformGrid_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(TriangulateUniformGrid_SERIAL TriangulateUniformGrid.cxx)
target_include_directories(TriangulateUniformGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(TriangulateUniformGrid_SERIAL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TriangulateUniformGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TriangulateUniformGrid_SERIAL ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TriangulateUniformGrid_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
if(VTKm_CUDA_FOUND)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
cuda_add_executable(TetrahedralizeExplicitGrid_CUDA TetrahedralizeExplicitGrid.cu)
target_link_libraries(TetrahedralizeExplicitGrid_CUDA ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TetrahedralizeExplicitGrid_CUDA PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TetrahedralizeExplicitGrid_CUDA ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TetrahedralizeExplicitGrid_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
cuda_add_executable(TriangulateExplicitGrid_CUDA TriangulateExplicitGrid.cu)
target_link_libraries(TriangulateExplicitGrid_CUDA ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TriangulateExplicitGrid_CUDA PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TriangulateExplicitGrid_CUDA ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TriangulateExplicitGrid_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
cuda_add_executable(TetrahedralizeUniformGrid_CUDA TetrahedralizeUniformGrid.cu)
target_link_libraries(TetrahedralizeUniformGrid_CUDA ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TetrahedralizeUniformGrid_CUDA PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TetrahedralizeUniformGrid_CUDA ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TetrahedralizeUniformGrid_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
cuda_add_executable(TriangulateUniformGrid_CUDA TriangulateUniformGrid.cu)
target_link_libraries(TriangulateUniformGrid_CUDA ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TriangulateUniformGrid_CUDA PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TriangulateUniformGrid_CUDA ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TriangulateUniformGrid_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()
if(VTKm_ENABLE_TBB)
add_executable(TetrahedralizeExplicitGrid_TBB TetrahedralizeExplicitGridTBB.cxx)
target_include_directories(TetrahedralizeExplicitGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(TetrahedralizeExplicitGrid_TBB ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TetrahedralizeExplicitGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TetrahedralizeExplicitGrid_TBB ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TetrahedralizeExplicitGrid_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(TriangulateExplicitGrid_TBB TriangulateExplicitGridTBB.cxx)
target_include_directories(TriangulateExplicitGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(TriangulateExplicitGrid_TBB ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TriangulateExplicitGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TriangulateExplicitGrid_TBB ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TriangulateExplicitGrid_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(TetrahedralizeUniformGrid_TBB TetrahedralizeUniformGridTBB.cxx)
target_include_directories(TetrahedralizeUniformGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(TetrahedralizeUniformGrid_TBB ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TetrahedralizeUniformGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TetrahedralizeUniformGrid_TBB ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TetrahedralizeUniformGrid_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(TriangulateUniformGrid_TBB TriangulateUniformGridTBB.cxx)
target_include_directories(TriangulateUniformGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(TriangulateUniformGrid_TBB ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_include_directories(TriangulateUniformGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${VTKm_INCLUDE_DIRS})
target_link_libraries(TriangulateUniformGrid_TBB ${GLUT_LIBRARIES} ${VTKm_LIBRARIES})
target_compile_options(TriangulateUniformGrid_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()

@ -23,6 +23,7 @@
#include <vtkm/Assert.h>
#include <vtkm/Types.h>
#include <vtkm/cont/ArrayPortalToIterators.h>
#include <vtkm/cont/ErrorControlBadValue.h>
#include <vtkm/cont/ErrorControlInternal.h>
#include <vtkm/cont/Storage.h>
@ -390,8 +391,9 @@ public:
else
{
PortalConstControl portal = this->GetPortalConstControl();
std::copy(portal.GetIteratorBegin(), portal.GetIteratorBegin() +
this->GetNumberOfValues(), dest);
std::copy(vtkm::cont::ArrayPortalToIteratorBegin(portal),
vtkm::cont::ArrayPortalToIteratorEnd(portal),
dest);
}
}

@ -22,6 +22,7 @@
#include <vtkm/Types.h>
#include <vtkm/cont/ArrayPortalToIterators.h>
#include <vtkm/cont/ErrorControlBadValue.h>
#include <vtkm/cont/Storage.h>
@ -157,12 +158,12 @@ public:
template <class IteratorTypeControl>
VTKM_CONT_EXPORT void CopyInto(IteratorTypeControl dest) const
{
typedef typename StorageType::PortalConstType::IteratorType IteratorType;
IteratorType beginIterator =
this->Storage->GetPortalConst().GetIteratorBegin();
typedef typename StorageType::PortalConstType PortalType;
PortalType portal = this->Storage->GetPortalConst();
std::copy(beginIterator,
beginIterator + this->Storage->GetNumberOfValues(), dest);
std::copy(vtkm::cont::ArrayPortalToIteratorBegin(portal),
vtkm::cont::ArrayPortalToIteratorEnd(portal),
dest);
}
VTKM_CONT_EXPORT

@ -28,7 +28,6 @@ set(headers
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_CUDA)
vtkm_disable_troublesome_thrust_warnings()
CUDA_INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
endif()
#-----------------------------------------------------------------------------

@ -29,7 +29,6 @@ set(headers
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_CUDA)
vtkm_disable_troublesome_thrust_warnings()
CUDA_INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
endif()
vtkm_declare_headers(CUDA ${headers} TESTABLE ${VTKm_ENABLE_CUDA})

5
vtkm/internal/CMakeLists.txt Normal file → Executable file

@ -31,11 +31,12 @@ set(VTKM_ENABLE_TBB ${VTKm_ENABLE_TBB})
set(VTKM_ENABLE_OPENGL_INTEROP ${VTKm_ENABLE_OPENGL_INTEROP})
vtkm_get_kit_name(kit_name kit_dir)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Configure.h.in
${CMAKE_CURRENT_BINARY_DIR}/Configure.h
${CMAKE_BINARY_DIR}/include/${kit_dir}/Configure.h
@ONLY)
vtkm_install_headers(
vtkm/internal ${CMAKE_CURRENT_BINARY_DIR}/Configure.h)
vtkm/internal ${CMAKE_BINARY_DIR}/include/${kit_dir}/Configure.h)
unset(VTKM_ENABLE_OPENGL_INTEROP)

5
vtkm/interop/CMakeLists.txt Normal file → Executable file

@ -18,6 +18,11 @@
## this software.
##============================================================================
vtkm_configure_component_Interop()
if(NOT VTKm_Interop_FOUND)
message(SEND_ERROR "Could not configure for OpenGL Interop. Either configure necessary subcomponents or turn off VTKm_ENABLE_OPENGL_INTEROP.")
endif()
set(headers
BufferState.h
TransferToOpenGL.h

@ -53,7 +53,8 @@ void CopyFromHandle(
static_cast<GLsizeiptr>(numberOfValues);
//Copy the data from its specialized Storage container to a basic heap alloc
ValueType* temporaryStorage = new ValueType[numberOfValues];
ValueType* temporaryStorage =
new ValueType[static_cast<std::size_t>(numberOfValues)];
#ifdef VTKM_MSVC
#pragma warning(disable:4244)

@ -24,10 +24,18 @@ set(headers
WindowBase.h
)
vtkm_declare_headers(${headers})
set(unit_tests
UnitTestTransferToOpenGL.cxx
)
vtkm_unit_tests(SOURCES ${unit_tests})
# Need glut for these tests
if(GLUT_FOUND)
set(VTKm_INCLUDE_DIRS ${VTKm_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
set(VTKM_LIBRARIES ${VTKm_LIBRARIES} ${GLUT_LIBRARIES})
vtkm_declare_headers(${headers})
vtkm_unit_tests(SOURCES ${unit_tests})
else()
message(STATUS "Interop tests disabled. They need GLUT.")
endif()

@ -160,9 +160,9 @@ private:
//verify that the signature that doesn't have type works
SafelyTransferArray(temp,GLHandle);
bool is_buffer;
GLboolean is_buffer;
is_buffer = glIsBuffer(GLHandle);
VTKM_TEST_ASSERT(is_buffer==true,
VTKM_TEST_ASSERT(is_buffer==GL_TRUE,
"OpenGL buffer not filled");
std::vector<T> returnedValues = CopyGLBuffer(GLHandle, t);
@ -182,7 +182,7 @@ private:
GLenum type = vtkm::interop::internal::BufferTypePicker(t);
SafelyTransferArray(temp,GLHandle,type);
is_buffer = glIsBuffer(GLHandle);
VTKM_TEST_ASSERT(is_buffer==true,
VTKM_TEST_ASSERT(is_buffer==GL_TRUE,
"OpenGL buffer not filled");
returnedValues = CopyGLBuffer(GLHandle, t);
//verify the results match what is in the array handle
@ -201,7 +201,7 @@ private:
static_cast<vtkm::Id>(Size) );
SafelyTransferArray(constant,GLHandle);
is_buffer = glIsBuffer(GLHandle);
VTKM_TEST_ASSERT(is_buffer==true,
VTKM_TEST_ASSERT(is_buffer==GL_TRUE,
"OpenGL buffer not filled");
returnedValues = CopyGLBuffer(GLHandle, constantValue);
for(std::size_t i=0; i < Size; ++i)
@ -242,11 +242,11 @@ private:
// //verify all 3 handles are actually handles
// bool is_buffer = glIsBuffer(this->CoordGLHandle);
// VTKM_TEST_ASSERT(is_buffer==true,
// VTKM_TEST_ASSERT(is_buffer==GL_TRUE,
// "Coordinates OpenGL buffer not filled");
// is_buffer = glIsBuffer(this->MagnitudeGLHandle);
// VTKM_TEST_ASSERT(is_buffer==true,
// VTKM_TEST_ASSERT(is_buffer==GL_TRUE,
// "Magnitude OpenGL buffer not filled");
// //now that everything is openGL we have one task left.

20
vtkm/rendering/CMakeLists.txt Normal file → Executable file

@ -58,16 +58,18 @@ set(osmesa_headers
)
#-----------------------------------------------------------------------------
set(includes)
if(OPENGL_FOUND)
vtkm_configure_component_OpenGL()
if(VTKm_OpenGL_FOUND)
set(headers ${headers} ${opengl_headers})
if (UNIX AND NOT APPLE)
find_package(MESA)
if (OSMESA_FOUND)
set(headers ${headers} ${osmesa_headers})
list(APPEND includes ${OSMESA_INCLUDE_DIR})
endif()
vtkm_configure_component_OSMesa()
if(VTKm_OSMesa_FOUND)
set(headers ${headers} ${osmesa_headers})
endif()
vtkm_configure_component_EGL()
if(VTKm_EGL_FOUND)
set(headers ${headers} ${egl_headers})
endif()
endif()
@ -76,8 +78,6 @@ vtkm_declare_headers(${headers})
add_subdirectory(internal)
add_subdirectory(raytracing)
include_directories(${includes})

@ -23,24 +23,16 @@ set(unit_tests
UnitTestMapperVolume.cxx
)
set(libs)
if (OPENGL_FOUND)
list(APPEND libs ${OPENGL_LIBRARIES})
if (EGL_FOUND)
set(unit_tests ${unit_tests}
UnitTestMapperEGL.cxx
)
list(APPEND libs ${EGL_LIBRARIES})
endif()
if (OSMESA_FOUND)
set(unit_tests ${unit_tests}
UnitTestMapperOSMesa.cxx
)
list(APPEND libs ${OSMESA_LIBRARY})
endif()
if (VTKm_EGL_FOUND)
set(unit_tests ${unit_tests}
UnitTestMapperEGL.cxx
)
endif()
VTKM_unit_tests(SOURCES ${unit_tests}
LIBRARIES ${libs})
if (VTKm_OSMesa_FOUND)
set(unit_tests ${unit_tests}
UnitTestMapperOSMesa.cxx
)
endif()
VTKM_unit_tests(SOURCES ${unit_tests})