A thought on what CMake 3.9 would mean to VTK-m.

This commit is contained in:
Robert Maynard 2017-09-25 08:47:47 -04:00
parent f366c6fb4b
commit 56c7362258
46 changed files with 575 additions and 3410 deletions

@ -1,116 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
# Try to find EGL library and include dir.
# Once done this will define
#
# EGL_FOUND - true if EGL has been found
# EGL_INCLUDE_DIRS - where the EGL/egl.h and KHR/khrplatform.h can be found
# EGL_LIBRARY - link this to use libEGL.so.1
# EGL_opengl_LIBRARY - link with these two libraries instead of the gl library
# EGL_gldispatch_LIBRARY for full OpenGL support through EGL
# EGL_LIBRARIES - all EGL related libraries: EGL, OpenGL, GLdispatch
if(NOT EGL_INCLUDE_DIR)
# If we have a root defined look there first
if(EGL_ROOT)
find_path(EGL_INCLUDE_DIR EGL/egl.h PATHS ${EGL_ROOT}/include
NO_DEFAULT_PATH
)
endif()
if(NOT EGL_INCLUDE_DIR)
find_path(EGL_INCLUDE_DIR EGL/egl.h PATHS
/usr/local/include
/usr/include
)
endif()
endif()
if(NOT EGL_LIBRARY)
# If we have a root defined look there first
if(EGL_ROOT)
find_library(EGL_LIBRARY EGL PATHS ${EGL_ROOT}/lib
NO_DEFAULT_PATH
)
endif()
if(NOT EGL_LIBRARY)
find_library(EGL_LIBRARY EGL PATHS
/usr/local/lib
/usr/lib
)
endif()
endif()
if(NOT EGL_opengl_LIBRARY)
# If we have a root defined look there first
if(EGL_ROOT)
find_library(EGL_opengl_LIBRARY OpenGL PATHS ${EGL_ROOT}/lib
NO_DEFAULT_PATH
)
endif()
if(NOT EGL_opengl_LIBRARY)
find_library(EGL_opengl_LIBRARY OpenGL PATHS
/usr/local/lib
/usr/lib
)
endif()
endif()
if(NOT EGL_gldispatch_LIBRARY)
# If we have a root defined look there first
if(EGL_ROOT)
find_library(EGL_gldispatch_LIBRARY GLdispatch PATHS ${EGL_ROOT}/lib
NO_DEFAULT_PATH
)
endif()
if(NOT EGL_gldispatch_LIBRARY)
find_library(EGL_gldispatch_LIBRARY GLdispatch PATHS
/usr/local/lib
/usr/lib
)
endif()
# For the NVIDIA 358 drivers there isn't a libGLdispath.so. The
# proper one gets installed as libGLdispatch.so.0.
if(NOT EGL_gldispatch_LIBRARY)
find_library(EGL_gldispatch_LIBRARY libGLdispatch.so.0 PATHS
/usr/local/lib
/usr/lib
)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EGL
FOUND_VAR EGL_FOUND
REQUIRED_VARS EGL_LIBRARY EGL_opengl_LIBRARY EGL_gldispatch_LIBRARY EGL_INCLUDE_DIR)
if(EGL_FOUND)
set(EGL_LIBRARIES ${EGL_LIBRARY} ${EGL_opengl_LIBRARY} ${EGL_gldispatch_LIBRARY})
set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
endif()
mark_as_advanced(EGL_DIR EGL_INCLUDE_DIR EGL_LIBRARY EGL_opengl_LIBRARY EGL_gldispatch_LIBRARY)

@ -1,80 +0,0 @@
# - Find the OpenGL Extension Wrangler Library (GLEW)
# This module defines the following variables:
# GLEW_INCLUDE_DIRS - include directories for GLEW
# GLEW_LIBRARIES - libraries to link against GLEW
# GLEW_FOUND - true if GLEW has been found and can be used
#=============================================================================
# Copyright 2012 Benjamin Eikel
#
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ------------------------------------------------------------------------------
#
# The above copyright and license notice applies to distributions of
# CMake in source and binary form. Some source files contain additional
# notices of original copyright by their contributors; see each source
# for details. Third-party software packages supplied with CMake under
# compatible licenses provide their own copyright notices documented in
# corresponding subdirectories.
#
# ------------------------------------------------------------------------------
#
# CMake was initially developed by Kitware with the following sponsorship:
#
# * National Library of Medicine at the National Institutes of Health
# as part of the Insight Segmentation and Registration Toolkit (ITK).
#
# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
# Visualization Initiative.
#
# * National Alliance for Medical Image Computing (NAMIC) is funded by the
# National Institutes of Health through the NIH Roadmap for Medical Research,
# Grant U54 EB005149.
#
# * Kitware, Inc.
find_path(GLEW_INCLUDE_DIR GL/glew.h)
find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLEW
FOUND_VAR GLEW_FOUND
REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
if(GLEW_FOUND)
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
endif()
mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)

@ -1,107 +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 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2016 UT-Battelle, LLC.
## Copyright 2016 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##
##=============================================================================
# Try to find EGL library and include dir.
# Once done this will define
#
# GLFW_FOUND
# GLFW_INCLUDE_DIRS
# GLFW_LIBRARIES
#
include(FindPackageHandleStandardArgs)
if (WIN32)
find_path( GLFW_INCLUDE_DIR
NAMES
GLFW/glfw3.h
PATHS
${PROJECT_SOURCE_DIR}/shared_external/glfw/include
${PROJECT_SOURCE_DIR}/../shared_external/glfw/include
${GLFW_LOCATION}/include
$ENV{GLFW_LOCATION}/include
$ENV{PROGRAMFILES}/GLFW/include
${GLFW_LOCATION}
$ENV{GLFW_LOCATION}
DOC "The directory where GLFW/glfw3.h resides" )
if(ARCH STREQUAL "x86")
find_library( GLFW_LIBRARY
NAMES
glfw3
PATHS
${GLFW_LOCATION}/lib
$ENV{GLFW_LOCATION}/lib
$ENV{PROGRAMFILES}/GLFW/lib
DOC "The GLFW library")
else()
find_library( GLFW_LIBRARY
NAMES
glfw3
PATHS
${GLFW_LOCATION}/lib
$ENV{GLFW_LOCATION}/lib
$ENV{PROGRAMFILES}/GLFW/lib
DOC "The GLFW library")
endif()
endif ()
if (${CMAKE_HOST_UNIX})
find_path( GLFW_INCLUDE_DIR
NAMES
GLFW/glfw3.h
PATHS
${GLFW_LOCATION}/include
$ENV{GLFW_LOCATION}/include
/usr/include
/usr/local/include
/sw/include
/opt/local/include
NO_DEFAULT_PATH
DOC "The directory where GLFW/glfw3.h resides"
)
find_library( GLFW_LIBRARY
NAMES
glfw3 glfw
PATHS
${GLFW_LOCATION}/lib
$ENV{GLFW_LOCATION}/lib
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
/usr/lib/x86_64-linux-gnu
NO_DEFAULT_PATH
DOC "The GLFW library")
endif ()
find_package_handle_standard_args(GLFW
FOUND_VAR GLFW_FOUND
REQUIRED_VARS GLFW_INCLUDE_DIR GLFW_LIBRARY
)
if(GLFW_FOUND)
set(GLFW_LIBRARIES ${GLFW_LIBRARY})
set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
endif()
mark_as_advanced( GLFW_INCLUDE_DIR GLFW_LIBRARY )

@ -1,66 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
# Try to find Mesa off-screen library and include dir.
# Once done this will define
#
# OSMESA_FOUND - true if OSMesa has been found
# OSMESA_INCLUDE_DIR - where the GL/osmesa.h can be found
# OSMESA_LIBRARY - Link this to use OSMesa
if(NOT OSMESA_INCLUDE_DIR)
# If we have a root defined look there first
if(OSMESA_ROOT)
find_path(OSMESA_INCLUDE_DIR GL/osmesa.h PATHS ${OSMESA_ROOT}/include
NO_DEFAULT_PATH
)
endif()
if(NOT OSMESA_INCLUDE_DIR)
find_path(OSMESA_INCLUDE_DIR GL/osmesa.h PATHS
/usr/openwin/share/include
/opt/graphics/OpenGL/include
)
endif()
endif()
# This may be left blank if OSMesa symbols are included
# in the main Mesa library
if(NOT OSMESA_LIBRARY)
# If we have a root defined look there first
if(OSMESA_ROOT)
find_library(OSMESA_LIBRARY OSMesa PATHS ${OSMESA_ROOT}/lib
NO_DEFAULT_PATH
)
endif()
if(NOT OSMESA_LIBRARY)
find_library(OSMESA_LIBRARY OSMesa PATHS
/opt/graphics/OpenGL/lib
/usr/openwin/lib
)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OSMesa DEFAULT_MSG OSMESA_LIBRARY OSMESA_INCLUDE_DIR)
mark_as_advanced(OSMESA_INCLUDE_DIR OSMESA_LIBRARY)

@ -1,42 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
#
# - Finds the pyexpander macro tool.
# Use this module by invoking find_package.
#
# This module finds the expander.py command distributed with pyexpander.
# pyexpander can be downloaded from http://pyexpander.sourceforge.net.
# The following variables are defined:
#
# PYEXPANDER_FOUND - True if pyexpander is found
# PYEXPANDER_COMMAND - The pyexpander executable
#
# Note that on some platforms (such as Windows), you cannot execute a python
# script directly. Thus, it could be safer to execute the Python interpreter
# with PYEXPANDER_COMMAND as an argument. See FindPythonInterp.cmake for help
# in finding the Python interpreter.
#
find_program(PYEXPANDER_COMMAND expander.py)
mark_as_advanced(PYEXPANDER_COMMAND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Pyexpander DEFAULT_MSG PYEXPANDER_COMMAND)

@ -1,81 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
#
# FindThrust
#
# This module finds the Thrust header files and extrats their version. It
# sets the following variables.
#
# THRUST_INCLUDE_DIR - Include directory for thrust header files. (All header
# files will actually be in the thrust subdirectory.)
# THRUST_VERSION - Version of thrust in the form "major.minor.patch".
#
find_path( THRUST_INCLUDE_DIR
HINTS
/usr/include/cuda
/usr/local/include
/usr/local/cuda/include
${CUDA_INCLUDE_DIRS}
${CUDA_TOOLKIT_ROOT_DIR}
${CUDA_SDK_ROOT_DIR}
NAMES thrust/version.h
DOC "Thrust headers"
)
if( THRUST_INCLUDE_DIR )
list( REMOVE_DUPLICATES THRUST_INCLUDE_DIR )
endif( THRUST_INCLUDE_DIR )
# Find thrust 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}")
endif()
# Check for required components
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Thrust
FOUND_VAR Thrust_FOUND
REQUIRED_VARS THRUST_INCLUDE_DIR
VERSION_VAR THRUST_VERSION
)
if(Thrust_FOUND)
set(THRUST_INCLUDE_DIRS ${THRUST_INCLUDE_DIR})
endif()
mark_as_advanced(THRUST_INCLUDE_DIR)

61
CMake/VTKmBackends.cmake Normal file

