Commit 429ad970 authored by James Kress's avatar James Kress

Merge remote-tracking branch 'upstream/master'

parents 1cdd59cf 4aa479b0
...@@ -435,7 +435,7 @@ if(OPENGL_FOUND) ...@@ -435,7 +435,7 @@ if(OPENGL_FOUND)
if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$") if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$")
set(_gl_fw "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}") set(_gl_fw "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}")
if(EXISTS "${_gl_fw}.tbd") if(EXISTS "${_gl_fw}.tbd")
string(APPEND _gl_fw ".tbd") set(_gl_fw "${_gl_fw}.tbd")
endif() endif()
set_target_properties(OpenGL::GL PROPERTIES set_target_properties(OpenGL::GL PROPERTIES
IMPORTED_LOCATION "${_gl_fw}") IMPORTED_LOCATION "${_gl_fw}")
...@@ -490,7 +490,7 @@ if(OPENGL_FOUND) ...@@ -490,7 +490,7 @@ if(OPENGL_FOUND)
if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$") if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$")
set(_glu_fw "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}") set(_glu_fw "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}")
if(EXISTS "${_glu_fw}.tbd") if(EXISTS "${_glu_fw}.tbd")
string(APPEND _glu_fw ".tbd") set(_glu_fw "${_glu_fw}.tbd")
endif() endif()
set_target_properties(OpenGL::GLU PROPERTIES set_target_properties(OpenGL::GLU PROPERTIES
IMPORTED_LOCATION "${_glu_fw}") IMPORTED_LOCATION "${_glu_fw}")
......
This diff is collapsed.
...@@ -190,7 +190,8 @@ if(TARGET vtkm::cuda AND flags AND NOT CMAKE_CUDA_HOST_COMPILER) ...@@ -190,7 +190,8 @@ if(TARGET vtkm::cuda AND flags AND NOT CMAKE_CUDA_HOST_COMPILER)
# Also propagate down these optimizations when building host side code # Also propagate down these optimizations when building host side code
# with cuda. To be safe we only do this when we know the C++ and CUDA # with cuda. To be safe we only do this when we know the C++ and CUDA
# host compiler are from the same vendor # host compiler are from the same vendor
string(REGEX REPLACE ";" "," cuda_flags "${flags}")
target_compile_options(vtkm_vectorization_flags target_compile_options(vtkm_vectorization_flags
INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler="${flags}"> INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${cuda_flags}>
) )
endif() endif()
...@@ -41,6 +41,7 @@ set(EXCEPTIONS ...@@ -41,6 +41,7 @@ set(EXCEPTIONS
) )
set(DIRECTORY_EXCEPTIONS set(DIRECTORY_EXCEPTIONS
${VTKm_SOURCE_DIR}/vtkm/thirdparty/taotuple/vtkmtaotuple
${VTKm_SOURCE_DIR}/vtkm/thirdparty/diy/vtkmdiy ${VTKm_SOURCE_DIR}/vtkm/thirdparty/diy/vtkmdiy
) )
......
...@@ -44,9 +44,23 @@ endif() ...@@ -44,9 +44,23 @@ endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# vtkm_compiler_flags is used by all the vtkm targets # vtkm_compiler_flags is used by all the vtkm targets and consumers of VTK-m
# The flags on vtkm_compiler_flags are needed when using/building vtk-m
add_library(vtkm_compiler_flags INTERFACE) add_library(vtkm_compiler_flags INTERFACE)
# When building libraries/tests that are part of the VTK-m repository
# inherit the properties from vtkm_developer_flags and vtkm_vectorization_flags.
# The flags are intended only for VTK-m itself and are not needed by consumers.
# We will export vtkm_vectorization_flags in general so consumer can enable
# vectorization if they so desire
if (VTKm_ENABLE_DEVELOPER_FLAGS)
target_link_libraries(vtkm_compiler_flags
INTERFACE $<BUILD_INTERFACE:vtkm_developer_flags>)
endif()
target_link_libraries(vtkm_compiler_flags
INTERFACE $<BUILD_INTERFACE:vtkm_vectorization_flags>)
# setup that we need C++11 support # setup that we need C++11 support
if(CMAKE_VERSION VERSION_LESS 3.8) if(CMAKE_VERSION VERSION_LESS 3.8)
target_compile_features(vtkm_compiler_flags INTERFACE cxx_nullptr) target_compile_features(vtkm_compiler_flags INTERFACE cxx_nullptr)
...@@ -56,14 +70,9 @@ endif() ...@@ -56,14 +70,9 @@ endif()
# Enable large object support so we can have 2^32 addressable sections # Enable large object support so we can have 2^32 addressable sections
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(CMAKE_VERSION VERSION_LESS 3.11) target_compile_options(vtkm_compiler_flags INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/bigobj>)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") if(TARGET vtkm::cuda)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"/bigobj\"") target_compile_options(vtkm_compiler_flags INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler="/bigobj">)
else()
target_compile_options(vtkm_compiler_flags INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:/bigobj>>)
if(TARGET vtkm::cuda)
target_compile_options(vtkm_compiler_flags INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler="/bigobj">>)
endif()
endif() endif()
endif() endif()
...@@ -74,29 +83,22 @@ target_include_directories(vtkm_compiler_flags INTERFACE ...@@ -74,29 +83,22 @@ target_include_directories(vtkm_compiler_flags INTERFACE
$<INSTALL_INTERFACE:${VTKm_INSTALL_INCLUDE_DIR}> $<INSTALL_INTERFACE:${VTKm_INSTALL_INCLUDE_DIR}>
) )
# 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 developer 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_developer_flags
target_link_libraries(vtkm_compiler_flags
INTERFACE $<BUILD_INTERFACE:vtkm_developer_flags vtkm_vectorization_flags>)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# vtkm_developer_flags is used ONLY BY libraries that are built as part of this # vtkm_developer_flags is used ONLY BY libraries that are built as part of this
# repository # repository
add_library(vtkm_developer_flags INTERFACE) add_library(vtkm_developer_flags INTERFACE)
target_link_libraries(vtkm_developer_flags INTERFACE vtkm_compiler_flags) target_link_libraries(vtkm_developer_flags INTERFACE vtkm_compiler_flags)
# Additional warnings just for Clang 3.5+, and AppleClang 7+
# about failures to vectorize.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.4)
target_compile_options(vtkm_developer_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_developer_flags INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:-Wno-pass-failed>>)
endif()
if(VTKM_COMPILER_IS_MSVC) if(VTKM_COMPILER_IS_MSVC)
target_compile_definitions(vtkm_developer_flags INTERFACE "_SCL_SECURE_NO_WARNINGS" target_compile_definitions(vtkm_developer_flags INTERFACE "_SCL_SECURE_NO_WARNINGS"
"_CRT_SECURE_NO_WARNINGS") "_CRT_SECURE_NO_WARNINGS")
...@@ -124,12 +126,23 @@ elseif(VTKM_COMPILER_IS_ICC) ...@@ -124,12 +126,23 @@ elseif(VTKM_COMPILER_IS_ICC)
elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG) elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG)
set(cxx_flags -Wall -Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common) set(cxx_flags -Wall -Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common)
set(cuda_flags "-Xcudafe=\"--display_error_number\"") set(cuda_flags -Xcudafe=--display_error_number -Xcompiler=-Wall,-Wno-unknown-pragmas,-Wno-unused-local-typedefs,-Wno-unused-local-typedefs,-Wno-unused-function,-Wno-long-long,-Wcast-align,-Wconversion,-Wchar-subscripts,-Wpointer-arith,-Wformat,-Wformat-security,-Wshadow,-Wunused-parameter,-fno-common)
target_compile_options(vtkm_compiler_flags
#GCC 5, 6 don't properly handle strict-overflow suppression through pragma's.
#Instead of suppressing around the location of the strict-overflow you
#have to suppress around the entry point, or in vtk-m case the worklet
#invocation site. This is incredibly tedious and has been fixed in gcc 7
#
if(VTKM_COMPILER_IS_GNU AND
(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.99) AND
(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.99) )
list(APPEND cxx_flags -Wno-strict-overflow)
endif()
target_compile_options(vtkm_developer_flags
INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:${cxx_flags}>> INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:${cxx_flags}>>
) )
if(TARGET vtkm::cuda) if(TARGET vtkm::cuda)
target_compile_options(vtkm_compiler_flags target_compile_options(vtkm_developer_flags
INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:${cuda_flags}>> INTERFACE $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:${cuda_flags}>>
) )
endif() endif()
......
...@@ -19,17 +19,38 @@ ...@@ -19,17 +19,38 @@
##============================================================================ ##============================================================================
# When this file is run by CMake through the find_package command, the # When this file is run by CMake through the find_package command, the
# following variables will be defined: # following targets will exist:
# vtkm_cont Target that contains most of VTK-m
# #
# vtkm Target that should be used to link to VTK-m # vtkm_rendering Target that contains all the rendering code
# #
# vtkm_rendering Target that contains all the rendering code # vtkm::tbb Target that contains tbb related link information
# implicitly linked to by `vtkm_cont` if tbb is enabled
# #
# vtkm::tbb Target that contains tbb related link information # vtkm::openmp Target that contains openmp related link information
# implicitly linked to by `vtkm` if tbb is enabled # implicitly linked to by `vtkm_cont` if openmp is enabled
#
# vtkm::cuda Target that contains cuda related link information
# implicitly linked to by `vtkm_cont` if cuda is enabled
#
# The following local variables will also be defined:
#
# VTKm_VERSION Holds the version string of "Major.Minor"
# VTKm_VERSION_FULL Holds the version string of "Major.Minor.Patch.GitSha1"
# VTKm_VERSION_MAJOR Holds just the major version number
# VTKm_VERSION_MINOR Holds just the minor version number
# VTKm_VERSION_PATCH Holds just the patch version number
#
# VTKm_BUILD_SHARED_LIBS Will be enabled if VTK-m was built shared/dynamic
# VTKm_ENABLE_CUDA Will be enabled if VTK-m was built with CUDA support
# VTKm_ENABLE_TBB Will be enabled if VTK-m was built with TBB support
# VTKm_ENABLE_OPENMP Will be enabled if VTK-m was built with OpenMP support
# VTKm_ENABLE_MPI Will be enabled if VTK-m was built with MPI support
# VTKm_ENABLE_RENDERING Will be enabled if VTK-m was built with rendering support
# VTKm_ENABLE_GL_CONTEXT Will be enabled if VTK-m rendering was built with a GL context
# VTKm_ENABLE_OSMESA_CONTEXT Will be enabled if VTK-m rendering was built with a osmesa context
# VTKm_ENABLE_EGL_CONTEXT Will be enabled if VTK-m rendering was built with a EGL context
# #
# 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.3 FATAL_ERROR)
...@@ -46,6 +67,7 @@ set(VTKm_VERSION "@VTKm_VERSION@") ...@@ -46,6 +67,7 @@ set(VTKm_VERSION "@VTKm_VERSION@")
set(VTKm_BUILD_SHARED_LIBS "@VTKm_BUILD_SHARED_LIBS@") set(VTKm_BUILD_SHARED_LIBS "@VTKm_BUILD_SHARED_LIBS@")
set(VTKm_ENABLE_CUDA "@VTKm_ENABLE_CUDA@") set(VTKm_ENABLE_CUDA "@VTKm_ENABLE_CUDA@")
set(VTKm_ENABLE_TBB "@VTKm_ENABLE_TBB@") set(VTKm_ENABLE_TBB "@VTKm_ENABLE_TBB@")
set(VTKm_ENABLE_OPENMP "@VTKm_ENABLE_OPENMP@")
set(VTKm_ENABLE_RENDERING "@VTKm_ENABLE_RENDERING@") set(VTKm_ENABLE_RENDERING "@VTKm_ENABLE_RENDERING@")
set(VTKm_ENABLE_GL_CONTEXT "@VTKm_ENABLE_GL_CONTEXT@") set(VTKm_ENABLE_GL_CONTEXT "@VTKm_ENABLE_GL_CONTEXT@")
set(VTKm_ENABLE_OSMESA_CONTEXT "@VTKm_ENABLE_OSMESA_CONTEXT@") set(VTKm_ENABLE_OSMESA_CONTEXT "@VTKm_ENABLE_OSMESA_CONTEXT@")
...@@ -59,10 +81,8 @@ endif() ...@@ -59,10 +81,8 @@ endif()
if(VTKm_PACKAGE_IN_BUILD) if(VTKm_PACKAGE_IN_BUILD)
set_and_check(VTKm_CMAKE_MODULE_PATH "@VTKm_SOURCE_DIR@/CMake") set_and_check(VTKm_CMAKE_MODULE_PATH "@VTKm_SOURCE_DIR@/CMake")
set_and_check(VTKm_INCLUDE_DIRS ${VTKm_INCLUDE_DIRS} "@VTKm_SOURCE_DIR@")
else() else()
set_and_check(VTKm_CMAKE_MODULE_PATH "@PACKAGE_VTKm_INSTALL_CMAKE_MODULE_DIR@") set_and_check(VTKm_CMAKE_MODULE_PATH "@PACKAGE_VTKm_INSTALL_CMAKE_MODULE_DIR@")
set_and_check(VTKm_INCLUDE_DIRS "@PACKAGE_VTKm_INSTALL_INCLUDE_DIR@")
endif() endif()
# Load the library exports, but only if not compiling VTK-m itself # Load the library exports, but only if not compiling VTK-m itself
...@@ -77,7 +97,4 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH}) ...@@ -77,7 +97,4 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
# This includes a host of functions used by VTK-m CMake. # This includes a host of functions used by VTK-m CMake.
include(VTKmWrappers) include(VTKmWrappers)
include(VTKmRenderingContexts)
if(VTKm_ENABLE_RENDERING)
include(VTKmRenderingContexts)
endif()
...@@ -41,21 +41,27 @@ function(determine_version source_dir git_command var_prefix) ...@@ -41,21 +41,27 @@ function(determine_version source_dir git_command var_prefix)
# information. Just return here to avoid the warning message at the end of # information. Just return here to avoid the warning message at the end of
# this function. # this function.
return () return ()
elseif (NOT VTKm_GIT_DESCRIBE) elseif (NOT VTKm_GIT_DESCRIBE AND
if(EXISTS ${git_command} AND EXISTS ${source_dir}/.git) EXISTS ${git_command} AND
execute_process( EXISTS ${source_dir}/.git)
COMMAND ${git_command} describe execute_process(
WORKING_DIRECTORY ${source_dir} COMMAND ${git_command} describe
RESULT_VARIABLE result WORKING_DIRECTORY ${source_dir}
OUTPUT_VARIABLE output RESULT_VARIABLE result
ERROR_QUIET OUTPUT_VARIABLE output
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
ERROR_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (NOT result EQUAL 0)
# git describe failed (bad return code).
set(output "")
endif() endif()
else() else ()
set(result 0) # note, output may be set to empty if VTKm_GIT_DESCRIBE is not defined.
set(output ${VTKm_GIT_DESCRIBE}) set(output "${VTKm_GIT_DESCRIBE}")
endif() endif()
unset(tmp_VERSION)
extract_version_components("${output}" tmp) extract_version_components("${output}" tmp)
if(DEFINED tmp_VERSION) if(DEFINED tmp_VERSION)
if (NOT "${tmp_VERSION}" STREQUAL "${${var_prefix}_VERSION}") if (NOT "${tmp_VERSION}" STREQUAL "${${var_prefix}_VERSION}")
...@@ -74,14 +80,16 @@ endfunction() ...@@ -74,14 +80,16 @@ endfunction()
# Extracts components from a version string. See determine_version() for usage. # Extracts components from a version string. See determine_version() for usage.
function(extract_version_components version_string var_prefix) function(extract_version_components version_string var_prefix)
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)[-]*(.*)" string(REGEX MATCH "^v?(([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*))$"
version_matches "${version_string}") version_matches "${version_string}")
if(CMAKE_MATCH_0) if(CMAKE_MATCH_0)
set(full ${CMAKE_MATCH_0}) # note, we don't use CMAKE_MATCH_0 for `full` since it may or may not have
set(major ${CMAKE_MATCH_1}) # the `v` prefix.
set(minor ${CMAKE_MATCH_2}) set(full ${CMAKE_MATCH_1})
set(patch ${CMAKE_MATCH_3}) set(major ${CMAKE_MATCH_2})
set(patch_extra ${CMAKE_MATCH_4}) set(minor ${CMAKE_MATCH_3})
set(patch ${CMAKE_MATCH_4})
set(patch_extra ${CMAKE_MATCH_5})
set(${var_prefix}_VERSION "${major}.${minor}" PARENT_SCOPE) set(${var_prefix}_VERSION "${major}.${minor}" PARENT_SCOPE)
set(${var_prefix}_VERSION_MAJOR ${major} PARENT_SCOPE) set(${var_prefix}_VERSION_MAJOR ${major} PARENT_SCOPE)
......
...@@ -21,7 +21,13 @@ ...@@ -21,7 +21,13 @@
if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb) if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb)
find_package(TBB REQUIRED) find_package(TBB REQUIRED)
add_library(vtkm::tbb UNKNOWN IMPORTED) # Workaround a bug in older versions of cmake prevents linking with UNKOWN IMPORTED libraries
# refer to CMake issue #17245
if (CMAKE_VERSION VERSION_LESS 3.10)
add_library(vtkm::tbb SHARED IMPORTED GLOBAL)
else()
add_library(vtkm::tbb UNKNOWN IMPORTED GLOBAL)
endif()
set_target_properties(vtkm::tbb PROPERTIES set_target_properties(vtkm::tbb PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}") INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}")
...@@ -41,6 +47,19 @@ if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb) ...@@ -41,6 +47,19 @@ if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb)
endif() endif()
endif() endif()
if(VTKm_ENABLE_OPENMP AND NOT TARGET vtkm::openmp)
find_package(OpenMP 4.0 REQUIRED COMPONENTS CXX QUIET)
add_library(vtkm::openmp INTERFACE IMPORTED GLOBAL)
if(OpenMP_CXX_FLAGS)
set_target_properties(vtkm::openmp PROPERTIES
INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:CXX>:${OpenMP_CXX_FLAGS}>")
endif()
if(OpenMP_CXX_LIBRARIES)
set_target_properties(vtkm::openmp PROPERTIES
INTERFACE_LINK_LIBRARIES "${OpenMP_CXX_LIBRARIES}")
endif()
endif()
if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda) if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
cmake_minimum_required(VERSION 3.9 FATAL_ERROR) cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
...@@ -52,14 +71,18 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda) ...@@ -52,14 +71,18 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
list(APPEND CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES "${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") list(APPEND CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES "${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
endif() endif()
add_library(vtkm::cuda UNKNOWN IMPORTED) # Workaround a bug in older versions of cmake prevents linking with UNKOWN IMPORTED libraries
# refer to CMake issue #17245
if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") if (CMAKE_VERSION VERSION_LESS 3.10)
set_target_properties(vtkm::cuda PROPERTIES add_library(vtkm::cuda STATIC IMPORTED GLOBAL)
INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr> else()
) add_library(vtkm::cuda UNKNOWN IMPORTED GLOBAL)
endif() endif()
set_target_properties(vtkm::cuda PROPERTIES
INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>
)
# We can't have this location/lib empty, so we provide a location that is # We can't have this location/lib empty, so we provide a location that is
# valid and will have no effect on compilation # valid and will have no effect on compilation
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
...@@ -101,6 +124,8 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda) ...@@ -101,6 +124,8 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
# for all major virtual architectures, guaranteeing that the code will run # for all major virtual architectures, guaranteeing that the code will run
# anywhere. # anywhere.
# #
# The option 'none' is provided so that when being built as part of another
# project, its own custom flags can be used.
# #
# 1 - native # 1 - native
# - Uses system introspection to determine compile flags # - Uses system introspection to determine compile flags
...@@ -121,21 +146,19 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda) ...@@ -121,21 +146,19 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
# - Uses: --generate-code=arch=compute_50,code=sm_50 # - Uses: --generate-code=arch=compute_50,code=sm_50
# - Uses: --generate-code=arch=compute_60,code=sm_60 # - Uses: --generate-code=arch=compute_60,code=sm_60
# - Uses: --generate-code=arch=compute_70,code=sm_70 # - Uses: --generate-code=arch=compute_70,code=sm_70
# 8 - none
# #
#specify the property #specify the property
set(VTKm_CUDA_Architecture "native" CACHE STRING "Which GPU Architecture(s) to compile for") 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) set_property(CACHE VTKm_CUDA_Architecture PROPERTY STRINGS native fermi kepler maxwell pascal volta all none)
#detect what the propery is set too #detect what the propery is set too
if(VTKm_CUDA_Architecture STREQUAL "native") if(VTKm_CUDA_Architecture STREQUAL "native")
if(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT) if(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT)
#Use the cached value #Use the cached value
# replace any semicolons with an empty space as CMAKE_CUDA_FLAGS is set(arch_flags ${VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT})
# a string not a list and this could be cached from when it was a list
string(REPLACE ";" " " run_output "${VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT}")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${run_output}")
else() else()
#run execute_process to do auto_detection #run execute_process to do auto_detection
...@@ -160,11 +183,7 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda) ...@@ -160,11 +183,7 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
string(FIND "${run_output}" "--generate-code" position) string(FIND "${run_output}" "--generate-code" position)
string(SUBSTRING "${run_output}" ${position} -1 run_output) string(SUBSTRING "${run_output}" ${position} -1 run_output)
# replace any semicolons with an empty space as CMAKE_CUDA_FLAGS is set(arch_flags ${run_output})
# a string not a list
string(REPLACE ";" " " run_output "${run_output}")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${run_output}")
set(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT ${run_output} CACHE INTERNAL set(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT ${run_output} CACHE INTERNAL
"device type(s) for cuda[native]") "device type(s) for cuda[native]")
else() else()
...@@ -176,22 +195,27 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda) ...@@ -176,22 +195,27 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
#since when we are native we can fail, and fall back to "kepler" these have #since when we are native we can fail, and fall back to "kepler" these have
#to happen after, and separately of the native check #to happen after, and separately of the native check
if(VTKm_CUDA_Architecture STREQUAL "fermi") if(VTKm_CUDA_Architecture STREQUAL "fermi")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_20,code=sm_20") set(arch_flags --generate-code=arch=compute_20,code=sm_20)
elseif(VTKm_CUDA_Architecture STREQUAL "kepler") elseif(VTKm_CUDA_Architecture STREQUAL "kepler")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_30,code=sm_30") set(arch_flags --generate-code=arch=compute_30,code=sm_30
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_35,code=sm_35") --generate-code=arch=compute_35,code=sm_35)
elseif(VTKm_CUDA_Architecture STREQUAL "maxwell") elseif(VTKm_CUDA_Architecture STREQUAL "maxwell")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_50,code=sm_50") set(arch_flags --generate-code=arch=compute_50,code=sm_50)
elseif(VTKm_CUDA_Architecture STREQUAL "pascal") elseif(VTKm_CUDA_Architecture STREQUAL "pascal")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_60,code=sm_60") set(arch_flags --generate-code=arch=compute_60,code=sm_60)
elseif(VTKm_CUDA_Architecture STREQUAL "volta") elseif(VTKm_CUDA_Architecture STREQUAL "volta")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_70,code=sm_70") set(arch_flags --generate-code=arch=compute_70,code=sm_70)
elseif(VTKm_CUDA_Architecture STREQUAL "all") elseif(VTKm_CUDA_Architecture STREQUAL "all")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_30,code=sm_30") set(arch_flags --generate-code=arch=compute_30,code=sm_30
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_35,code=sm_35") --generate-code=arch=compute_35,code=sm_35
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_50,code=sm_50") --generate-code=arch=compute_50,code=sm_50
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_60,code=sm_60") --generate-code=arch=compute_60,code=sm_60
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code=arch=compute_70,code=sm_70") --generate-code=arch=compute_70,code=sm_70)
endif() endif()
string(REPLACE ";" " " arch_flags "${arch_flags}")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${arch_flags}")
set_target_properties(vtkm::cuda PROPERTIES VTKm_CUDA_Architecture_Flags "${arch_flags}")
endif() endif()
...@@ -84,11 +84,6 @@ function(vtkm_find_gl) ...@@ -84,11 +84,6 @@ function(vtkm_find_gl)
endfunction() endfunction()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if(TARGET vtkm_rendering_gl_context)
return()
endif()
add_library(vtkm_rendering_gl_context INTERFACE)
if(VTKm_ENABLE_GL_CONTEXT OR if(VTKm_ENABLE_GL_CONTEXT OR
VTKm_ENABLE_OSMESA_CONTEXT OR VTKm_ENABLE_OSMESA_CONTEXT OR
VTKm_ENABLE_EGL_CONTEXT VTKm_ENABLE_EGL_CONTEXT
...@@ -98,6 +93,14 @@ if(VTKm_ENABLE_GL_CONTEXT OR ...@@ -98,6 +93,14 @@ if(VTKm_ENABLE_GL_CONTEXT OR
QUIET) QUIET)
endif() endif()
#-----------------------------------------------------------------------------
if(VTKm_ENABLE_RENDERING)
if(TARGET vtkm_rendering_gl_context)
return()
endif()
add_library(vtkm_rendering_gl_context INTERFACE)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if(VTKm_ENABLE_GL_CONTEXT) if(VTKm_ENABLE_GL_CONTEXT)
if(TARGET OpenGL::GLX) if(TARGET OpenGL::GLX)
......
...@@ -100,30 +100,32 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda) ...@@ -100,30 +100,32 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda)
set(ext "cu") set(ext "cu")
endif() endif()
set(valid_hfiles )
set(srcs) set(srcs)
foreach (header ${hfiles})