Unify configuration for VTK-m build and packages

Have VTK-m eat its own dog food when it comes to its configuration. Load
the same configuration for building VTK-m as would be loaded (more or
less) when using find_package(VTKm) in an external project.

This includes adding lots more components to the packages so that all the
setup (e.g. OpenGL, TBB, etc.) can be set up correctly. It is also a
significant change to how these components are declared. The component
configuration is simplified a bit and unified in a single file.
This commit is contained in:
Kenneth Moreland 2016-06-16 17:39:51 -06:00
parent 5d67b918dc
commit a8384d6b7a
10 changed files with 321 additions and 402 deletions

@ -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()

@ -53,32 +53,22 @@ 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)

@ -0,0 +1,262 @@
##============================================================================
## 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
Interop
TBB
CUDA
)
#-----------------------------------------------------------------------------
# Support function for making vtkm_configure_component<name> functions.
#-----------------------------------------------------------------------------
function(vtkm_finish_configure_component component)
cmake_parse_arguments(VTKm_FCC
""
""
"DEPENDENT_VARIABLES;ADD_INCLUDES;ADD_LIBRARIES"
${ARGN}
)
set(VTKm_${component}_FOUND TRUE PARENT_SCOPE)
foreach(var ${VTKm_FCC_DEPENDENT_VARIABLES})
if(NOT ${var})
message(STATUS "Failed to configure VTK-m component ${component}: !${var}")
set(VTKm_${component}_FOUND PARENT_SCOPE)
endif()
endforeach(var)
if (VTKm_${component}_FOUND)
set(VTKm_INCLUDE_DIRS ${VTKm_INCLUDE_DIRS} ${VTKm_FCC_ADD_INCLUDES} PARENT_SCOPE)
set(VTKm_LIBRARIES ${VTKm_LIBRARIES} ${VTKm_FCC_ADD_LIBRARIES} PARENT_SCOPE)
endif()
endfunction()
#-----------------------------------------------------------------------------
# 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_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)
vtkm_configure_component_Base()
find_package(TBB)
vtkm_finish_configure_component(TBB
DEPENDENT_VARIABLES VTKm_Base_FOUND VTKm_ENABLE_TBB TBB_FOUND
ADD_INCLUDES ${TBB_INCLUDE_DIRS}
ADD_LIBRARIES ${TBB_LIBRARIES}
)
endmacro(vtkm_configure_component_TBB)
macro(vtkm_configure_component_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)
vtkm_finish_configure_component(CUDA
DEPENDENT_VARIABLES
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)

@ -114,6 +114,10 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda)
)
endif(VTKm_EXTRA_COMPILER_WARNINGS)
endif ()
set_property(TARGET TestBuild_${name} APPEND PROPERTY
INCLUDE_DIRECTORIES ${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)
@ -275,9 +269,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})
@ -592,17 +586,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)

@ -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
@ -202,12 +205,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)
@ -238,6 +235,14 @@ endif(VTKm_BUILD_EXAMPLES)
# 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}/${VTKm_INSTALL_CONFIG_DIR}/VTKmConfig.cmake
@ -274,20 +279,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}

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

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

@ -58,16 +58,13 @@ 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()
endif()
@ -76,8 +73,6 @@ vtkm_declare_headers(${headers})
add_subdirectory(internal)
add_subdirectory(raytracing)
include_directories(${includes})