VTK-m can now build and test against temporary installed vtkm.

We now have a couple of the examples also being built against
the installed version of VTK-m as a test. This allow us to verify
that VTK-m installs and can be found properly.
This commit is contained in:
Robert Maynard 2019-04-03 12:32:42 -04:00
parent 04254dbd25
commit 001d1b0f47
8 changed files with 114 additions and 45 deletions

@ -48,7 +48,7 @@ function(vtkm_pyexpander_generated_file generated_file_name)
-DPYEXPANDER_COMMAND=${PYEXPANDER_COMMAND}
-DSOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name}
-DGENERATED_FILE=${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name}
-P ${VTKm_CMAKE_MODULE_PATH}/VTKmCheckPyexpander.cmake
-P ${VTKm_CMAKE_MODULE_PATH}/testing/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}"

@ -28,7 +28,7 @@
# -DVTKm_INSTALL_INCLUDE_DIR=<VTKm_INSTALL_INCLUDE_DIR>
# -DVTKm_ENABLE_RENDERING=<VTKm_ENABLE_RENDERING>
# -DVTKm_ENABLE_LOGGING=<VTKm_ENABLE_LOGGING>
# -P <VTKm_SOURCE_DIR>/CMake/VTKMCheckSourceInInstall.cmake
# -P <VTKm_SOURCE_DIR>/CMake/testing/VTKMCheckSourceInInstall.cmake
##
if (NOT DEFINED MODE)

@ -0,0 +1,92 @@
##============================================================================
## 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.
##============================================================================
function(vtkm_test_install )
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
set(command_args
"-DVTKm_SOURCE_DIR=${VTKm_SOURCE_DIR}"
"-DVTKm_BINARY_DIR=${VTKm_BINARY_DIR}"
"-DVTKm_INSTALL_INCLUDE_DIR=${VTKm_INSTALL_INCLUDE_DIR}"
"-DVTKm_ENABLE_RENDERING=${VTKm_ENABLE_RENDERING}"
"-DVTKm_ENABLE_LOGGING=${VTKm_ENABLE_LOGGING}"
)
#By having this as separate tests using fixtures, it will allow us in
#the future to write tests that build against the installed version
add_test(NAME TestInstallSetup
COMMAND ${CMAKE_COMMAND}
"-DMODE=INSTALL"
${command_args}
-P "${VTKm_SOURCE_DIR}/CMake/testing/VTKmCheckSourceInInstall.cmake"
)
add_test(NAME SourceInInstall
COMMAND ${CMAKE_COMMAND}
"-DMODE=VERIFY"
${command_args}
-P "${VTKm_SOURCE_DIR}/CMake/testing/VTKmCheckSourceInInstall.cmake"
)
add_test(NAME TestInstallCleanup
COMMAND ${CMAKE_COMMAND}
"-DMODE=CLEANUP"
${command_args}
-P "${VTKm_SOURCE_DIR}/CMake/testing/VTKmCheckSourceInInstall.cmake"
)
set_tests_properties(TestInstallSetup PROPERTIES FIXTURES_SETUP vtkm_installed)
set_tests_properties(SourceInInstall PROPERTIES FIXTURES_REQUIRED vtkm_installed)
set_tests_properties(TestInstallCleanup PROPERTIES FIXTURES_CLEANUP vtkm_installed)
set_tests_properties(SourceInInstall PROPERTIES LABELS "TEST_INSTALL" )
endif()
endfunction()
# -----------------------------------------------------------------------------
function(test_against_installed_vtkm dir)
set(name ${dir})
set(install_prefix "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_install")
set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}/${name}/")
set(build_dir "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_build/test_${name}/")
#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
#what a 'passing' test means
set(retcode 0)
set(build_name "${name}_built_against_test_install")
set(test_label "TEST_INSTALL")
add_test(NAME ${build_name}
COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test ${src_dir} ${build_dir}
--build-generator ${CMAKE_GENERATOR}
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options
-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 FIXTURES_REQUIRED vtkm_installed)
endfunction()

