diff --git a/CMake/VTKmConfig.cmake.in b/CMake/VTKmConfig.cmake.in index 645e8b51a..bd498d4dd 100755 --- a/CMake/VTKmConfig.cmake.in +++ b/CMake/VTKmConfig.cmake.in @@ -52,6 +52,9 @@ if(VTKm_PACKAGE_IN_BUILD) set(VTKm_INCLUDE_DIRS ${VTKm_INCLUDE_DIRS} "@VTKm_SOURCE_DIR@") endif() +# Clear out the libraries. We will add more when loading components. +set(VTKm_LIBRARIES) + set(VTKm_REQUIRED_BOOST_VERSION "@VTKm_REQUIRED_BOOST_VERSION@") if(NOT VTKm_PACKAGE_IN_BUILD) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f1fb49a4..6bbcf07b2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,12 +229,6 @@ if (VTKm_BUILD_DOCUMENTATION) vtkm_build_documentation() endif() -#----------------------------------------------------------------------------- -# Build examples -if(VTKm_BUILD_EXAMPLES) - add_subdirectory(examples) -endif(VTKm_BUILD_EXAMPLES) - #----------------------------------------------------------------------------- # Ready files for find_package include(CMakePackageConfigHelpers) @@ -243,7 +237,16 @@ string(REPLACE ";" " " VTKm_AVAILABLE_COMPONENTS_LIST "${VTKm_AVAILABLE_COMPONENTS}" ) -set(VTKm_LOAD_COMPONENTS_COMMANDS " +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}) @@ -331,3 +334,9 @@ set(CPACK_PACKAGE_FILE_NAME "VTKm-${VTKm_VERSION}") set(CPACK_RESOURCE_FILE_LICENSE ${VTKm_SOURCE_DIR}/LICENSE.txt) set(CPACK_RESOURCE_FILE_README ${VTKm_SOURCE_DIR}/README.md) include(CPack) + +#----------------------------------------------------------------------------- +# Build examples +if(VTKm_BUILD_EXAMPLES) + add_subdirectory(examples) +endif(VTKm_BUILD_EXAMPLES) diff --git a/examples/clipping/CMakeLists.txt b/examples/clipping/CMakeLists.txt index b4c288a08..1f58bbc14 100644 --- a/examples/clipping/CMakeLists.txt +++ b/examples/clipping/CMakeLists.txt @@ -20,11 +20,10 @@ ## ##============================================================================= #Find the VTK-m package -find_package(VTKm QUIET REQUIRED COMPONENTS Base) - -vtkm_configure_component_Serial() -vtkm_configure_component_CUDA() -vtkm_configure_component_TBB() +find_package(VTKm REQUIRED QUIET + COMPONENTS Base + OPTIONAL_COMPONENTS Serial Cuda TBB + ) add_executable(Clipping_SERIAL Clipping.cxx) target_include_directories(Clipping_SERIAL PRIVATE ${VTKm_INCLUDE_DIRS}) diff --git a/examples/demo/CMakeLists.txt b/examples/demo/CMakeLists.txt index 6bd2ff536..70e28983e 100644 --- a/examples/demo/CMakeLists.txt +++ b/examples/demo/CMakeLists.txt @@ -21,15 +21,10 @@ ##============================================================================= #Find the VTK-m package -find_package(VTKm QUIET REQUIRED COMPONENTS Base) - -#configure the backend components -vtkm_configure_component_Serial() -vtkm_configure_component_CUDA() -vtkm_configure_component_TBB() - -#configure the OSMesa component -vtkm_configure_component_OSMESA() +find_package(VTKm QUIET REQUIRED + COMPONENTS Base + OPTIONAL_COMPONENTS Serial Cuda TBB OSMesa + ) if(VTKm_OSMesa_FOUND) diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt index c7d128071..7bfcb7f91 100755 --- a/examples/hello_world/CMakeLists.txt +++ b/examples/hello_world/CMakeLists.txt @@ -21,16 +21,10 @@ ##============================================================================= #Find the VTK-m package -find_package(VTKm QUIET REQUIRED COMPONENTS Base) - -#configure the backend components -vtkm_configure_component_Serial() -vtkm_configure_component_CUDA() -vtkm_configure_component_TBB() - -#configure the rendering / interop components -vtkm_configure_component_OpenGL() -vtkm_configure_component_Interop() +find_package(VTKm REQUIRED QUIET + COMPONENTS Base + OPTIONAL_COMPONENTS Serial Cuda TBB OpenGL Interop + ) find_package(GLUT) diff --git a/examples/isosurface/CMakeLists.txt b/examples/isosurface/CMakeLists.txt index 687451e9f..4c89437f7 100644 --- a/examples/isosurface/CMakeLists.txt +++ b/examples/isosurface/CMakeLists.txt @@ -21,12 +21,10 @@ ##============================================================================= #Find the VTK-m package -find_package(VTKm QUIET REQUIRED COMPONENTS Base) - -vtkm_configure_component_OpenGL() -vtkm_configure_component_Serial() -vtkm_configure_component_CUDA() -vtkm_configure_component_TBB() +find_package(VTKm REQUIRED QUIET + COMPONENTS Base + OPTIONAL_COMPONENTS Serial Cuda TBB OpenGL + ) find_package(GLUT) diff --git a/examples/multi_backend/CMakeLists.txt b/examples/multi_backend/CMakeLists.txt index ae8c7f648..c9025c67b 100644 --- a/examples/multi_backend/CMakeLists.txt +++ b/examples/multi_backend/CMakeLists.txt @@ -21,12 +21,10 @@ ##============================================================================= #Find the VTK-m package -find_package(VTKm QUIET REQUIRED COMPONENTS Base) - -#configure the backend components -vtkm_configure_component_Serial() -vtkm_configure_component_CUDA() -vtkm_configure_component_TBB() +find_package(VTKm REQUIRED QUIET + COMPONENTS Base + OPTIONAL_COMPONENTS Serial Cuda TBB + ) if(VTKm_CUDA_FOUND) # Cuda compiles do not respect target_include_directories diff --git a/examples/rendering/CMakeLists.txt b/examples/rendering/CMakeLists.txt index 798249a64..1d3e7bd8f 100644 --- a/examples/rendering/CMakeLists.txt +++ b/examples/rendering/CMakeLists.txt @@ -21,10 +21,10 @@ ##============================================================================= #Find the VTK-m package -find_package(VTKm QUIET REQUIRED COMPONENTS Base) - -vtkm_configure_component_OpenGL() -vtkm_configure_component_Serial() +find_package(VTKm REQUIRED QUIET + COMPONENTS Base + OPTIONAL_COMPONENTS Serial OpenGL + ) find_package(GLUT) diff --git a/examples/streamline/CMakeLists.txt b/examples/streamline/CMakeLists.txt index fd7f9b584..008394720 100644 --- a/examples/streamline/CMakeLists.txt +++ b/examples/streamline/CMakeLists.txt @@ -21,12 +21,10 @@ ##============================================================================= #Find the VTK-m package -find_package(VTKm QUIET REQUIRED COMPONENTS Base) - -vtkm_configure_component_OpenGL() -vtkm_configure_component_Serial() -vtkm_configure_component_CUDA() -vtkm_configure_component_TBB() +find_package(VTKm REQUIRED QUIET + COMPONENTS Base + OPTIONAL_COMPONENTS Serial Cuda TBB OpenGL + ) find_package(GLUT) diff --git a/examples/tetrahedra/CMakeLists.txt b/examples/tetrahedra/CMakeLists.txt index b8ad6482a..01ec51e56 100644 --- a/examples/tetrahedra/CMakeLists.txt +++ b/examples/tetrahedra/CMakeLists.txt @@ -21,12 +21,10 @@ ##============================================================================= #Find the VTK-m package -find_package(VTKm QUIET REQUIRED COMPONENTS Base) - -vtkm_configure_component_OpenGL() -vtkm_configure_component_Serial() -vtkm_configure_component_CUDA() -vtkm_configure_component_TBB() +find_package(VTKm REQUIRED QUIET + COMPONENTS Base + OPTIONAL_COMPONENTS Serial Cuda TBB OpenGL + ) find_package(GLUT) diff --git a/vtkm/CMakeLists.txt b/vtkm/CMakeLists.txt index c3c02c2eb..8ceb473b5 100644 --- a/vtkm/CMakeLists.txt +++ b/vtkm/CMakeLists.txt @@ -18,8 +18,6 @@ ## this software. ##============================================================================ -include_directories(${Boost_INCLUDE_DIRS}) - set(headers Assert.h BinaryPredicates.h diff --git a/vtkm/interop/testing/CMakeLists.txt b/vtkm/interop/testing/CMakeLists.txt index a795f8074..7975d4f0a 100644 --- a/vtkm/interop/testing/CMakeLists.txt +++ b/vtkm/interop/testing/CMakeLists.txt @@ -29,7 +29,10 @@ set(unit_tests ) # Need glut for these tests -if(GLUT_FOUND) +if(VTKm_ENABLE_OPENGL_TESTS) + list(APPEND VTKm_INCLUDE_DIRS ${GLUT_INCLUDE_DIR} ) + list(APPEND VTKm_LIBRARIES ${GLUT_LIBRARIES} ) + vtkm_declare_headers(${headers}) vtkm_unit_tests(SOURCES ${unit_tests})