@ -0,0 +1,61 @@
##============================================================================
## 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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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_ENABLE_TBB AND NOT TARGET vtkm::tbb)
find_package(TBB REQUIRED)
add_library(vtkm::tbb UNKNOWN IMPORTED)
set_target_properties(vtkm::tbb PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}")
if(TBB_LIBRARY_RELEASE)
set_property(TARGET vtkm::tbb APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(vtkm::tbb PROPERTIES IMPORTED_LOCATION_RELEASE "${TBB_LIBRARY_RELEASE}")
endif()
if(TBB_LIBRARY_DEBUG)
set_property(TARGET vtkm::tbb APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(vtkm::tbb PROPERTIES IMPORTED_LOCATION_DEBUG "${TBB_LIBRARY_DEBUG}")
endif()
if(NOT TBB_LIBRARY_RELEASE AND NOT TBB_LIBRARY_DEBUG)
set_property(TARGET vtkm::tbb APPEND PROPERTY IMPORTED_LOCATION "${TBB_LIBRARY}")
endif()
endif()
if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
enable_language(CUDA)
add_library(vtkm::cuda UNKNOWN IMPORTED)
# We can't have this location/lib empty, so we provide a location that is
# valid and will have no effect on compilation
list(GET CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES 0 VTKM_CUDA_LIBRARY)
set_property(TARGET vtkm::cuda APPEND PROPERTY IMPORTED_LOCATION "${VTKM_CUDA_LIBRARY}")
set_target_properties(vtkm::cuda PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
#This is where we would add the -gencode flags so that all cuda code
#way compiled properly
endif()

@ -1,56 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
#-----------------------------------------------------------------------------
# Find Doxygen
#-----------------------------------------------------------------------------
find_package(Doxygen REQUIRED)
#-----------------------------------------------------------------------------
# Configure Doxygen
#-----------------------------------------------------------------------------
set(VTKm_DOXYGEN_HAVE_DOT ${DOXYGEN_DOT_FOUND})
set(VTKm_DOXYGEN_DOT_PATH ${DOXYGEN_DOT_PATH})
set(VTKm_DOXYFILE ${CMAKE_CURRENT_BINARY_DIR}/docs/doxyfile)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/doxyfile.in ${VTKm_DOXYFILE}
@ONLY)
#-----------------------------------------------------------------------------
# Run Doxygen
#-----------------------------------------------------------------------------
function(vtkm_build_documentation)
if(WIN32)
set(doxygen_redirect NUL)
else()
set(doxygen_redirect /dev/null)
endif()
add_custom_command(
OUTPUT ${VTKm_BINARY_DIR}/docs/doxygen
COMMAND ${DOXYGEN_EXECUTABLE} ${VTKm_DOXYFILE} > ${doxygen_redirect}
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/CMake/doxyfile.in
DEPENDS ${VTKm_DOXYFILE}
COMMENT "Generating VTKm Documentation"
)
add_custom_target(VTKmDoxygenDocs
ALL
DEPENDS ${VTKm_BINARY_DIR}/docs/doxygen
)
endfunction(vtkm_build_documentation)

@ -1,242 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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 CMake script checks source files for the appropriate VTKM copyright
## statement, which is stored in VTKm_SOURCE_DIR/CMake/VTKmCopyrightStatement.txt.
## To run this script, execute CMake as follows:
##
## cmake -DVTKm_SOURCE_DIR=<VTKm_SOURCE_DIR> -P <VTKm_SOURCE_DIR>/CMake/VTKMCheckCopyright.cmake
##
cmake_minimum_required(VERSION 2.8)
set(FILES_TO_CHECK
*.txt
*.cmake
*.h
*.h.in
*.cxx
*.cu
)
set(EXCEPTIONS
LICENSE.txt
README.txt
)
if (NOT VTKm_SOURCE_DIR)
message(SEND_ERROR "VTKm_SOURCE_DIR not defined.")
endif (NOT VTKm_SOURCE_DIR)
set(copyright_file ${VTKm_SOURCE_DIR}/CMake/VTKmCopyrightStatement.txt)
if (NOT EXISTS ${copyright_file})
message(SEND_ERROR "Cannot find VTKMCopyrightStatement.txt.")
endif (NOT EXISTS ${copyright_file})
set(license_file ${VTKm_SOURCE_DIR}/LICENSE.txt)
if (NOT EXISTS ${license_file})
message(SEND_ERROR "Cannot find LICENSE.txt.")
endif (NOT EXISTS ${license_file})
# Get a list of third party files (with different copyrights) from the
# license file.
file(STRINGS ${license_file} license_lines)
list(FIND
license_lines
"- - - - - - - - - - - - - - - - - - - - - - - - do not remove this line"
separator_index
)
math(EXPR begin_index "${separator_index} + 1")
list(LENGTH license_lines license_file_length)
math(EXPR end_index "${license_file_length} - 1")
foreach (index RANGE ${begin_index} ${end_index})
list(GET license_lines ${index} tpl_file)
set(EXCEPTIONS ${EXCEPTIONS} ${tpl_file})
endforeach(index)
# if the build directory is in the source directory, exclude generated build
# files
find_path(BUILD_DIR CMakeCache.txt .)
get_filename_component(abs_build_dir ${BUILD_DIR} ABSOLUTE)
get_filename_component(build_dir_name ${abs_build_dir} NAME)
set(EXCEPTIONS ${EXCEPTIONS} ${build_dir_name}/*)
message("${EXCEPTIONS}")
# Gets the current year (if possible).
function (get_year var)
string(TIMESTAMP result "%Y")
set(${var} "${result}" PARENT_SCOPE)
endfunction (get_year)
set(copyright_file_year 2014)
get_year(current_year)
# Escapes ';' characters (list delimiters) and splits the given string into
# a list of its lines without newlines.
function (list_of_lines var string)
string(REGEX REPLACE ";" "\\\\;" conditioned_string "${string}")
string(REGEX REPLACE "\n" ";" conditioned_string "${conditioned_string}")
set(${var} "${conditioned_string}" PARENT_SCOPE)
endfunction (list_of_lines)
# Read in copyright statement file.
file(READ ${copyright_file} COPYRIGHT_STATEMENT)
# Remove trailing whitespace and ending lines. They are sometimes hard to
# see or remove in editors.
string(REGEX REPLACE "[ \t]*\n" "\n" COPYRIGHT_STATEMENT "${COPYRIGHT_STATEMENT}")
string(REGEX REPLACE "\n+$" "" COPYRIGHT_STATEMENT "${COPYRIGHT_STATEMENT}")
# Get a list of lines in the copyright statement.
list_of_lines(COPYRIGHT_LINE_LIST "${COPYRIGHT_STATEMENT}")
# Comment regular expression characters that we want to match literally.
string(REPLACE "." "\\." COPYRIGHT_LINE_LIST "${COPYRIGHT_LINE_LIST}")
string(REPLACE "(" "\\(" COPYRIGHT_LINE_LIST "${COPYRIGHT_LINE_LIST}")
string(REPLACE ")" "\\)" COPYRIGHT_LINE_LIST "${COPYRIGHT_LINE_LIST}")
# Introduce regular expression for years we want to be generic.
string(REPLACE
"${copyright_file_year}"
"20[0-9][0-9]"
COPYRIGHT_LINE_LIST
"${COPYRIGHT_LINE_LIST}"
)
# Replace year in COPYRIGHT_STATEMENT with current year.
string(REPLACE
"${copyright_file_year}"
"${current_year}"
COPYRIGHT_STATEMENT
"${COPYRIGHT_STATEMENT}"
)
# Print an error concerning the missing copyright in the given file.
function(missing_copyright filename comment_prefix)
message("${filename} does not have the appropriate copyright statement:\n")
# Condition the copyright statement
string(REPLACE
"\n"
"\n${comment_prefix} "
comment_copyright
"${COPYRIGHT_STATEMENT}"
)
set(comment_copyright "${comment_prefix} ${comment_copyright}")
string(REPLACE
"\n${comment_prefix} \n"
"\n${comment_prefix}\n"
comment_copyright
"${comment_copyright}"
)
message("${comment_prefix}=============================================================================")
message("${comment_prefix}")
message("${comment_copyright}")
message("${comment_prefix}")
message("${comment_prefix}=============================================================================\n")
message(SEND_ERROR
"Please add the previous statement to the beginning of ${filename}"
)
endfunction(missing_copyright)
# Get an appropriate beginning line comment for the given filename.
function(get_comment_prefix var filename)
get_filename_component(base "${filename}" NAME_WE)
get_filename_component(extension "${filename}" EXT)
if (extension STREQUAL ".cmake")
set(${var} "##" PARENT_SCOPE)
elseif (base STREQUAL "CMakeLists" AND extension STREQUAL ".txt")
set(${var} "##" PARENT_SCOPE)
elseif (extension STREQUAL ".txt")
set(${var} "" PARENT_SCOPE)
elseif (extension STREQUAL ".h" OR extension STREQUAL ".h.in" OR extension STREQUAL ".cxx" OR extension STREQUAL ".cu")
set(${var} "//" PARENT_SCOPE)
elseif (extension STREQUAL ".worklet")
set(${var} "//" PARENT_SCOPE)
else (extension STREQUAL ".cmake")
message(SEND_ERROR "Could not identify file type of ${filename}.")
endif (extension STREQUAL ".cmake")
endfunction(get_comment_prefix)
# Check the given file for the appropriate copyright statement.
function(check_copyright filename)
get_comment_prefix(comment_prefix "${filename}")
# Read in the first 2000 characters of the file and split into lines.
# This is roughly equivalent to the file STRINGS command except that we
# also escape semicolons (list separators) in the input, which the file
# STRINGS command does not currently do.
file(READ "${filename}" header_contents LIMIT 2000)
list_of_lines(header_lines "${header_contents}")
# Check each copyright line.
foreach (copyright_line IN LISTS COPYRIGHT_LINE_LIST)
set(match)
# My original algorithm tried to check the order by removing items from
# header_lines as they were encountered. Unfortunately, CMake 2.8's
# list REMOVE_AT command removed the escaping on the ; in one of the
# header_line's items and cause the compare to fail.
foreach (header_line IN LISTS header_lines)
if (copyright_line)
string(REGEX MATCH
"^${comment_prefix}[ \t]*${copyright_line}[ \t]*$"
match
"${header_line}"
)
else (copyright_line)
if (NOT header_line)
set(match TRUE)
endif (NOT header_line)
endif (copyright_line)
if (match)
break()
endif (match)
endforeach (header_line)
if (NOT match)
message(STATUS "Could not find match for `${copyright_line}'")
missing_copyright("${filename}" "${comment_prefix}")
endif (NOT match)
endforeach (copyright_line)
endfunction(check_copyright)
foreach (glob_expression ${FILES_TO_CHECK})
file(GLOB_RECURSE file_list
RELATIVE "${VTKm_SOURCE_DIR}"
"${VTKm_SOURCE_DIR}/${glob_expression}"
)
foreach (file ${file_list})
set(skip)
foreach(exception ${EXCEPTIONS})
if(file MATCHES "^${exception}(/.*)?$")
# This file is an exception
set(skip TRUE)
endif(file MATCHES "^${exception}(/.*)?$")
endforeach(exception)
if (NOT skip)
message("Checking ${file}")
check_copyright("${VTKm_SOURCE_DIR}/${file}")
endif (NOT skip)
endforeach (file)
endforeach (glob_expression)

@ -1,85 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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 script, which is run as part of a target, uses pyexpander to do
# macro substitution on an input file and checks the result with the
# version stored in the source code. If the versions are different, an
# error message is printed with further instructions.
#
# To use this script, the CMake variables PYTHON_EXECUTABLE PYEXPANDER_COMMAND,
# SOURCE_FILE, and GENERATED_FILE must be defined as the two files to compare.
# A ".in" is appended to SOURCE_FILE to get the pyexpander input.
if(NOT PYTHON_EXECUTABLE)
message(SEND_ERROR "Variable PYTHON_EXECUTABLE must be set.")
return()
endif()
if(NOT PYEXPANDER_COMMAND)
message(SEND_ERROR "Variable PYEXPANDER_COMMAND must be set.")
return()
endif()
if(NOT SOURCE_FILE)
message(SEND_ERROR "Variable SOURCE_FILE must be set.")
return()
endif()
if(NOT GENERATED_FILE)
message(SEND_ERROR "Variable GENERATED_FILE must be set.")
return()
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${PYEXPANDER_COMMAND} ${SOURCE_FILE}.in
RESULT_VARIABLE pyexpander_result
OUTPUT_VARIABLE pyexpander_output
)
if(pyexpander_result)
# If pyexpander returned non-zero, it failed.
message(SEND_ERROR "Running pyexpander failed (${pyexpander_result}).")
return()
endif()
file(WRITE ${GENERATED_FILE}.save "${pyexpander_output}")
execute_process(
COMMAND ${CMAKE_COMMAND} -E compare_files ${SOURCE_FILE} ${GENERATED_FILE}.save
RESULT_VARIABLE diff_result
)
if(${diff_result})
# If diff returned non-zero, it failed and the two files are different.
get_filename_component(filename ${SOURCE_FILE} NAME)
message(SEND_ERROR
"The source file ${filename} does not match the generated file. If you have modified this file directly, then you have messed up. Modify the ${filename}.in file instead and then copy the pyexpander result to ${filename}. If you modified ${filename}.in, then you might just need to copy the pyresult back to the source directory. If you have not modifed either, then you have likely checked out an inappropriate change. Check the git logs to see what changes were made.
If the changes have resulted from modifying ${filename}.in, then you can finish by moving ${GENERATED_FILE}.save over ${SOURCE_FILE}")
else()
# Now that we have done the comparison, remove the generated file so there is
# no confusion between the generated files and the source files checked into
# the repository.
file(REMOVE ${GENERATED_FILE}.save)
# Pyexpander successfully checked, so touch a file to tell make when the
# check was last successfully performed.
execute_process(
COMMAND ${CMAKE_COMMAND} -E touch ${GENERATED_FILE}.checked
)
endif()

@ -1,106 +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 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2016 UT-Battelle, LLC.
## Copyright 2016 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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 CMake script checks to make sure that each source file is explicitly
## listed in the CMakeLists.txt files. This helps ensure that all files that we
## are using are appropriately listed in IDEs and installed as necessary. It
## also helps identify dead files that should no longer be in the repository.
## To run this script, execute CMake as follows:
##
## cmake -DVTKm_SOURCE_DIR=<VTKm_SOURCE_DIR> -P <VTKm_SOURCE_DIR>/CMake/VTKMCheckSourceInBuild.cmake
##
cmake_minimum_required(VERSION 2.8)
set(FILES_TO_CHECK
*.h
*.h.in
*.cxx
*.cu
)
set(EXCEPTIONS
)
if (NOT VTKm_SOURCE_DIR)
message(SEND_ERROR "VTKm_SOURCE_DIR not defined.")
endif (NOT VTKm_SOURCE_DIR)
function(check_directory directory parent_CMakeLists_contents)
message("Checking directory ${directory}...")
get_filename_component(directory_name "${directory}" NAME)
if(EXISTS "${directory}/CMakeLists.txt")
file(READ "${directory}/CMakeLists.txt" CMakeLists_contents)
endif()
foreach (glob_expression ${FILES_TO_CHECK})
file(GLOB file_list
RELATIVE "${directory}"
"${directory}/${glob_expression}"
)
foreach (file ${file_list})
set(skip)
foreach(exception ${EXCEPTIONS})
if(file MATCHES "^${exception}(/.*)?$")
# This file is an exception
set(skip TRUE)
endif()
endforeach(exception)
if(NOT skip)
message("Checking ${file}")
# Remove .in suffix. These are generally configured files that generate
# new files that are actually used in the build.
string(REGEX REPLACE ".in$" "" file_check "${file}")
string(FIND "${CMakeLists_contents}" "${file_check}" position)
if(${position} LESS 0)
# Check the CMakeLists.txt of the parent directory. Some sources of
# internal directories are packaged into libraries in the parent
# directory.
string(FIND "${parent_CMakeLists_contents}"
"${directory_name}/${file_check}"
position
)
if(${position} LESS 0)
message(SEND_ERROR
"****************************************************************
${file_check} is not found in ${directory}/CMakeLists.txt
This indicates that the file is not part of the build system. Thus it might be missing build targets. All such files should be explicitly handled by CMake.")
endif() # Not in parent's CMakeLists.txt
endif() # Not in CMakeLists.txt
endif() # Not skipped
endforeach (file)
endforeach(glob_expression)
file(GLOB file_list
LIST_DIRECTORIES true
"${directory}/*")
foreach(file ${file_list})
if(IS_DIRECTORY "${file}")
check_directory("${file}" "${CMakeLists_contents}")
endif()
endforeach(file)
endfunction(check_directory)
check_directory("${VTKm_SOURCE_DIR}/vtkm" "")
check_directory("${VTKm_SOURCE_DIR}/examples" "")

@ -1,99 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
set(CMAKE_COMPILER_IS_PGIXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_COMPILER_IS_ICCXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_COMPILER_IS_MSVCXX 1)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
include(CheckCXXCompilerFlag)
# Standard warning flags we should always have
set(CMAKE_CXX_FLAGS_WARN " -Wall")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_WARN}")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_WARN}")
# Additional warnings for GCC/Clang
set(CMAKE_CXX_FLAGS_WARN_EXTRA "-Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common")
# Additional warnings just for Clang 3.5+, and AppleClang 7+ we specify
# for all build types, since these failures to vectorize are not limited
# to debug builds
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.4)
set(CMAKE_CXX_FLAGS "-Wno-pass-failed ${CMAKE_CXX_FLAGS}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.99)
set(CMAKE_CXX_FLAGS "-Wno-pass-failed ${CMAKE_CXX_FLAGS}")
endif()
# Set up the debug CXX_FLAGS for extra warnings
option(VTKm_EXTRA_COMPILER_WARNINGS "Add compiler flags to do stricter checking when building debug." ON)
# We used to add the compiler flags globally, but this caused problems with
# the CUDA compiler (and its lack of support for GCC pragmas). Instead,
# the vtkm_declare_headers and vtkm_unit_tests CMake functions add these flags
# to their compiles. As long as the unit tests have good coverage, this
# should catch all problems.
if(VTKm_EXTRA_COMPILER_WARNINGS)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_WARN_EXTRA}")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_WARN_EXTRA}")
endif()
elseif(CMAKE_COMPILER_IS_ICCXX)
#Intel compiler offers header level suppression in the form of
# #pragma warning(disable : 1478), but for warning 1478 it seems to not
#work. Instead we add it as a definition
add_definitions("-wd1478")
# Likewise to suppress failures about being unable to apply vectorization
# to loops, the #pragma warning(disable seems to not work so we add a
# a compile define.
add_definitions("-wd13379")
elseif (CMAKE_COMPILER_IS_MSVCXX)
#enable large object support so we can have 2^32 addressable sections
list(APPEND VTKm_COMPILE_OPTIONS "/bigobj")
# Use the highest warning level for visual c++ compiler.
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
endif()

@ -0,0 +1,119 @@
##============================================================================
## 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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(VTKM_COMPILER_IS_GNU 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(VTKM_COMPILER_IS_CLANG 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(VTKM_COMPILER_IS_CLANG 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
set(VTKM_COMPILER_IS_PGI 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(VTKM_COMPILER_IS_ICC 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(VTKM_COMPILER_IS_MSV 1)
endif()
#-----------------------------------------------------------------------------
# vtkm_compiler_flags is used by all the vtkm targets
add_library(vtkm_compiler_flags INTERFACE)
# setup that we need C++11 support
target_compile_features(vtkm_compiler_flags INTERFACE cxx_std_11)
# Enable large object support so we can have 2^32 addressable sections
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(vtkm_compiler_flags INTERFACE "/bigobj")
endif()
# Setup the include directories that are needed for vtkm
target_include_directories(vtkm_compiler_flags INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
# Todo set up PIC flags here
#INTERFACE_POSITION_INDEPENDENT_CODE
# Additional warnings just for Clang 3.5+, and AppleClang 7+ we specify
# for all build types, since these failures to vectorize are not limited
# to debug builds
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.4)
target_compile_options(vtkm_compiler_flags INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:-Wno-pass-failed>>)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.99)
target_compile_options(vtkm_compiler_flags INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:-Wno-pass-failed>>)
endif()
# When building libraries/tests that are part of the VTK-m repository
# inherit the properties from vtkm_debug_flags
target_link_libraries(vtkm_compiler_flags
INTERFACE $<BUILD_INTERFACE:vtkm_debug_flags>)
#-----------------------------------------------------------------------------
# vtkm_debug_flags is used ONLY BY libraries that are built as part of this
# repository
add_library(vtkm_debug_flags INTERFACE)
target_link_libraries(vtkm_debug_flags INTERFACE vtkm_compiler_flags)
if(VTKM_COMPILER_IS_MSVC)
target_compile_definitions(vtkm_debug_flags INTERFACE "_SCL_SECURE_NO_WARNINGS"
"_CRT_SECURE_NO_WARNINGS")
target_compile_options(vtkm_debug_flags INTERFACE -wd4702 -wd4505 -wd4512 -wd4510)
# In VS2013 the C4127 warning has a bug in the implementation and
# generates false positive warnings for lots of template code
if(MSVC_VERSION LESS 1900)
target_compile_options(vtkm_debug_flags INTERFACE -wd4127 )
endif()
elseif(VTKM_COMPILER_IS_ICC)
#Intel compiler offers header level suppression in the form of
# #pragma warning(disable : 1478), but for warning 1478 it seems to not
#work. Instead we add it as a definition
# Likewise to suppress failures about being unable to apply vectorization
# to loops, the #pragma warning(disable seems to not work so we add a
# a compile define.
target_compile_definitions(vtkm_debug_flags INTERFACE -wd1478 -wd13379)
elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG)
set(flags -Wall -Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common)
target_compile_options(vtkm_compiler_flags
INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:${flags}>>
)
endif()
install(TARGETS vtkm_compiler_flags vtkm_debug_flags EXPORT ${VTKm_EXPORT_NAME})

@ -1,178 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
#Currently all we are going to build is a set of options that are possible
#based on the compiler. For now we are going on the presumption
#that x86 architecture is the only target for vectorization and therefore
#we don't need any system detect.
#
#Here is the breakdown of what each flag type means:
#
# 1. none:
# Do not explicitly enable vectorization, but at the same don't explicitly disable
# vectorization.
#
# 2. native:
# Allow the compiler to use auto-detection based on the systems CPU to determine
# the highest level of vectorization support that is allowed. This means that
# libraries and executables built with this setting are non-portable.
#
# 3. avx
# Compile with just AVX enabled, no AVX2 or AVX512 vectorization will be used.
# This means that Sandy Bridge, Ivy Bridge, Haswell, and Skylake are supported,
# but Haswell and newer will not use any AVX2 instructions
#
# 4. avx2
# Compile with AVX2/AVX enabled, no AVX512 vectorization will be used.
# This means that Sandy Bridge, and Ivy Bridge can not run the code.
#
# 5. avx512
# Compile with AVX512/AVX2/AVX options enabled.
# This means that Sandy Bridge, Ivy Bridge, Haswell and can not run the code.
# Only XeonPhi Knights Landing and Skylake processors can run the code.
#
# AVX512 is designed to mix with avx/avx2 without any performance penalties,
# so we enable AVX2 so that we get AVX2 support for < 32bit value types which
# AVX512 has less support for
#
#
# I wonder if we should go towards a per platform cmake include that stores
# all this knowledge
# include(gcc.cmake)
# include(icc.cmake)
# include(clang.cmake)
#
# This way we could also do compile warning flag detection at the same time
#
#
# Note: By default we use 'native' as the default option
#
#
function(set_vectorization_flags_properties vec_levels_var)
set(vec_levels none native)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
#for now we presume gcc > 4.6
list(APPEND vec_levels avx)
#common flags for the avx instructions for the gcc compiler
set(native_flags -march=native)
set(avx_flags -mavx)
set(avx2_flags ${avx_flags} -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2)
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.7 OR
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7)
#if GNU is less than 4.9 you get avx, avx2
list(APPEND vec_levels avx2)
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
#if GNU is less than 5.1 you get avx, avx2, and some avx512
list(APPEND vec_levels avx2 avx512)
set(avx512_flags ${avx2_flags} -mavx512f -mavx512pf -mavx512er -mavx512cd)
else()
#if GNU is 5.1+ you get avx, avx2, and more avx512
list(APPEND vec_levels avx2 avx512)
set(avx512_flags ${avx2_flags} -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
list(APPEND vec_levels avx avx2 avx512)
set(native_flags -march=native)
set(avx_flags -mavx)
set(avx2_flags ${avx_flags} -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2)
set(avx512_flags ${avx2_flags} -mavx512)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
#While Clang support AVX512, no version of AppleClang has that support yet
list(APPEND vec_levels avx avx2)
set(native_flags -march=native)
set(avx_flags -mavx)
set(avx2_flags ${avx_flags} -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
#I can't find documentation to explicitly state the level of vectorization
#support I want from the PGI compiler
#so for now we are going to do nothing
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
#Intel 15.X is the first version with avx512
#Intel 16.X has way better vector generation compared to 15.X though
set(native_flags -xHost)
set(avx_flags -xAVX)
set(avx2_flags -xCORE-AVX2)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
message(STATUS "While Intel ICC 14.0 and lower support #pragma simd")
message(STATUS "The code that is generated in testing has caused SIGBUS")
message(STATUS "runtime signals to be thrown. We recommend you upgrade")
message(STATUS "or disable vectorization.")
elseif (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
list(APPEND vec_levels avx avx2)
else()
list(APPEND vec_levels avx avx2 avx512 knl)
set(avx512_flags -xCORE-AVX512)
set(knl_flags -xMIC-AVX512)
endif()
endif()
set_property(GLOBAL PROPERTY VTKm_NATIVE_FLAGS ${native_flags})
set_property(GLOBAL PROPERTY VTKm_AVX_FLAGS ${avx_flags})
set_property(GLOBAL PROPERTY VTKm_AVX2_FLAGS ${avx2_flags})
set_property(GLOBAL PROPERTY VTKm_AVX512_FLAGS ${avx512_flags})
set_property(GLOBAL PROPERTY VTKm_KNLAVX512_FLAGS ${knl_flags})
set(${vec_levels_var} ${vec_levels} PARENT_SCOPE)
endfunction() # set_vectorization_flags_properties
set_vectorization_flags_properties(vec_levels)
#
# Now that we have set up what levels the compiler lets setup the CMake option
# We use a combo box style property, so that ccmake and cmake-gui have a
# nice interface
#
set(VTKm_Vectorization "none" CACHE STRING "Level of compiler vectorization support")
set_property(CACHE VTKm_Vectorization PROPERTY STRINGS ${vec_levels})
if (NOT ${VTKm_Vectorization} STREQUAL "none")
set(VTKM_VECTORIZATION_ENABLED "ON")
endif()
#
# Now that we have set up the options, lets setup the compile flags that
# we are going to require.
#
set(flags)
if(VTKm_Vectorization STREQUAL "native")
get_property(flags GLOBAL PROPERTY VTKm_NATIVE_FLAGS)
elseif(VTKm_Vectorization STREQUAL "avx")
get_property(flags GLOBAL PROPERTY VTKm_AVX_FLAGS)
elseif(VTKm_Vectorization STREQUAL "avx2")
get_property(flags GLOBAL PROPERTY VTKm_AVX2_FLAGS)
elseif(VTKm_Vectorization STREQUAL "avx512")
get_property(flags GLOBAL PROPERTY VTKm_AVX512_FLAGS)
elseif(VTKm_Vectorization STREQUAL "knl")
get_property(flags GLOBAL PROPERTY VTKm_KNLAVX512_FLAGS)
endif()
#guard against adding the flags multiple times, which happens when multiple
#backends include this file
if(NOT VTKm_Vectorization_flags_added)
set(VTKm_Vectorization_flags_added true)
set_property(GLOBAL PROPERTY VTKm_Vectorization_FLAGS ${flags})
list(APPEND VTKm_COMPILE_OPTIONS ${flags})
endif()

@ -21,23 +21,19 @@
# When this file is run by CMake through the find_package command, the
# following variables will be defined:
#
# VTKm_INCLUDE_DIRS - Directories containing VTK-m and dependent headers
# VTKm_LIBRARIES - The libraries required when using VTK-m
# VTKm_COMPILE_OPTIONS - Options VTK-m suggests to add to the compiler
# vtkm Target that should be used to link to VTK-m
#
# Note that the VTK-m package supports several components. It is important
# to request the components being used (as done through find_package arguments).
# If no components are requested, then the dependent packages will not be
# found and loaded. The following components are supported:
# vtkm::tbb Target that contains tbb related link information
# implicitly linked to by `vtkm` if tbb is enabled
#
# @VTKm_AVAILABLE_COMPONENTS_LIST@
# vtkm::cuda Target that contains cuda related link information
# implicitly linked to by `vtkm` if cuda is enabled
#
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
@PACKAGE_INIT@
# The VTKm version number
set(VTKm_VERSION_MAJOR "@VTKm_VERSION_MAJOR@")
set(VTKm_VERSION_MINOR "@VTKm_VERSION_MINOR@")
@ -58,47 +54,23 @@ else()
set_and_check(VTKm_INCLUDE_DIRS "@PACKAGE_VTKm_INSTALL_INCLUDE_DIR@")
endif()
set(VTKm_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
set(VTKm_ENABLE_CUDA "@VTKm_ENABLE_CUDA@")
set(VTKm_ENABLE_TBB "@VTKm_ENABLE_TBB@")
set(VTKm_ENABLE_OSMESA "@VTKm_ENABLE_OSMESA@")
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 "@CMAKE_BINARY_DIR@")
if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "@VTKm_BINARY_DIR@")
include(${VTKm_CONFIG_DIR}/VTKmTargets.cmake)
endif()
# Clear out the libraries. We will add more when loading components.
set(VTKm_LIBRARIES)
# The VTKm variables used to configure components and packages silently.
set(VTKm_CONFIGURE_QUIET "${VTKm_FIND_QUIETLY}")
set(VTKm_FIND_PACKAGE_QUIETLY "")
if(VTKm_CONFIGURE_QUIET)
set(VTKm_FIND_PACKAGE_QUIETLY "QUIET")
endif()
# 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)
# This includes a host of functions used by VTK-m CMake.
include(VTKmWrappers)
# 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@")
# All projects using VTK-m should include the "Base" configuration (otherwise
# nothing may compile). Make sure the Base configuration is added to
# VTKm_FIND_COMPONENTS and the component is required.
set(VTKm_FIND_COMPONENTS "Base" ${VTKm_FIND_COMPONENTS})
set(VTKm_FIND_REQUIRED_Base TRUE)
# Load the selected components
@VTKm_LOAD_COMPONENTS_COMMANDS@
check_required_components(VTKm)
check_required_components(vtkm)

@ -1,418 +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 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2016 UT-Battelle, LLC.
## Copyright 2016 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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
GLFW
GLUT
Rendering
TBB
CUDA
)
#-----------------------------------------------------------------------------
# Support function for giving status messages on component configurations
#-----------------------------------------------------------------------------
set(VTKm_CONFIGURE_COMPONENT_MESSAGES "" CACHE INTERNAL "" FORCE)
function(vtkm_configure_component_message message_text)
if(NOT VTKm_CONFIGURE_QUIET)
list(FIND VTKm_CONFIGURE_COMPONENT_MESSAGES "${message_text}" in_list)
if(in_list EQUAL -1)
message(STATUS "${message_text}")
set(VTKm_CONFIGURE_COMPONENT_MESSAGES "${VTKm_CONFIGURE_COMPONENT_MESSAGES} ${message_text}"
CACHE STRING "" FORCE)
endif()
endif()
endfunction(vtkm_configure_component_message)
#-----------------------------------------------------------------------------
# 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
"IS_BACKEND"
""
"DEPENDENT_VARIABLES;ADD_INCLUDES;ADD_LIBRARIES"
${ARGN}
)
set(VTKm_${component}_FOUND TRUE)
foreach(var ${VTKm_FCC_DEPENDENT_VARIABLES})
if(NOT ${var})
set(VTKm_${component}_FOUND)
vtkm_configure_component_message(
"Failed to configure VTK-m component ${component}: !${var}")
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})
if(${VTKm_FCC_IS_BACKEND})
set(VTKm_BACKEND_INCLUDE_DIRS ${VTKm_BACKEND_INCLUDE_DIRS} ${VTKm_FCC_ADD_INCLUDES})
set(VTKm_BACKEND_LIBRARIES ${VTKm_BACKEND_LIBRARIES} ${VTKm_FCC_ADD_LIBRARIES})
endif()
endif()
endif()
endmacro()
#-----------------------------------------------------------------------------
# The configuration macros
#-----------------------------------------------------------------------------
macro(vtkm_configure_component_Base)
# Set up the compiler flag optimizations
if (NOT VTKm_Vectorization_flags_added)
include(VTKmCompilerOptimizations)
endif()
# Check for the existance of the base vtkm target
if (TARGET vtkm)
set(VTKm_base_vtkm_target_FOUND True)
endif()
vtkm_finish_configure_component(Base
DEPENDENT_VARIABLES VTKm_base_vtkm_target_FOUND
ADD_LIBRARIES vtkm vtkm_cont
)
endmacro()
macro(vtkm_configure_component_Serial)
vtkm_configure_component_Base()
vtkm_finish_configure_component(Serial
IS_BACKEND
DEPENDENT_VARIABLES VTKm_Base_FOUND
)
endmacro(vtkm_configure_component_Serial)
macro(vtkm_configure_component_OpenGL)
# OpenGL configuration "depends" on OSMesa because if OSMesa is used, then it
# (sometimes) requires its own version of OpenGL. The find_package for OpenGL
# is smart enough to configure this correctly if OSMesa is found first. Thus,
# we ensure that OSMesa is configured before OpenGL (assuming you are using
# the VTK-m configuration). However, the OpenGL configuration can still
# succeed even if the OSMesa configuration fails.
vtkm_configure_component_OSMesa()
if(NOT VTKm_OSMesa_FOUND)
find_package(OpenGL ${VTKm_FIND_PACKAGE_QUIETLY})
set(vtkm_opengl_dependent_vars VTKm_Base_FOUND OPENGL_FOUND)
set(vtkm_opengl_includes ${OPENGL_INCLUDE_DIR})
set(vtkm_opengl_libraries ${OPENGL_LIBRARIES})
else()
# OSMesa comes with its own implementation of OpenGL. So if OSMesa has been
# found, then simply report that OpenGL has been found and use the includes
# and libraries already added for OSMesa.
set(vtkm_opengl_dependent_vars)
set(vtkm_opengl_includes)
set(vtkm_opengl_libraries)
endif()
# Many OpenGL classes in VTK-m require GLEW (too many to try to separate them
# out and still get something worth using). So require that too.
find_package(GLEW ${VTKm_FIND_PACKAGE_QUIETLY})
list(APPEND vtkm_opengl_dependent_vars GLEW_FOUND)
if(GLEW_FOUND)
list(APPEND vtkm_opengl_includes ${GLEW_INCLUDE_DIRS})
list(APPEND vtkm_opengl_libraries ${GLEW_LIBRARIES})
endif()
#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)
find_package(Threads ${VTKm_FIND_PACKAGE_QUIETLY})
list(APPEND vtkm_opengl_libraries ${CMAKE_THREAD_LIBS_INIT})
endif()
vtkm_finish_configure_component(OpenGL
DEPENDENT_VARIABLES ${vtkm_opengl_dependent_vars}
ADD_INCLUDES ${vtkm_opengl_includes}
ADD_LIBRARIES ${vtkm_opengl_libraries}
)
#setting VTKm_OPENGL_INCLUDE_DIRS when both mesa and
#opengl are not present causes cmake to fail to configure
#becase of a percieved dependency in the rendering lib
if(VTKm_OSMesa_FOUND OR OPENGL_FOUND)
set(VTKm_OPENGL_INCLUDE_DIRS ${vtkm_opengl_includes})
set(VTKm_OPENGL_LIBRARIES ${vtkm_opengl_libraries})
endif()
endmacro(vtkm_configure_component_OpenGL)
macro(vtkm_configure_component_OSMesa)
vtkm_configure_component_Base()
if (VTKm_ENABLE_OSMESA)
find_package(MESA ${VTKm_FIND_PACKAGE_QUIETLY})
vtkm_finish_configure_component(OSMesa
DEPENDENT_VARIABLES OSMESA_FOUND
ADD_INCLUDES ${OSMESA_INCLUDE_DIR}
ADD_LIBRARIES ${OSMESA_LIBRARY}
)
endif()
endmacro(vtkm_configure_component_OSMesa)
macro(vtkm_configure_component_EGL)
vtkm_configure_component_OpenGL()
find_package(EGL ${VTKm_FIND_PACKAGE_QUIETLY})
vtkm_finish_configure_component(EGL
DEPENDENT_VARIABLES VTKm_OpenGL_FOUND EGL_FOUND
ADD_INCLUDES ${EGL_INCLUDE_DIRS}
ADD_LIBRARIES ${EGL_LIBRARIES}
)
endmacro(vtkm_configure_component_EGL)
macro(vtkm_configure_component_GLFW)
vtkm_configure_component_OpenGL()
find_package(GLFW ${VTKm_FIND_PACKAGE_QUIETLY})
vtkm_finish_configure_component(GLFW
DEPENDENT_VARIABLES VTKm_OpenGL_FOUND GLFW_FOUND
ADD_INCLUDES ${GLFW_INCLUDE_DIRS}
ADD_LIBRARIES ${GLFW_LIBRARIES}
)
endmacro(vtkm_configure_component_GLFW)
macro(vtkm_configure_component_GLUT)
vtkm_configure_component_OpenGL()
find_package(GLUT ${VTKm_FIND_PACKAGE_QUIETLY})
vtkm_finish_configure_component(GLUT
DEPENDENT_VARIABLES VTKm_OpenGL_FOUND GLUT_FOUND
ADD_INCLUDES ${GLUT_INCLUDE_DIR}
ADD_LIBRARIES ${GLUT_LIBRARIES}
)
endmacro(vtkm_configure_component_GLUT)
macro(vtkm_configure_component_Rendering)
if(VTKm_ENABLE_RENDERING)
vtkm_configure_component_OpenGL()
vtkm_configure_component_EGL()
vtkm_configure_component_OSMesa()
endif()
vtkm_finish_configure_component(Rendering
DEPENDENT_VARIABLES VTKm_ENABLE_RENDERING VTKm_Base_FOUND
ADD_LIBRARIES vtkm_rendering
)
endmacro(vtkm_configure_component_Rendering)
macro(vtkm_configure_component_TBB)
if(VTKm_ENABLE_TBB)
vtkm_configure_component_Base()
find_package(TBB ${VTKm_FIND_PACKAGE_QUIETLY})
endif()
vtkm_finish_configure_component(TBB
IS_BACKEND
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 ${VTKm_FIND_PACKAGE_QUIETLY})
#Make cuda link privately to cuda libraries
set(CUDA_LIBRARIES PRIVATE ${CUDA_LIBRARIES})
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_FIND_PACKAGE_QUIETLY})
endif()
vtkm_finish_configure_component(CUDA
IS_BACKEND
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 to have C++11 support
#---------------------------------------------------------------------------
if(NOT MSVC)
if(NOT "--std" IN_LIST CUDA_NVCC_FLAGS)
list(APPEND CUDA_NVCC_FLAGS --std c++11)
endif()
endif()
#---------------------------------------------------------------------------
# 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 - pascal
# - Uses: --generate-code=arch=compute_60,code=compute_60
# - Uses: --generate-code=arch=compute_61,code=compute_61
# 6 - volta
# - Uses: --generate-code=arch=compute_70,code=compute_70
# 7 - 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
# - Uses: --generate-code=arch=compute_52,code=compute_52
# - Uses: --generate-code=arch=compute_60,code=compute_60
# - Uses: --generate-code=arch=compute_61,code=compute_61
# - Uses: --generate-code=arch=compute_70,code=compute_70
#
#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 pascal volta all)
#detect what the propery is set too
if(VTKm_CUDA_Architecture STREQUAL "native")
if(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT)
#Use the cached value
list(APPEND CUDA_NVCC_FLAGS ${VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT})
else()
#run execute_process to do auto_detection
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(args "-ccbin" "${CMAKE_CXX_COMPILER}" "--run" "${VTKm_CMAKE_MODULE_PATH}/VTKmDetectCUDAVersion.cu")
elseif(CUDA_HOST_COMPILER)
set(args "-ccbin" "${CUDA_HOST_COMPILER}" "--run" "${VTKm_CMAKE_MODULE_PATH}/VTKmDetectCUDAVersion.cu")
else()
set(args "--run" "${VTKm_CMAKE_MODULE_PATH}/VTKmDetectCUDAVersion.cu")
endif()
execute_process(
COMMAND ${CUDA_NVCC_EXECUTABLE} ${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)
list(APPEND CUDA_NVCC_FLAGS ${run_output})
set(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT ${run_output} CACHE INTERNAL
"device type(s) for cuda[native]")
else()
set(VTKm_CUDA_Architecture "fermi")
vtkm_configure_component_message("Unable to run ${CUDA_NVCC_EXECUTABLE} to autodetect GPU architecture. Falling back to fermi, please manually specify if you want something else.")
endif()
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")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_20,code=compute_20")
elseif(VTKm_CUDA_Architecture STREQUAL "kepler")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_30,code=compute_30")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_35,code=compute_35")
elseif(VTKm_CUDA_Architecture STREQUAL "maxwell")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_50,code=compute_50")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_52,code=compute_52")
elseif(VTKm_CUDA_Architecture STREQUAL "pascal")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_60,code=compute_60")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_61,code=compute_61")
elseif(VTKm_CUDA_Architecture STREQUAL "volta")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_70,code=compute_70")
elseif(VTKm_CUDA_Architecture STREQUAL "all")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_20,code=compute_20")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_30,code=compute_30")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_35,code=compute_35")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_50,code=compute_50")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_52,code=compute_52")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_60,code=compute_60")
list(APPEND CUDA_NVCC_FLAGS "--generate-code=arch=compute_61,code=compute_61")
endif()
if(WIN32)
# On Windows, there is an issue with performing parallel builds with
# nvcc. Multiple compiles can attempt to write the same .pdb file. Add
# this argument to avoid this problem.
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --compiler-options /FS")
endif()
endif()
endmacro(vtkm_configure_component_CUDA)

@ -1,17 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
Copyright 2014 UT-Battelle, LLC.
Copyright 2014 Los Alamos National Security.
Under the terms of Contract DE-NA0003525 with NTESS,
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.

@ -1,60 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// 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.
//
//=============================================================================
#include <cstdio>
#include <cuda.h>
#include <cuda_runtime.h>
int main()
{
int count = 0;
if (cudaSuccess != cudaGetDeviceCount(&count))
return 1;
if (count == 0)
return 1;
int prev_arch = 0;
for (int device = 0; device < count; ++device)
{
cudaDeviceProp prop;
if (cudaSuccess == cudaGetDeviceProperties(&prop, device))
{
int arch = (prop.major * 10) + prop.minor;
int compute_level = arch;
//arch 21 has no equivalent compute level.
if (compute_level == 21)
{
compute_level = 20;
}
//handle multiple cards of the same architecture
if (arch == prev_arch)
{
continue;
}
prev_arch = arch;
//we need to print out a semi-colon as this needs to be output
//as a CMake list which is separated by semicolons
printf("--generate-code=arch=compute_%d,code=sm_%d;", compute_level, arch);
}
}
return 0;
}

@ -1,833 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
include(CMakeParseArguments)
# Utility to build a kit name from the current directory.
function(vtkm_get_kit_name kitvar)
# Will this always work? It should if ${CMAKE_CURRENT_SOURCE_DIR} is
# built from ${VTKm_SOURCE_DIR}.
string(REPLACE "${VTKm_SOURCE_DIR}/" "" dir_prefix ${CMAKE_CURRENT_SOURCE_DIR})
string(REPLACE "/" "_" kit "${dir_prefix}")
set(${kitvar} "${kit}" PARENT_SCOPE)
# Optional second argument to get dir_prefix.
if (${ARGC} GREATER 1)
set(${ARGV1} "${dir_prefix}" PARENT_SCOPE)
endif (${ARGC} GREATER 1)
endfunction(vtkm_get_kit_name)
#Utility to setup nvcc flags so that we properly work around issues inside FindCUDA.
#if we are generating cu files need to setup four things.
#1. Explicitly set the cuda device adapter as a define this is currently
# done as a work around since the cuda executable ignores compile
# definitions
#2. Disable unused function warnings
# the FindCUDA module and helper methods don't read target level
# properties so we have to modify CUDA_NVCC_FLAGS instead of using
# target and source level COMPILE_FLAGS and COMPILE_DEFINITIONS
#3. Set the compile option /bigobj when using VisualStudio generators
# While we have specified this as target compile flag, those aren't
# currently loooked at by FindCUDA, so we have to manually add it ourselves
function(vtkm_setup_nvcc_flags old_nvcc_flags old_cxx_flags )
set(${old_nvcc_flags} ${CUDA_NVCC_FLAGS} PARENT_SCOPE)
set(${old_nvcc_flags} ${CMAKE_CXX_FLAGS} PARENT_SCOPE)
set(new_nvcc_flags ${CUDA_NVCC_FLAGS})
set(new_cxx_flags ${CMAKE_CXX_FLAGS})
list(APPEND new_nvcc_flags "-DVTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_CUDA")
list(APPEND new_nvcc_flags "-w")
if(MSVC)
list(APPEND new_nvcc_flags "--compiler-options;/bigobj")
# The MSVC compiler gives a warning about having two incompatiable warning
# flags in the command line. So, ironically, adding -w above to remove
# warnings makes MSVC give a warning. To get around that, remove all
# warning flags from the standard CXX arguments (which are typically passed
# to the CUDA compiler).
string(REGEX REPLACE "[-/]W[1-4]" "" new_cxx_flags "${new_cxx_flags}")
string(REGEX REPLACE "[-/]Wall" "" new_cxx_flags "${new_cxx_flags}")
endif()
set(CUDA_NVCC_FLAGS ${new_nvcc_flags} PARENT_SCOPE)
set(CMAKE_CXX_FLAGS ${new_cxx_flags} PARENT_SCOPE)
endfunction(vtkm_setup_nvcc_flags)
#Utility to set MSVC only COMPILE_DEFINITIONS and COMPILE_FLAGS needed to
#reduce number of warnings and compile issues with Visual Studio
function(vtkm_setup_msvc_properties target )
if(NOT MSVC)
return()
endif()
#disable MSVC CRT and SCL warnings as they recommend using non standard
#c++ extensions
target_compile_definitions(${target} PRIVATE "_SCL_SECURE_NO_WARNINGS"
"_CRT_SECURE_NO_WARNINGS")
#C4702 Generates numerous false positives with template code about
# unreachable code
#C4505 Generates numerous warnings about unused functions being
# removed when doing header test builds.
target_compile_options(${target} PRIVATE -wd4702 -wd4505)
# In VS2013 the C4127 warning has a bug in the implementation and
# generates false positive warnings for lots of template code
if(MSVC_VERSION LESS 1900)
target_compile_options(${target} PRIVATE -wd4127 )
endif()
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)
set(hfiles ${ARGN})
if (use_cuda)
set(suffix ".cu")
else (use_cuda)
set(suffix ".cxx")
endif (use_cuda)
set(cxxfiles)
foreach (header ${ARGN})
get_source_file_property(cant_be_tested ${header} VTKm_CANT_BE_HEADER_TESTED)
if( NOT cant_be_tested )
string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}" "" header "${header}")
get_filename_component(headername ${header} NAME_WE)
set(src ${CMAKE_CURRENT_BINARY_DIR}/TB_${headername}${suffix})
configure_file(${VTKm_SOURCE_DIR}/CMake/TestBuild.cxx.in ${src} @ONLY)
list(APPEND cxxfiles ${src})
endif()
endforeach (header)
#only attempt to add a test build executable if we have any headers to
#test. this might not happen when everything depends on thrust.
list(LENGTH cxxfiles cxxfiles_len)
if (use_cuda AND ${cxxfiles_len} GREATER 0)
vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags )
# Cuda compiles do not respect target_include_directories
# and we want system includes so we have to hijack cuda
# to do it
foreach(dir ${VTKm_INCLUDE_DIRS})
#this internal variable has changed names depending on the CMake ver
list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER -isystem ${dir})
list(APPEND CUDA_NVCC_INCLUDE_DIRS_USER -isystem ${dir})
endforeach()
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_INCLUDE_DIR}
)
cuda_add_library(TestBuild_${name} STATIC ${cxxfiles} ${hfiles})
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
elseif (${cxxfiles_len} GREATER 0)
add_library(TestBuild_${name} STATIC ${cxxfiles} ${hfiles})
target_include_directories(TestBuild_${name} PRIVATE vtkm ${VTKm_INCLUDE_DIRS})
endif ()
target_link_libraries(TestBuild_${name} PRIVATE vtkm_cont ${VTKm_LIBRARIES})
set_source_files_properties(${hfiles}
PROPERTIES HEADER_FILE_ONLY TRUE
)
vtkm_setup_msvc_properties(TestBuild_${name})
# Send the libraries created for test builds to their own directory so as to
# not polute the directory with useful libraries.
set_target_properties(TestBuild_${name} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
RUNTIME_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
)
endfunction(vtkm_add_header_build_test)
function(vtkm_install_headers dir_prefix)
set(hfiles ${ARGN})
install(FILES ${hfiles}
DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${dir_prefix}
)
endfunction(vtkm_install_headers)
function(vtkm_install_template_sources)
vtkm_get_kit_name(name dir_prefix)
set(hfiles ${ARGN})
vtkm_install_headers("${dir_prefix}" ${hfiles})
# CMake does not add installed files as project files, and template sources
# are not declared as source files anywhere, add a fake target here to let
# an IDE know that these sources exist.
add_custom_target(${name}_template_srcs SOURCES ${hfiles})
endfunction(vtkm_install_template_sources)
# Declare a list of headers that require thrust to be enabled
# for them to header tested. In cases of thrust version 1.5 or less
# we have to make sure openMP is enabled, otherwise we are okay
function(vtkm_requires_thrust_to_test)
#determine the state of thrust and testing
set(cant_be_tested FALSE)
if(NOT VTKm_ENABLE_THRUST)
#mark as not valid
set(cant_be_tested TRUE)
elseif(NOT VTKm_ENABLE_OPENMP)
#mark also as not valid
set(cant_be_tested TRUE)
endif()
foreach(header ${ARGN})
#set a property on the file that marks if we can header test it
set_source_files_properties( ${header}
PROPERTIES VTKm_CANT_BE_HEADER_TESTED ${cant_be_tested} )
endforeach(header)
endfunction(vtkm_requires_thrust_to_test)
# Declare a list of header files. Will make sure the header files get
# compiled and show up in an IDE.
function(vtkm_declare_headers)
set(options CUDA)
set(oneValueArgs TESTABLE)
set(multiValueArgs)
cmake_parse_arguments(VTKm_DH "${options}"
"${oneValueArgs}" "${multiValueArgs}"
${ARGN}
)
#The testable keyword allows the caller to turn off the header testing,
#mainly used so that backends can be installed even when they can't be
#built on the machine.
#Since this is an optional property not setting it means you do want testing
if(NOT DEFINED VTKm_DH_TESTABLE)
set(VTKm_DH_TESTABLE ON)
endif()
set(hfiles ${VTKm_DH_UNPARSED_ARGUMENTS})
vtkm_get_kit_name(name dir_prefix)
#only do header testing if enable testing is turned on
if (VTKm_ENABLE_TESTING AND VTKm_DH_TESTABLE)
vtkm_add_header_build_test(
"${name}" "${dir_prefix}" "${VTKm_DH_CUDA}" ${hfiles})
endif()
#always install headers
vtkm_install_headers("${dir_prefix}" ${hfiles})
endfunction(vtkm_declare_headers)
# Declare a list of worklet files.
function(vtkm_declare_worklets)
# Currently worklets are just really header files.
vtkm_declare_headers(${ARGN})
endfunction(vtkm_declare_worklets)
function(vtkm_pyexpander_generated_file generated_file_name)
# If pyexpander is available, add targets to build and check
if(PYEXPANDER_FOUND AND PYTHONINTERP_FOUND)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name}.checked
COMMAND ${CMAKE_COMMAND}
-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
-DPYEXPANDER_COMMAND=${PYEXPANDER_COMMAND}
-DSOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name}
-DGENERATED_FILE=${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name}
-P ${CMAKE_SOURCE_DIR}/CMake/VTKmCheckPyexpander.cmake
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name}.in
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name}
COMMENT "Checking validity of ${generated_file_name}"
)
add_custom_target(check_${generated_file_name} ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name}.checked
)
endif()
endfunction(vtkm_pyexpander_generated_file)
# Declare unit tests, which should be in the same directory as a kit
# (package, module, whatever you call it). Usage:
#
# vtkm_unit_tests(
# SOURCES <source_list>
# LIBRARIES <dependent_library_list>
# TEST_ARGS <argument_list>
# )
function(vtkm_unit_tests)
set(options CUDA)
set(oneValueArgs)
set(multiValueArgs SOURCES LIBRARIES TEST_ARGS)
cmake_parse_arguments(VTKm_UT
"${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN}
)
if (VTKm_ENABLE_TESTING)
vtkm_get_kit_name(kit)
#we use UnitTests_ so that it is an unique key to exclude from coverage
set(test_prog UnitTests_${kit})
create_test_sourcelist(TestSources ${test_prog}.cxx ${VTKm_UT_SOURCES})
#determine the timeout for all the tests based on the backend. CUDA tests
#generally require more time because of kernel generation.
set(timeout 180)
if (VTKm_UT_CUDA)
set(timeout 1500)
endif()
if (VTKm_UT_CUDA)
vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags )
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_INCLUDE_DIRS}
)
cuda_add_executable(${test_prog} ${TestSources})
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
else (VTKm_UT_CUDA)
add_executable(${test_prog} ${TestSources})
endif (VTKm_UT_CUDA)
set_target_properties(${test_prog} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
)
#do it as a property value so we don't pollute the include_directories
#for any other targets
target_include_directories(${test_prog} PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(${test_prog} PRIVATE vtkm_cont ${VTKm_LIBRARIES})
target_compile_options(${test_prog} PRIVATE ${VTKm_COMPILE_OPTIONS})
vtkm_setup_msvc_properties(${test_prog})
foreach (test ${VTKm_UT_SOURCES})
get_filename_component(tname ${test} NAME_WE)
add_test(NAME ${tname}
COMMAND ${test_prog} ${tname} ${VTKm_UT_TEST_ARGS}
)
set_tests_properties("${tname}" PROPERTIES TIMEOUT ${timeout})
endforeach (test)
endif (VTKm_ENABLE_TESTING)
endfunction(vtkm_unit_tests)
# Save the worklets to test with each device adapter
# Usage:
#
# vtkm_save_worklet_unit_tests( sources )
#
# notes: will save the sources absolute path as the
# vtkm_source_worklet_unit_tests global property
function(vtkm_save_worklet_unit_tests )
#create the test driver when we are called, since
#the test driver expect the test files to be in the same
#directory as the test driver
create_test_sourcelist(test_sources WorkletTestDriver.cxx ${ARGN})
#store the absolute path for the test drive and all the test
#files
set(driver ${CMAKE_CURRENT_BINARY_DIR}/WorkletTestDriver.cxx)
set(cxx_sources)
set(cu_sources)
#we need to store the absolute source for the file so that
#we can properly compile it into the test driver. At
#the same time we want to configure each file into the build
#directory as a .cu file so that we can compile it with cuda
#if needed
foreach(fname ${ARGN})
set(absPath)
get_filename_component(absPath ${fname} ABSOLUTE)
get_filename_component(file_name_only ${fname} NAME_WE)
set(cuda_file_name "${CMAKE_CURRENT_BINARY_DIR}/${file_name_only}.cu")
configure_file("${absPath}"
"${cuda_file_name}"
COPYONLY)
list(APPEND cxx_sources ${absPath})
list(APPEND cu_sources ${cuda_file_name})
endforeach()
#we create a property that holds all the worklets to test,
#but don't actually attempt to create a unit test with the yet.
#That is done by each device adapter
set_property( GLOBAL APPEND
PROPERTY vtkm_worklet_unit_tests_sources ${cxx_sources})
set_property( GLOBAL APPEND
PROPERTY vtkm_worklet_unit_tests_cu_sources ${cu_sources})
set_property( GLOBAL APPEND
PROPERTY vtkm_worklet_unit_tests_drivers ${driver})
endfunction(vtkm_save_worklet_unit_tests)
# Call each worklet test for the given device adapter
# Usage:
#
# vtkm_worklet_unit_tests( device_adapter )
#
# notes: will look for the vtkm_source_worklet_unit_tests global
# property to find what are the worklet unit tests that need to be
# compiled for the give device adapter
function(vtkm_worklet_unit_tests device_adapter)
set(unit_test_srcs)
get_property(unit_test_srcs GLOBAL
PROPERTY vtkm_worklet_unit_tests_sources )
set(unit_test_drivers)
get_property(unit_test_drivers GLOBAL
PROPERTY vtkm_worklet_unit_tests_drivers )
#detect if we are generating a .cu files
set(is_cuda FALSE)
if("${device_adapter}" STREQUAL "VTKM_DEVICE_ADAPTER_CUDA")
set(is_cuda TRUE)
endif()
#determine the timeout for all the tests based on the backend. The first CUDA
#worklet test requires way more time because of the overhead to allow the
#driver to convert the kernel code from virtual arch to actual arch.
#
set(timeout 180)
if(is_cuda)
set(timeout 1500)
endif()
if(VTKm_ENABLE_TESTING)
string(REPLACE "VTKM_DEVICE_ADAPTER_" "" device_type ${device_adapter})
vtkm_get_kit_name(kit)
#inject the device adapter into the test program name so each one is unique
set(test_prog WorkletTests_${device_type})
if(is_cuda)
get_property(unit_test_srcs GLOBAL PROPERTY vtkm_worklet_unit_tests_cu_sources )
vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags )
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_INCLUDE_DIRS}
)
cuda_add_executable(${test_prog} ${unit_test_drivers} ${unit_test_srcs})
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
else()
add_executable(${test_prog} ${unit_test_drivers} ${unit_test_srcs})
endif()
set_target_properties(${test_prog} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
)
target_include_directories(${test_prog} PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(${test_prog} PRIVATE vtkm_cont ${VTKm_LIBRARIES})
#add the specific compile options for this executable
target_compile_options(${test_prog} PRIVATE ${VTKm_COMPILE_OPTIONS})
#add a test for each worklet test file. We will inject the device
#adapter type into the test name so that it is easier to see what
#exact device a test is failing on.
foreach (test ${unit_test_srcs})
get_filename_component(tname ${test} NAME_WE)
add_test(NAME "${tname}${device_type}"
COMMAND ${test_prog} ${tname}
)
set_tests_properties("${tname}${device_type}" PROPERTIES TIMEOUT ${timeout})
endforeach (test)
vtkm_setup_msvc_properties(${test_prog})
#set the device adapter on the executable
target_compile_definitions(${test_prog} PRIVATE "VTKM_DEVICE_ADAPTER=${device_adapter}")
endif()
endfunction(vtkm_worklet_unit_tests)
# Save the benchmarks to run with each device adapter
# This is based on vtkm_save_worklet_unit_tests
# Usage:
#
# vtkm_save_benchmarks( <sources> [HEADERS <headers>] )
#
#
# Each benchmark source file needs to implement main(int agrc, char *argv[])
#
# notes: will save the sources absolute path as the
# vtkm_benchmarks_sources global property
function(vtkm_save_benchmarks)
#store the absolute path for all the test files
set(cxx_sources)
set(cu_sources)
cmake_parse_arguments(save_benchmarks "" "" "HEADERS" ${ARGN})
#we need to store the absolute source for the file so that
#we can properly compile it into the benchmark driver. At
#the same time we want to configure each file into the build
#directory as a .cu file so that we can compile it with cuda
#if needed
foreach(fname ${save_benchmarks_UNPARSED_ARGUMENTS})
set(absPath)
get_filename_component(absPath ${fname} ABSOLUTE)
get_filename_component(file_name_only ${fname} NAME_WE)
set(cuda_file_name "${CMAKE_CURRENT_BINARY_DIR}/${file_name_only}.cu")
configure_file("${absPath}"
"${cuda_file_name}"
COPYONLY)
list(APPEND cxx_sources ${absPath})
list(APPEND cu_sources ${cuda_file_name})
endforeach()
#we create a property that holds all the worklets to test,
#but don't actually attempt to create a unit test with the yet.
#That is done by each device adapter
set_property( GLOBAL APPEND
PROPERTY vtkm_benchmarks_sources ${cxx_sources})
set_property( GLOBAL APPEND
PROPERTY vtkm_benchmarks_cu_sources ${cu_sources})
set_property( GLOBAL APPEND
PROPERTY vtkm_benchmarks_headers ${save_benchmarks_HEADERS})
endfunction(vtkm_save_benchmarks)
# Call each benchmark for the given device adapter
# Usage:
#
# vtkm_benchmark( device_adapter )
#
# notes: will look for the vtkm_benchmarks_sources global
# property to find what are the benchmarks that need to be
# compiled for the give device adapter
function(vtkm_benchmarks device_adapter)
set(benchmark_srcs)
get_property(benchmark_srcs GLOBAL
PROPERTY vtkm_benchmarks_sources )
set(benchmark_headers)
get_property(benchmark_headers GLOBAL
PROPERTY vtkm_benchmarks_headers )
#detect if we are generating a .cu files
set(is_cuda FALSE)
set(old_nvcc_flags ${CUDA_NVCC_FLAGS})
set(old_cxx_flags ${CMAKE_CXX_FLAGS})
if("${device_adapter}" STREQUAL "VTKM_DEVICE_ADAPTER_CUDA")
set(is_cuda TRUE)
endif()
if(VTKm_ENABLE_BENCHMARKS)
string(REPLACE "VTKM_DEVICE_ADAPTER_" "" device_type ${device_adapter})
if(is_cuda)
vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags )
get_property(benchmark_srcs GLOBAL PROPERTY vtkm_benchmarks_cu_sources )
endif()
foreach( file ${benchmark_srcs})
#inject the device adapter into the benchmark program name so each one is unique
get_filename_component(benchmark_prog ${file} NAME_WE)
set(benchmark_prog "${benchmark_prog}_${device_type}")
if(is_cuda)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_BACKEND_INCLUDE_DIRS}
)
cuda_add_executable(${benchmark_prog} ${file} ${benchmark_headers})
else()
add_executable(${benchmark_prog} ${file} ${benchmark_headers})
endif()
set_target_properties(${benchmark_prog} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
)
set_source_files_properties(${benchmark_headers}
PROPERTIES HEADER_FILE_ONLY TRUE)
target_include_directories(${benchmark_prog} PRIVATE ${VTKm_BACKEND_INCLUDE_DIRS})
target_link_libraries(${benchmark_prog} PRIVATE vtkm_cont ${VTKm_BACKEND_LIBRARIES})
vtkm_setup_msvc_properties(${benchmark_prog})
#add the specific compile options for this executable
target_compile_options(${benchmark_prog} PRIVATE ${VTKm_COMPILE_OPTIONS})
#set the device adapter on the executable
target_compile_definitions(${benchmark_prog} PRIVATE "VTKM_DEVICE_ADAPTER=${device_adapter}")
endforeach()
if(is_cuda)
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
endif()
endif()
endfunction(vtkm_benchmarks)
# Given a list of *.cxx source files that during configure time are deterimined
# to have CUDA code, wrap the sources in *.cu files so that they get compiled
# with nvcc.
function(vtkm_wrap_sources_for_cuda cuda_source_list_var)
set(original_sources ${ARGN})
set(cuda_sources)
foreach(source_file ${original_sources})
get_filename_component(source_name ${source_file} NAME_WE)
get_filename_component(source_file_path ${source_file} ABSOLUTE)
set(wrapped_file ${CMAKE_CURRENT_BINARY_DIR}/${source_name}.cu)
configure_file(
${VTKm_SOURCE_DIR}/CMake/WrapCUDASource.cu.in
${wrapped_file}
@ONLY)
list(APPEND cuda_sources ${wrapped_file})
endforeach(source_file)
# Set original sources as header files (which they basically are) so that
# we can add them to the file list and they will show up in IDE but they will
# not be compiled separately.
set_source_files_properties(${original_sources}
PROPERTIES HEADER_FILE_ONLY TRUE
)
set(${cuda_source_list_var} ${cuda_sources} ${original_sources} PARENT_SCOPE)
endfunction(vtkm_wrap_sources_for_cuda)
# Add a VTK-m library. The name of the library will match the "kit" name
# (e.g. vtkm_rendering) unless the NAME argument is given.
#
# vtkm_library(
# [NAME <name>]
# SOURCES <source_list>
# [HEADERS <headers_list>]
# [CUDA]
# [WRAP_FOR_CUDA <source_list>]
# [LIBRARIES <dependent_library_list>]
# )
function(vtkm_library)
set(options CUDA)
set(oneValueArgs NAME)
set(multiValueArgs SOURCES HEADERS WRAP_FOR_CUDA)
cmake_parse_arguments(VTKm_LIB
"${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN}
)
vtkm_get_kit_name(kit dir_prefix)
if(VTKm_LIB_NAME)
set(lib_name ${VTKm_LIB_NAME})
else()
set(lib_name ${kit})
endif()
list(APPEND VTKm_LIB_SOURCES ${VTKm_LIB_HEADERS})
set_source_files_properties(${VTKm_LIB_HEADERS}
PROPERTIES HEADER_FILE_ONLY TRUE
)
if(VTKm_LIB_WRAP_FOR_CUDA)
if(VTKm_ENABLE_CUDA)
# If we have some sources marked as WRAP_FOR_CUDA and we support CUDA,
# then we need to turn on CDUA, wrap those sources, and add the wrapped
# code to the sources list.
set(VTKm_LIB_CUDA TRUE)
vtkm_wrap_sources_for_cuda(cuda_sources ${VTKm_LIB_WRAP_FOR_CUDA})
list(APPEND VTKm_LIB_SOURCES ${cuda_sources})
else()
# If we have some sources marked as WRAP_FOR_CUDA but we do not support
# CUDA, then just compile these sources normally by adding them to the
# sources list.
list(APPEND VTKm_LIB_SOURCES ${VTKm_LIB_WRAP_FOR_CUDA})
endif()
endif()
if(VTKm_LIB_CUDA)
vtkm_setup_nvcc_flags(old_nvcc_flags old_cxx_flags)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_SOURCE_DIR}
${VTKm_BINARY_INCLUDE_DIR}
${VTKm_BACKEND_INCLUDE_DIRS}
)
if(BUILD_SHARED_LIBS AND NOT WIN32)
set(compile_options -Xcompiler=${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY}hidden)
endif()
cuda_add_library(${lib_name} ${VTKm_LIB_SOURCES}
OPTIONS "${compile_options}")
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
else()
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}
${VTKm_LIB_LIBRARIES}
)
set(cxx_args ${VTKm_COMPILE_OPTIONS})
separate_arguments(cxx_args)
target_compile_options(${lib_name} PRIVATE ${cxx_args})
# Make sure libraries go to lib directory and dll go to bin directory.
# Mostly important on Windows.
set_target_properties(${lib_name} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
)
vtkm_setup_msvc_properties(${lib_name})
if(VTKm_EXTRA_COMPILER_WARNINGS)
set(cxx_args ${CMAKE_CXX_FLAGS_WARN_EXTRA})
separate_arguments(cxx_args)
target_compile_options(${lib_name}
PRIVATE ${cxx_args}
)
endif(VTKm_EXTRA_COMPILER_WARNINGS)
#Now generate a header that holds the macros needed to easily export
#template classes. This
string(TOUPPER ${lib_name} BASE_NAME_UPPER)
set(EXPORT_MACRO_NAME "${BASE_NAME_UPPER}")
set(EXPORT_IS_BUILT_STATIC 0)
get_target_property(is_static ${lib_name} TYPE)
if(${is_static} STREQUAL "STATIC_LIBRARY")
#If we are building statically set the define symbol
set(EXPORT_IS_BUILT_STATIC 1)
endif()
unset(is_static)
get_target_property(EXPORT_IMPORT_CONDITION ${lib_name} DEFINE_SYMBOL)
if(NOT EXPORT_IMPORT_CONDITION)
#set EXPORT_IMPORT_CONDITION to what the DEFINE_SYMBOL would be when
#building shared
set(EXPORT_IMPORT_CONDITION ${lib_name}_EXPORTS)
endif()
configure_file(
${VTKm_SOURCE_DIR}/CMake/VTKmExportHeaderTemplate.h.in
${VTKm_BINARY_INCLUDE_DIR}/${dir_prefix}/${lib_name}_export.h
@ONLY)
unset(EXPORT_MACRO_NAME)
unset(EXPORT_IS_BUILT_STATIC)
unset(EXPORT_IMPORT_CONDITION)
install(TARGETS ${lib_name}
EXPORT ${VTKm_EXPORT_NAME}
ARCHIVE DESTINATION ${VTKm_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${VTKm_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${VTKm_INSTALL_BIN_DIR}
)
vtkm_install_headers("${dir_prefix}"
${VTKm_BINARY_INCLUDE_DIR}/${dir_prefix}/${lib_name}_export.h
${VTKm_LIB_HEADERS}
)
endfunction(vtkm_library)
# The Thrust project is not as careful as the VTKm project in avoiding warnings
# on shadow variables and unused arguments. With a real GCC compiler, you
# can disable these warnings inline, but with something like nvcc, those
# pragmas cause errors. Thus, this macro will disable the compiler warnings.
macro(vtkm_disable_troublesome_thrust_warnings)
vtkm_disable_troublesome_thrust_warnings_var(CMAKE_CXX_FLAGS_DEBUG)
vtkm_disable_troublesome_thrust_warnings_var(CMAKE_CXX_FLAGS_MINSIZEREL)
vtkm_disable_troublesome_thrust_warnings_var(CMAKE_CXX_FLAGS_RELEASE)
vtkm_disable_troublesome_thrust_warnings_var(CMAKE_CXX_FLAGS_RELWITHDEBINFO)
endmacro(vtkm_disable_troublesome_thrust_warnings)
macro(vtkm_disable_troublesome_thrust_warnings_var flags_var)
set(old_flags "${${flags_var}}")
string(REPLACE "-Wshadow" "" new_flags "${old_flags}")
string(REPLACE "-Wunused-parameter" "" new_flags "${new_flags}")
string(REPLACE "-Wunused" "" new_flags "${new_flags}")
string(REPLACE "-Wextra" "" new_flags "${new_flags}")
string(REPLACE "-Wall" "" new_flags "${new_flags}")
set(${flags_var} "${new_flags}")
endmacro(vtkm_disable_troublesome_thrust_warnings_var)
include(VTKmConfigureComponents)

@ -1,70 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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 script is used to create the SystemInformation test. The test always
# passes. It just captures in its output the configuration of the system.
# This allows you to inspect the configuration of the system of a failed
# dashboard in case you don't have access to that dashboard.
#
# This script is called with a command like:
#
# cmake -D VTKm_BINARY_DIR=<top-of-build-tree> -D VTKm_SOURCE_DIR=<top-of-source-tree> -P <this-script>
#
set(FILES
vtkm/internal/Configure.h
CMakeCache.txt
CMakeFiles/CMakeError.log
)
function(print_file filename)
set(full_filename "${VTKm_BINARY_DIR}/${filename}")
message("
==============================================================================
Contents of \"${filename}\":
------------------------------------------------------------------------------")
if(EXISTS "${full_filename}")
file(READ ${full_filename} contents)
message("${contents}")
else()
message("The file \"${full_filename}\" does not exist.")
endif()
endfunction(print_file)
message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
execute_process(
COMMAND git rev-parse -q HEAD
WORKING_DIRECTORY "${VTKm_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA
)
message("
==============================================================================
git SHA: ${GIT_SHA}")
foreach(filename ${FILES})
print_file(${filename})
endforeach()

272
CMake/VTKmWrappers.cmake Normal file

@ -0,0 +1,272 @@
##============================================================================
## 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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
include(CMakeParseArguments)
include(VTKmBackends)
#-----------------------------------------------------------------------------
# Utility to build a kit name from the current directory.
function(vtkm_get_kit_name kitvar)
# Will this always work? It should if ${CMAKE_CURRENT_SOURCE_DIR} is
# built from ${VTKm_SOURCE_DIR}.
string(REPLACE "${VTKm_SOURCE_DIR}/" "" dir_prefix ${CMAKE_CURRENT_SOURCE_DIR})
string(REPLACE "/" "_" kit "${dir_prefix}")
set(${kitvar} "${kit}" PARENT_SCOPE)
# Optional second argument to get dir_prefix.
if (${ARGC} GREATER 1)
set(${ARGV1} "${dir_prefix}" PARENT_SCOPE)
endif (${ARGC} GREATER 1)
endfunction(vtkm_get_kit_name)
#-----------------------------------------------------------------------------
function(vtkm_pyexpander_generated_file)
#This should go in a separate cmake file
endfunction(vtkm_pyexpander_generated_file)
#-----------------------------------------------------------------------------
function(vtkm_generate_export_header lib_name)
# Get the location of this library in the directory structure
# export headers work on the directory structure more than the lib_name
vtkm_get_kit_name(kit_name dir_prefix)
# Now generate a header that holds the macros needed to easily export
# template classes. This
string(TOUPPER ${kit_name} BASE_NAME_UPPER)
set(EXPORT_MACRO_NAME "${BASE_NAME_UPPER}")
set(EXPORT_IS_BUILT_STATIC 0)
get_target_property(is_static ${lib_name} TYPE)
if(${is_static} STREQUAL "STATIC_LIBRARY")
#If we are building statically set the define symbol
set(EXPORT_IS_BUILT_STATIC 1)
endif()
unset(is_static)
get_target_property(EXPORT_IMPORT_CONDITION ${lib_name} DEFINE_SYMBOL)
if(NOT EXPORT_IMPORT_CONDITION)
#set EXPORT_IMPORT_CONDITION to what the DEFINE_SYMBOL would be when
#building shared
set(EXPORT_IMPORT_CONDITION ${kit_name}_EXPORTS)
endif()
configure_file(
${VTKm_SOURCE_DIR}/cmake/VTKmExportHeaderTemplate.h.in
${VTKm_BINARY_DIR}/include/${dir_prefix}/${kit_name}_export.h
@ONLY)
install(FILES ${VTKm_BINARY_DIR}/include/${dir_prefix}/${kit_name}_export.h
DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${dir_prefix}
)
endfunction(vtkm_generate_export_header)
function(vtkm_install_headers dir_prefix)
set(hfiles ${ARGN})
install(FILES ${hfiles}
DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${dir_prefix}
)
endfunction(vtkm_install_headers)
#-----------------------------------------------------------------------------
function(vtkm_declare_headers)
#TODO: look at the testable and cuda options
set(options CUDA)
set(oneValueArgs TESTABLE)
set(multiValueArgs)
cmake_parse_arguments(VTKm_DH "${options}"
"${oneValueArgs}" "${multiValueArgs}"
${ARGN}
)
set(hfiles ${VTKm_DH_UNPARSED_ARGUMENTS})
vtkm_get_kit_name(name dir_prefix)
vtkm_install_headers("${dir_prefix}" ${hfiles})
endfunction(vtkm_declare_headers)
#-----------------------------------------------------------------------------
function(vtkm_install_template_sources)
set(hfiles ${ARGN})
vtkm_get_kit_name(name dir_prefix)
# CMake does not add installed files as project files, and template sources
# are not declared as source files anywhere, add a fake target here to let
# an IDE know that these sources exist.
add_custom_target(${name}_template_srcs SOURCES ${hfiles})
vtkm_install_headers("${dir_prefix}" ${hfiles})
endfunction(vtkm_install_template_sources)
#-----------------------------------------------------------------------------
# Add a VTK-m library. The name of the library will match the "kit" name
# (e.g. vtkm_rendering) unless the NAME argument is given.
#
# vtkm_library(
# [NAME <name>]
# SOURCES <source_list>
# TEMPLATE_SOURCES <.hxx >
# HEADERS <header list>
# [WRAP_FOR_CUDA <source_list>]
# )
function(vtkm_library)
set(oneValueArgs NAME)
set(multiValueArgs SOURCES HEADERS TEMPLATE_SOURCES WRAP_FOR_CUDA)
cmake_parse_arguments(VTKm_LIB
"${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN}
)
if(NOT VTKm_LIB_NAME)
message(FATAL_ERROR "vtkm library must have an explicit name")
endif()
set(lib_name ${VTKm_LIB_NAME})
if(VTKm_ENABLE_CUDA)
set_source_files_properties(${VTKm_LIB_WRAP_FOR_CUDA} LANGUAGE "CUDA")
endif()
add_library(${lib_name}
${VTKm_LIB_SOURCES}
${VTKm_LIB_HEADERS}
${VTKm_LIB_TEMPLATE_SOURCES}
${VTKm_LIB_WRAP_FOR_CUDA}
)
set_target_properties(${lib_name}
PROPERTIES
CXX_VISIBILITY_PRESET "hidden")
vtkm_generate_export_header(${lib_name})
install(TARGETS ${lib_name}
EXPORT ${VTKm_EXPORT_NAME}
ARCHIVE DESTINATION ${VTKm_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${VTKm_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${VTKm_INSTALL_BIN_DIR}
)
#test and install the headers
vtkm_declare_headers(${VTKm_LIB_HEADERS})
#install the template sources
vtkm_install_template_sources(${VTKm_LIB_TEMPLATE_SOURCES})
endfunction(vtkm_library)
#-----------------------------------------------------------------------------
# Declare unit tests, which should be in the same directory as a kit
# (package, module, whatever you call it). Usage:
#
# [CUDA]: mark all source files as being compiled with the cuda compiler
# [BACKEND]: mark all source files as being compiled with the proper defines
# to make this backend the default backend
# If the backend is specified as CUDA it will also imply all
# sources should be treated as CUDA sources
# The backend name will also be added to the executable name
# so you can test multiple backends easily
# vtkm_unit_tests(
# NAME
# CUDA
# SOURCES <source_list>
# BACKEND <type>
# LIBRARIES <dependent_library_list>
# TEST_ARGS <argument_list>
# )
function(vtkm_unit_tests)
set(options CUDA NO_TESTS)
set(oneValueArgs BACKEND NAME)
set(multiValueArgs SOURCES LIBRARIES TEST_ARGS)
cmake_parse_arguments(VTKm_UT
"${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN}
)
if (NOT VTKm_ENABLE_TESTING)
return()
endif()
set(backend )
if(VTKm_UT_BACKEND)
set(backend "_${VTKm_UT_BACKEND}")
if(backend STREQUAL "CUDA")
set(VTKm_UT_CUDA "TRUE")
endif()
endif()
vtkm_get_kit_name(kit)
#we use UnitTests_ so that it is an unique key to exclude from coverage
set(test_prog "UnitTests_${kit}${backend}")
if(VTKm_UT_NAME)
set(test_prog "${VTKm_UT_NAME}${backend}")
endif()
create_test_sourcelist(TestSources ${test_prog}.cxx ${VTKm_UT_SOURCES})
add_executable(${test_prog} ${TestSources})
set_target_properties(${test_prog} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
)
target_link_libraries(${test_prog} PRIVATE vtkm)
if(NOT VTKm_UT_NO_TESTS)
return()
endif()
#determine the timeout for all the tests based on the backend. CUDA tests
#generally require more time because of kernel generation.
set(timeout 180)
if(VTKm_UT_CUDA)
set(timeout 1500)
endif()
foreach (test ${VTKm_UT_SOURCES})
get_filename_component(tname ${test} NAME_WE)
add_test(NAME ${tname}
COMMAND ${test_prog} ${tname} ${VTKm_UT_TEST_ARGS}
)
set_tests_properties("${tname}" PROPERTIES TIMEOUT ${timeout})
endforeach (test)
endfunction(vtkm_unit_tests)
#-----------------------------------------------------------------------------
# Declare benchmarks, which use all the same infrastructure as tests but
# don't actually do the add_test at the end
#
# [BACKEND]: mark all source files as being compiled with the proper defines
# to make this backend the default backend
# If the backend is specified as CUDA it will also imply all
# sources should be treated as CUDA sources
# The backend name will also be added to the executable name
# so you can test multiple backends easily
# vtkm_benchmarks(
# SOURCES <source_list>
# BACKEND <type>
# LIBRARIES <dependent_library_list>
function(vtkm_benchmarks)
vtkm_unit_tests(NAME Benchmarks NO_TESTS ${ARGN})
endfunction(vtkm_benchmarks)

@ -1 +0,0 @@
#include "@source_file_path@"

@ -1,411 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## 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.
##============================================================================
PROJECT_NAME = "VTK-m"
PROJECT_NUMBER = @VTKm_VERSION@
OUTPUT_DIRECTORY = @VTKm_BINARY_DIR@/docs/doxygen/
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
SHOW_NAMESPACES = NO
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = YES
TAB_SIZE = 2
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @VTKm_SOURCE_DIR@/README.md
INPUT += @VTKm_SOURCE_DIR@/CONTRIBUTING.md
INPUT += @VTKm_SOURCE_DIR@/docs/CodingConventions.md
INPUT += @VTKm_SOURCE_DIR@/vtkm
USE_MDFILE_AS_MAINPAGE = README.md
FILE_PATTERNS = *.h
RECURSIVE = YES
EXCLUDE = @VTKm_SOURCE_DIR@/vtkm/testing/OptionParser.h
EXCLUDE += @VTKm_SOURCE_DIR@/vtkm/exec/cuda/internal/ExecutionPolicy.h
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = */testing/*
EXCLUDE_PATTERNS += */examples/*
EXCLUDE_PATTERNS += UnitTest*
EXCLUDE_SYMBOLS = thrust
EXCLUDE_SYMBOLS += detail
EXCLUDE_SYMBOLS += placeholders
EXCLUDE_SYMBOLS += benchmarking
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 2
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
#XML_SCHEMA =
#XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH = @VTKm_SOURCE_DIR@ @VTKm_BINARY_DIR@
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN
PREDEFINED += VTKM_DOXYGEN_ONLY
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = @VTKm_DOXYGEN_HAVE_DOT@
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = NO
DOT_IMAGE_FORMAT = png
DOT_PATH = @VTKm_DOXYGEN_DOT_PATH@
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 75
MAX_DOT_GRAPH_DEPTH = 5
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

@ -18,13 +18,15 @@
## this software.
##============================================================================
#We require CMake 3.3 for Modern CMake which as features such as:
# - Better custom command support
# - Better acting if() argument expansion
# - Support for usage requirements
# -
cmake_minimum_required(VERSION 3.3)
# We require CMake 3.9 for Modern CMake which as features such as:
# - Support for OBJECTs in target_sources
# - Support for meta level compiler features
# - Proper if() argument expansion
# - Proper CUDA support
# - Support for usage requirements
#
# We require CMake 3.9 for CUDA support
cmake_minimum_required(VERSION 3.9)
project (VTKm)
# Update module path
@ -59,53 +61,12 @@ endif()
set(VTKm_BINARY_INCLUDE_DIR "${VTKm_BINARY_DIR}/include")
set(VTKm_EXPORT_NAME "VTKmTargets")
# Setup default build types
include(VTKmBuildType)
# include some vtkm-specific cmake code.
include(VTKmMacros)
# Create an "interface" target library. This is not a real library but rather
# holds CMake configuration that is required for CXX targets that use VTK-m
# headers. In particular, it makes sure the appropriate C++11 version is being
# used. (The cxx_constexpr and cxx_auto_type features happen to force C++11.
# Directly asking for C++11 with this interface is not supported in CMake 3.3.)
# This is also exported so that dependent CMake projects can load the same
# configuration.
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:${VTKm_BINARY_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${VTKm_INSTALL_INCLUDE_DIR}>
)
install(TARGETS vtkm EXPORT ${VTKm_EXPORT_NAME})
# 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.")
if (NOT DEFINED VTKm_EXPORT_NAME)
set(VTKm_EXPORT_NAME "VTKmTargets")
endif()
#-----------------------------------------------------------------------------
# When using C++11 suport make sure you use the standard C++ extensions rather
# than compiler-specific versions of the extensions (to preserve portability).
set(CMAKE_CXX_EXTENSIONS False)
#-----------------------------------------------------------------------------
# Add supplemental compiler warnings, and GCC visibility support.
# include export header modules so that we can easily control symbol exporting
# VTK-m is setup by default not to export symbols unless explicitly stated.
# We prefer to only export symbols of a small set of user facing classes,
# rather than exporting all symbols. In practice we will try to not export
# symbols for any third party library
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
include(GenerateExportHeader)
include(CMake/VTKmCompilerExtras.cmake)
set(VTKm_EXPORT_NAME "VTKmTargets")
#-----------------------------------------------------------------------------
# Configurable Options
@ -131,6 +92,29 @@ mark_as_advanced(VTKm_NO_ASSERT)
option(BUILD_SHARED_LIBS "Build VTK-m with shared libraries" ON)
set(VTKm_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
# Setup default build types
include(VTKmBuildType)
# Determine VTK-m version
include(Utilities/Git/Git.cmake)
include(VTKmDetermineVersion)
# Load hardcoded version in case this is not a Git repository
file(STRINGS version.txt version_txt)
extract_version_components("${version_txt}" "VTKm")
# Get the version from git if we can
determine_version(${VTKm_SOURCE_DIR} ${GIT_EXECUTABLE} "VTKm")
# Create an "interface" target library. This is not a real library but rather
# holds CMake configuration that is required for CXX targets that use VTK-m
# headers. In particular, it makes sure the appropriate C++11 version is being
# used. (The cxx_constexpr and cxx_auto_type features happen to force C++11.
# Directly asking for C++11 with this interface is not supported in CMake 3.3.)
# This is also exported so that dependent CMake projects can load the same
# configuration.
include(VTKmCompilerFlags)
include(VTKmWrappers)
if (VTKm_ENABLE_TESTING)
enable_testing()
include(CTest)
@ -138,25 +122,6 @@ if (VTKm_ENABLE_TESTING)
${VTKm_BINARY_DIR}/CTestCustom.cmake @ONLY)
endif()
#-----------------------------------------------------------------------------
# Set up devices selected.
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_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_component_CUDA()
if(NOT VTKm_CUDA_FOUND)
message(SEND_ERROR "Could not load CUDA configuration. If CUDA is not available, turn off VTKm_ENABLE_CUDA.")
endif()
endif (VTKm_ENABLE_CUDA)
#-----------------------------------------------------------------------------
## Set the directory where the binaries will be stored
@ -205,15 +170,6 @@ check_type_size(int VTKm_SIZE_INT BUILTIN_TYPES_ONLY)
check_type_size(long VTKm_SIZE_LONG BUILTIN_TYPES_ONLY)
check_type_size("long long" VTKm_SIZE_LONG_LONG BUILTIN_TYPES_ONLY)
#-----------------------------------------------------------------------------
# Find the Python interpreter, which we will use during the build process
find_package(PythonInterp)
#-----------------------------------------------------------------------------
# Find Pyexpander in case somebody wants to update the auto generated
# faux variadic template code
find_package(Pyexpander)
#-----------------------------------------------------------------------------
# Add subdirectories
add_subdirectory(vtkm)
@ -229,46 +185,6 @@ endif()
# Ready files for find_package
include(CMakePackageConfigHelpers)
string(REPLACE ";" " " VTKm_AVAILABLE_COMPONENTS_LIST
"${VTKm_AVAILABLE_COMPONENTS}"
)
set(VTKm_LOAD_COMPONENTS_COMMANDS "# Clear out old FOUND flags")
foreach(component ${VTKm_AVAILABLE_COMPONENTS})
set(VTKm_LOAD_COMPONENTS_COMMANDS "${VTKm_LOAD_COMPONENTS_COMMANDS}
set(VTKm_${component}_FOUND)"
)
endforeach(component)
set(VTKm_LOAD_COMPONENTS_COMMANDS "${VTKm_LOAD_COMPONENTS_COMMANDS}
# Load each component selected in find_package
foreach(comp \${VTKm_FIND_COMPONENTS})")
foreach(component ${VTKm_AVAILABLE_COMPONENTS})
set(VTKm_LOAD_COMPONENTS_COMMANDS "${VTKm_LOAD_COMPONENTS_COMMANDS}
if(\"${component}\" STREQUAL \${comp})
vtkm_configure_component_${component}()
if(VTKm_${component}_FOUND AND NOT VTKm_CONFIGURE_QUIET)
message(STATUS \"Successfully loaded VTK-m component ${component}\")
else()
if(VTKm_FIND_REQUIRED_${component} AND NOT VTKm_CONFIGURE_QUIET)
message(\"Could not load REQUIRED VTK-m component ${component}\")
elseif(NOT VTKm_CONFIGURE_QUIET)
message(STATUS \"Could not load optional VTK-m component ${component}\")
endif()
endif()
continue()
endif()"
)
endforeach()
set(VTKm_LOAD_COMPONENTS_COMMANDS "${VTKm_LOAD_COMPONENTS_COMMANDS}
if(NOT VTKm_CONFIGURE_QUIET)
message(WARNING \"No such VTK-m component: \${comp}\")
endif()
endforeach()" )
configure_package_config_file(
${VTKm_SOURCE_DIR}/CMake/VTKmConfig.cmake.in
${VTKm_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmConfig.cmake
@ -305,22 +221,15 @@ install(FILES ${VTKm_SOURCE_DIR}/LICENSE.txt
# Install helper configure files.
install(
FILES
${VTKm_SOURCE_DIR}/CMake/FindEGL.cmake
${VTKm_SOURCE_DIR}/CMake/FindGLEW.cmake
${VTKm_SOURCE_DIR}/CMake/FindGLFW.cmake
${VTKm_SOURCE_DIR}/CMake/FindMESA.cmake
${VTKm_SOURCE_DIR}/CMake/FindTBB.cmake
${VTKm_SOURCE_DIR}/CMake/FindThrust.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.cu
${VTKm_SOURCE_DIR}/CMake/VTKmWrappers.cmake
${VTKm_SOURCE_DIR}/CMake/VTKmBackends.cmake
${VTKm_SOURCE_DIR}/CMake/VTKmExportHeaderTemplate.h.in
DESTINATION ${VTKm_INSTALL_CMAKE_MODULE_DIR}
)

@ -23,20 +23,20 @@
#path so that our examples can find VTK-m
set(CMAKE_PREFIX_PATH ${VTKm_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR})
add_subdirectory(clipping)
add_subdirectory(contour_tree)
add_subdirectory(cosmotools)
add_subdirectory(demo)
add_subdirectory(dynamic_dispatcher)
add_subdirectory(game_of_life)
add_subdirectory(hello_world)
add_subdirectory(isosurface)
# add_subdirectory(clipping)
# add_subdirectory(contour_tree)
# add_subdirectory(cosmotools)
# add_subdirectory(demo)
# add_subdirectory(dynamic_dispatcher)
# add_subdirectory(game_of_life)
# add_subdirectory(hello_world)
# add_subdirectory(isosurface)
add_subdirectory(multi_backend)
add_subdirectory(streamline)
add_subdirectory(tetrahedra)
add_subdirectory(particle_advection)
if(VTKm_ENABLE_RENDERING)
add_subdirectory(rendering)
endif()
add_subdirectory(unified_memory)
# add_subdirectory(streamline)
# add_subdirectory(tetrahedra)
# add_subdirectory(particle_advection)
# if(VTKm_ENABLE_RENDERING)
# add_subdirectory(rendering)
# endif()
# add_subdirectory(unified_memory)

@ -38,7 +38,7 @@ if(VTKm_CUDA_FOUND)
set(old_nvcc_flags ${CUDA_NVCC_FLAGS})
set(old_cxx_flags ${CMAKE_CXX_FLAGS})
vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags)
vtkm_disable_troublesome_thrust_warnings()
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})

@ -39,7 +39,7 @@ if(VTKm_CUDA_FOUND)
set(old_nvcc_flags ${CUDA_NVCC_FLAGS})
set(old_cxx_flags ${CMAKE_CXX_FLAGS})
vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags)
vtkm_disable_troublesome_thrust_warnings()
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})

@ -36,7 +36,7 @@ if(VTKm_OpenGL_FOUND AND VTKm_GLUT_FOUND)
if(VTKm_CUDA_FOUND)
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
vtkm_disable_troublesome_thrust_warnings()
cuda_add_executable(HelloWorld_CUDA HelloWorld.cu LoadShaders.h)
target_include_directories(HelloWorld_CUDA PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(HelloWorld_CUDA PRIVATE ${VTKm_LIBRARIES})

@ -33,7 +33,7 @@ if(VTKm_OpenGL_FOUND AND VTKm_GLUT_FOUND)
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})
cuda_add_executable(IsosurfaceUniformGrid_CUDA IsosurfaceUniformGrid.cu quaternion.h)

@ -21,26 +21,11 @@
##=============================================================================
#Find the VTK-m package
find_package(VTKm REQUIRED QUIET
OPTIONAL_COMPONENTS Serial CUDA TBB
)
find_package(VTKm REQUIRED QUIET)
if(VTKm_CUDA_FOUND)
set(old_nvcc_flags ${CUDA_NVCC_FLAGS})
set(old_cxx_flags ${CMAKE_CXX_FLAGS})
vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags)
vtkm_disable_troublesome_thrust_warnings()
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(MultiBackend MultiBackend.cu)
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
else()
add_executable(MultiBackend MultiBackend.cxx)
if(TARGET vtkm::cuda)
set_source_files_properties(MultiBackend.cxx LANGUAGE "CUDA")
endif()
target_include_directories(MultiBackend PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(MultiBackend PRIVATE ${VTKm_LIBRARIES})
target_compile_options(MultiBackend PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(MultiBackend MultiBackend.cxx)
target_link_libraries(MultiBackend PRIVATE vtkm)

@ -1,23 +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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// 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 merely exists so that we can simplify the logic for invoking
//nvcc telling that cuda code exists.
#include "MultiBackend.cxx"

@ -26,7 +26,7 @@ find_package(VTKm REQUIRED QUIET
)
if(VTKm_CUDA_FOUND)
vtkm_disable_troublesome_thrust_warnings()
# Cuda compiles do not respect target_include_directories
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(UnifiedMemory_CUDA UnifiedMemory.cu)

@ -82,15 +82,15 @@ add_subdirectory(filter)
#-----------------------------------------------------------------------------
# Build rendering
if(VTKm_ENABLE_RENDERING)
add_subdirectory(rendering)
endif()
# if(VTKm_ENABLE_RENDERING)
# add_subdirectory(rendering)
# endif()
add_subdirectory(interop)
# add_subdirectory(interop)
#-----------------------------------------------------------------------------
#add the benchmarking folder
add_subdirectory(benchmarking)
# add_subdirectory(benchmarking)
#-----------------------------------------------------------------------------
#add the io folder

@ -30,16 +30,11 @@ set(benchmark_headers
Benchmarker.h
)
vtkm_save_benchmarks(${benchmark_srcs}
HEADERS ${benchmark_headers}
)
vtkm_benchmarks(VTKM_DEVICE_ADAPTER_SERIAL)
vtkm_benchmarks(BACKEND SERIAL SOURCES ${benchmark_srcs} ${benchmark_headers})
if (VTKm_ENABLE_CUDA)
vtkm_benchmarks(VTKM_DEVICE_ADAPTER_CUDA)
vtkm_benchmarks(BACKEND CUDA SOURCES ${benchmark_srcs} ${benchmark_headers})
endif()
if (VTKm_ENABLE_TBB)
vtkm_benchmarks(VTKM_DEVICE_ADAPTER_TBB)
vtkm_benchmarks(BACKEND TBB SOURCES ${benchmark_srcs} ${benchmark_headers})
endif()

@ -83,7 +83,7 @@ set(headers
VirtualObjectCache.h
)
set(header_impls
set(template_sources
ArrayHandle.hxx
CellSetExplicit.hxx
CellSetStructured.hxx
@ -114,41 +114,32 @@ set(device_sources
RuntimeDeviceTracker.cxx
)
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
add_subdirectory(internal)
add_subdirectory(arg)
vtkm_library( NAME vtkm
SOURCES ${sources}
TEMPLATE_SOURCES ${template_sources}
HEADERS ${headers}
WRAP_FOR_CUDA ${device_sources}
)
add_subdirectory(serial)
set(sources ${sources} $<TARGET_OBJECTS:vtkm_cont_serial>)
target_sources(vtkm PRIVATE $<TARGET_OBJECTS:vtkm_cont_serial>)
add_subdirectory(tbb)
if (VTKm_ENABLE_TBB)
set(sources ${sources} $<TARGET_OBJECTS:vtkm_cont_tbb>)
target_sources(vtkm PRIVATE $<TARGET_OBJECTS:vtkm_cont_tbb>)
target_link_libraries(vtkm PUBLIC vtkm::tbb)
endif()
add_subdirectory(cuda)
if (VTKm_ENABLE_CUDA)
get_property(vtkm_cont_cuda_object_files GLOBAL
PROPERTY vtkm_cont_cuda_object_files )
# mark the file as generated, this needs to be done in this directory
# for 'reasons'.
set_source_files_properties(${vtkm_cont_cuda_object_files}
PROPERTIES GENERATED TRUE)
set(sources ${sources} ${vtkm_cont_cuda_object_files})
endif()
vtkm_library(
SOURCES ${sources}
WRAP_FOR_CUDA ${device_sources}
HEADERS ${header_impls})
target_include_directories(vtkm_cont PRIVATE ${VTKm_BACKEND_INCLUDE_DIRS})
if(VTKm_ENABLE_CUDA)
add_dependencies(vtkm_cont vtkm_cont_cuda)
target_sources(vtkm PRIVATE $<TARGET_OBJECTS:vtkm_cont_cuda>)
target_link_libraries(vtkm PUBLIC vtkm::cuda)
endif()
target_link_libraries(vtkm PUBLIC vtkm_compiler_flags)
#-----------------------------------------------------------------------------
add_subdirectory(testing)

@ -24,11 +24,6 @@ set(headers
ErrorCuda.h
)
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_CUDA)
vtkm_disable_troublesome_thrust_warnings()
endif()
#-----------------------------------------------------------------------------
add_subdirectory(internal)
vtkm_declare_headers(CUDA ${headers} TESTABLE ${VTKm_ENABLE_CUDA})

@ -30,44 +30,23 @@ set(headers
ThrustExceptionHandler.h
VirtualObjectTransferCuda.h
)
vtkm_declare_headers(CUDA ${headers} TESTABLE ${VTKm_ENABLE_CUDA})
set(sources
#-----------------------------------------------------------------------------
if (NOT VTKm_ENABLE_CUDA)
return()
endif()
add_library(vtkm_cont_cuda OBJECT
ArrayManagerExecutionCuda.cu
CudaAllocator.cu
)
vtkm_declare_headers(CUDA ${headers} TESTABLE ${VTKm_ENABLE_CUDA})
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_CUDA)
add_subdirectory(testing)
#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_INCLUDE_DIR}
${VTKm_BACKEND_INCLUDE_DIRS}
)
set(compile_options -Dvtkm_cont_EXPORTS)
if(BUILD_SHARED_LIBS AND NOT WIN32)
list(APPEND compile_options -Xcompiler=${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY}hidden)
list(APPEND compile_options -Xcompiler=-fPIC)
endif()
vtkm_setup_nvcc_flags( old_nvcc_flags old_cxx_flags )
cuda_compile(vtkm_cont_cuda_object_files ${sources}
OPTIONS "${compile_options}")
set(CUDA_NVCC_FLAGS ${old_nvcc_flags})
set(CMAKE_CXX_FLAGS ${old_cxx_flags})
#Setup the dependency chain for the custom object build so that
add_custom_target(vtkm_cont_cuda DEPENDS ${vtkm_cont_cuda_object_files})
set_property( GLOBAL
PROPERTY vtkm_cont_cuda_object_files ${vtkm_cont_cuda_object_files})
target_compile_options(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_cuda PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_INCLUDE_DIRECTORIES>)
if(BUILD_SHARED_LIBS)
set_property(TARGET vtkm_cont_cuda PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()

@ -31,4 +31,4 @@ set(unit_tests
UnitTestCudaPointLocatorUniformGrid.cxx
UnitTestCudaVirtualObjectCache.cu
)
vtkm_unit_tests(CUDA SOURCES ${unit_tests})
vtkm_unit_tests(SOURCES ${unit_tests})

@ -32,16 +32,11 @@ add_library(vtkm_cont_serial OBJECT
)
vtkm_setup_msvc_properties(vtkm_cont_serial)
target_compile_options(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_serial PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_features(vtkm_cont_serial PRIVATE cxx_auto_type)
target_compile_definitions(vtkm_cont_serial PRIVATE vtkm_cont_EXPORTS)
if(BUILD_SHARED_LIBS)
set_property(TARGET vtkm_cont_serial PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
target_include_directories(vtkm_cont_serial PRIVATE
${VTKm_BACKEND_INCLUDE_DIRS}
${VTKm_SOURCE_DIR}
${VTKm_BINARY_INCLUDE_DIR}
)

@ -29,7 +29,7 @@ set(headers
if (VTKm_ENABLE_TBB)
if("${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}" VERSION_LESS 4.3)
if("${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}" VERSION_LESS 4.0)
MESSAGE(FATAL_ERROR "VTK-m not tested with TBB before version 4.0. Please upgrade your TBB library.")
# MESSAGE(FATAL_ERROR "VTK-m not tested with TBB before version 4.0. Please upgrade your TBB library.")
endif()
endif()
endif()
@ -47,16 +47,11 @@ add_library(vtkm_cont_tbb OBJECT
DeviceAdapterAlgorithmTBB.cxx
)
vtkm_setup_msvc_properties(vtkm_cont_tbb)
target_compile_options(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_features(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_COMPILE_FEATURES>)
target_include_directories(vtkm_cont_tbb PRIVATE $<TARGET_PROPERTY:vtkm,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_features(vtkm_cont_tbb PRIVATE cxx_auto_type)
target_compile_definitions(vtkm_cont_tbb PRIVATE vtkm_cont_EXPORTS)
if(BUILD_SHARED_LIBS)
set_property(TARGET vtkm_cont_tbb PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
target_include_directories(vtkm_cont_tbb PRIVATE
"${VTKm_SOURCE_DIR}"
"${VTKm_BINARY_INCLUDE_DIR}"
${VTKm_BACKEND_INCLUDE_DIRS}
)

@ -27,10 +27,6 @@ set(headers
)
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_CUDA)
vtkm_disable_troublesome_thrust_warnings()
endif()
vtkm_declare_headers(CUDA ${headers} TESTABLE ${VTKm_ENABLE_CUDA})
set_source_files_properties(ThrustPatches.h

@ -24,4 +24,4 @@ set(unit_tests
UnitTestTextureMemorySupport.cu
UnitTestTaskSingularCuda.cu
)
vtkm_unit_tests(CUDA SOURCES ${unit_tests})
vtkm_unit_tests(SOURCES ${unit_tests})

@ -22,8 +22,6 @@ set(headers
SetOpenGLDevice.h
)
vtkm_disable_troublesome_thrust_warnings()
#-----------------------------------------------------------------------------
vtkm_declare_headers(CUDA ${headers} TESTABLE FALSE)

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

@ -22,6 +22,4 @@ set(unit_tests
UnitTestTransferToOpenGLCuda.cu
)
vtkm_disable_troublesome_thrust_warnings()
vtkm_unit_tests(CUDA SOURCES ${unit_tests})
vtkm_unit_tests( SOURCES ${unit_tests})

@ -67,13 +67,11 @@ set(unit_tests
UnitTestWaveletCompressor.cxx
)
vtkm_save_worklet_unit_tests(${unit_tests})
vtkm_worklet_unit_tests( VTKM_DEVICE_ADAPTER_SERIAL )
vtkm_unit_tests(NAME Worklets BACKEND SERIAL SOURCES ${unit_tests})
if (VTKm_ENABLE_CUDA)
vtkm_worklet_unit_tests( VTKM_DEVICE_ADAPTER_CUDA )
vtkm_unit_tests(NAME Worklets BACKEND CUDA SOURCES ${unit_tests})
endif()
if (VTKm_ENABLE_TBB)
vtkm_worklet_unit_tests( VTKM_DEVICE_ADAPTER_TBB )
vtkm_unit_tests(NAME Worklets BACKEND TBB SOURCES ${unit_tests})
endif()