@ -299,12 +299,6 @@ if(VTKm_ENABLE_BENCHMARKS)
add_subdirectory(benchmarking)
endif()
#-----------------------------------------------------------------------------
# Build examples
if(VTKm_ENABLE_EXAMPLES)
add_subdirectory(examples)
endif(VTKm_ENABLE_EXAMPLES)
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)
@ -315,7 +309,7 @@ if (VTKm_ENABLE_TESTING)
# SourceInBuild checks that all source files are listed in the build
# SourceInInstall checks that all source files are installed in the build
add_test(NAME SystemInformation
COMMAND ${CMAKE_COMMAND} "-DVTKm_SOURCE_DIR=${VTKm_SOURCE_DIR}" "-DVTKm_BINARY_DIR=${VTKm_BINARY_DIR}" -P "${VTKm_SOURCE_DIR}/CMake/VTKmSystemInformation.cmake"
COMMAND ${CMAKE_COMMAND} "-DVTKm_SOURCE_DIR=${VTKm_SOURCE_DIR}" "-DVTKm_BINARY_DIR=${VTKm_BINARY_DIR}" -P "${VTKm_SOURCE_DIR}/CMake/testing/VTKmSystemInformation.cmake"
)
add_test(NAME CopyrightStatement
COMMAND ${CMAKE_COMMAND} "-DVTKm_SOURCE_DIR=${VTKm_SOURCE_DIR}" -P "${VTKm_SOURCE_DIR}/CMake/VTKmCheckCopyright.cmake"
@ -323,40 +317,14 @@ if (VTKm_ENABLE_TESTING)
# increase timeout since on some machines CopyrightStatement test takes a long time.
set_tests_properties(CopyrightStatement PROPERTIES TIMEOUT 300)
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
set(command_args
"-DVTKm_SOURCE_DIR=${VTKm_SOURCE_DIR}"
"-DVTKm_BINARY_DIR=${VTKm_BINARY_DIR}"
"-DVTKm_INSTALL_INCLUDE_DIR=${VTKm_INSTALL_INCLUDE_DIR}"
"-DVTKm_ENABLE_RENDERING=${VTKm_ENABLE_RENDERING}"
"-DVTKm_ENABLE_LOGGING=${VTKm_ENABLE_LOGGING}"
)
#By having this as separate tests using fixtures, it will allow us in
#the future to write tests that build against the installed version
add_test(NAME TestInstallSetup
COMMAND ${CMAKE_COMMAND}
"-DMODE=INSTALL"
${command_args}
-P "${VTKm_SOURCE_DIR}/CMake/VTKmCheckSourceInInstall.cmake"
)
add_test(NAME SourceInInstall
COMMAND ${CMAKE_COMMAND}
"-DMODE=VERIFY"
${command_args}
-P "${VTKm_SOURCE_DIR}/CMake/VTKmCheckSourceInInstall.cmake"
)
add_test(NAME TestInstallCleanup
COMMAND ${CMAKE_COMMAND}
"-DMODE=CLEANUP"
${command_args}
-P "${VTKm_SOURCE_DIR}/CMake/VTKmCheckSourceInInstall.cmake"
)
set_tests_properties(TestInstallSetup PROPERTIES FIXTURES_SETUP vtkm_installed)
set_tests_properties(SourceInInstall PROPERTIES FIXTURES_REQUIRED vtkm_installed)
set_tests_properties(TestInstallCleanup PROPERTIES FIXTURES_CLEANUP vtkm_installed)
endif()
# Setup the infrastructure to allow VTK-m to run tests against a temporary
# installed version of VTK-m.
include(testing/VTKmTestInstall)
vtkm_test_install()
endif()
#-----------------------------------------------------------------------------
# Build examples
if(VTKm_ENABLE_EXAMPLES)
add_subdirectory(examples)
endif(VTKm_ENABLE_EXAMPLES)

@ -42,3 +42,11 @@ add_subdirectory(streamline)
add_subdirectory(temporal_advection)
add_subdirectory(tetrahedra)
add_subdirectory(unified_memory)
if (VTKm_ENABLE_TESTING)
# These need to be fast to build as they will
# be built each time we run the test
test_against_installed_vtkm(rendering)
test_against_installed_vtkm(histogram)
endif()

@ -34,6 +34,7 @@ if(TARGET vtkm_rendering)
set(srcs ${cuda_srcs})
endif()
message(STATUS "srcs: ${srcs}")
add_executable(Demo ${srcs})
target_link_libraries(Demo PRIVATE vtkm_rendering)
endif()