mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Correct issues when using a cuda enabled install of vtk-m.
This commit is contained in:
parent
001d1b0f47
commit
7ea2accbc1
@ -105,6 +105,12 @@ endif()
|
|||||||
# include the CMake modules distributed with VTKm.
|
# include the CMake modules distributed with VTKm.
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
|
if(VTKm_ENABLE_CUDA)
|
||||||
|
if (CMAKE_VERSION VERSION_LESS "3.9")
|
||||||
|
message(FATAL_ERROR "VTK-m with CUDA requires CMake 3.9+")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# 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)
|
include(VTKmRenderingContexts)
|
||||||
|
@ -116,7 +116,7 @@ if(VTKm_ENABLE_OPENMP AND NOT TARGET vtkm::openmp)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
|
if(VTKm_ENABLE_CUDA)
|
||||||
cmake_minimum_required(VERSION 3.9...3.14 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.9...3.14 FATAL_ERROR)
|
||||||
enable_language(CUDA)
|
enable_language(CUDA)
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ 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()
|
||||||
|
|
||||||
if (NOT TARGET vtkm_cuda)
|
if (NOT TARGET vtkm_cuda OR NOT TARGET vtkm::cuda)
|
||||||
add_library(vtkm_cuda INTERFACE)
|
add_library(vtkm_cuda INTERFACE)
|
||||||
set_target_properties(vtkm_cuda PROPERTIES EXPORT_NAME vtkm::cuda)
|
set_target_properties(vtkm_cuda PROPERTIES EXPORT_NAME vtkm::cuda)
|
||||||
|
|
||||||
@ -261,10 +261,12 @@ if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda)
|
|||||||
set_target_properties(vtkm_cuda PROPERTIES INTERFACE_CUDA_Architecture_Flags "${arch_flags}")
|
set_target_properties(vtkm_cuda PROPERTIES INTERFACE_CUDA_Architecture_Flags "${arch_flags}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(vtkm::cuda ALIAS vtkm_cuda)
|
if (NOT TARGET vtkm::cuda)
|
||||||
|
add_library(vtkm::cuda ALIAS vtkm_cuda)
|
||||||
|
|
||||||
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
|
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
|
||||||
install(TARGETS vtkm_cuda EXPORT ${VTKm_EXPORT_NAME})
|
install(TARGETS vtkm_cuda EXPORT ${VTKm_EXPORT_NAME})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
## this software.
|
## this software.
|
||||||
##============================================================================
|
##============================================================================
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
function(vtkm_test_install )
|
function(vtkm_test_install )
|
||||||
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
|
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
|
||||||
set(command_args
|
set(command_args
|
||||||
@ -59,14 +60,39 @@ function(vtkm_test_install )
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
function(vtkm_generate_install_build_options file_loc_var)
|
||||||
|
#This generated file ensures that the adaptor's CMakeCache ends up with
|
||||||
|
#the same CMAKE_PREFIX_PATH that VTK-m's does, even if that has multiple
|
||||||
|
#paths in it. It is necessary because ctest's argument parsing in the
|
||||||
|
#custom command below destroys path separators.
|
||||||
|
#Note: the generated file will become stale if these variables change.
|
||||||
|
#In that case it will need manual intervention (remove it) to fix.
|
||||||
|
file(GENERATE
|
||||||
|
OUTPUT "${${file_loc_var}}"
|
||||||
|
CONTENT
|
||||||
|
"
|
||||||
|
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING \"\")
|
||||||
|
set(CMAKE_PREFIX_PATH ${install_prefix} CACHE STRING \"\")
|
||||||
|
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH \"\")
|
||||||
|
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING \"\")
|
||||||
|
set(CMAKE_CUDA_COMPILER ${CMAKE_CUDA_COMPILER} CACHE FILEPATH \"\")
|
||||||
|
set(CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} CACHE STRING \"\")
|
||||||
|
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CUDA_HOST_COMPILER} CACHE FILEPATH \"\")
|
||||||
|
"
|
||||||
|
)
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
function(test_against_installed_vtkm dir)
|
function(vtkm_test_against_install dir)
|
||||||
set(name ${dir})
|
set(name ${dir})
|
||||||
set(install_prefix "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_install")
|
set(install_prefix "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_install")
|
||||||
set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}/${name}/")
|
set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}/${name}/")
|
||||||
set(build_dir "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_build/test_${name}/")
|
set(build_dir "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_build/test_${name}/")
|
||||||
|
|
||||||
|
set(build_config "${build_dir}/build_options.cmake")
|
||||||
|
vtkm_generate_install_build_options(build_config)
|
||||||
|
|
||||||
#determine if the test is expected to compile or fail to build. We use
|
#determine if the test is expected to compile or fail to build. We use
|
||||||
#this information to built the test name to make it clear to the user
|
#this information to built the test name to make it clear to the user
|
||||||
@ -80,11 +106,7 @@ function(test_against_installed_vtkm dir)
|
|||||||
--build-and-test ${src_dir} ${build_dir}
|
--build-and-test ${src_dir} ${build_dir}
|
||||||
--build-generator ${CMAKE_GENERATOR}
|
--build-generator ${CMAKE_GENERATOR}
|
||||||
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
||||||
--build-options
|
--build-options -C "${build_config}"
|
||||||
-DCMAKE_PREFIX_PATH:STRING=${install_prefix}
|
|
||||||
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
|
|
||||||
-DCMAKE_CUDA_COMPILER:FILEPATH=${CMAKE_CUDA_COMPILER}
|
|
||||||
-DCMAKE_CUDA_HOST_COMPILER:FILEPATH=${CMAKE_CUDA_HOST_COMPILER}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set_tests_properties(${build_name} PROPERTIES LABELS ${test_label} )
|
set_tests_properties(${build_name} PROPERTIES LABELS ${test_label} )
|
||||||
|
@ -47,6 +47,6 @@ add_subdirectory(unified_memory)
|
|||||||
if (VTKm_ENABLE_TESTING)
|
if (VTKm_ENABLE_TESTING)
|
||||||
# These need to be fast to build as they will
|
# These need to be fast to build as they will
|
||||||
# be built each time we run the test
|
# be built each time we run the test
|
||||||
test_against_installed_vtkm(rendering)
|
vtkm_test_against_install(rendering)
|
||||||
test_against_installed_vtkm(histogram)
|
vtkm_test_against_install(histogram)
|
||||||
endif()
|
endif()
|
||||||
|
@ -34,7 +34,6 @@ if(TARGET vtkm_rendering)
|
|||||||
set(srcs ${cuda_srcs})
|
set(srcs ${cuda_srcs})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "srcs: ${srcs}")
|
|
||||||
add_executable(Demo ${srcs})
|
add_executable(Demo ${srcs})
|
||||||
target_link_libraries(Demo PRIVATE vtkm_rendering)
|
target_link_libraries(Demo PRIVATE vtkm_rendering)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user