From fb0da7f2debf1a11de9cadc90726a56ac7c4c3d6 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 4 May 2018 14:58:11 -0400 Subject: [PATCH] Allow vtkm_find_gl CMake function to be used no matter vtk-m settings Previously vtkm_find_gl was only usable when rendering was enabled. This is problematic as examples would use vtkm_find_gl even if they didn't use vtkm rendering library. --- CMake/VTKmConfig.cmake.in | 5 +---- CMake/VTKmRenderingContexts.cmake | 9 +++++---- vtkm/rendering/CMakeLists.txt | 5 ++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CMake/VTKmConfig.cmake.in b/CMake/VTKmConfig.cmake.in index f98dbd832..eb513f895 100644 --- a/CMake/VTKmConfig.cmake.in +++ b/CMake/VTKmConfig.cmake.in @@ -92,7 +92,4 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${VTKm_CMAKE_MODULE_PATH}) # This includes a host of functions used by VTK-m CMake. include(VTKmWrappers) - -if(VTKm_ENABLE_RENDERING) - include(VTKmRenderingContexts) -endif() +include(VTKmRenderingContexts) diff --git a/CMake/VTKmRenderingContexts.cmake b/CMake/VTKmRenderingContexts.cmake index 411847cdc..e3362de77 100644 --- a/CMake/VTKmRenderingContexts.cmake +++ b/CMake/VTKmRenderingContexts.cmake @@ -94,12 +94,13 @@ if(VTKm_ENABLE_GL_CONTEXT OR endif() #----------------------------------------------------------------------------- -if(TARGET vtkm_rendering_gl_context) - return() +if(VTKm_ENABLE_RENDERING) + if(TARGET vtkm_rendering_gl_context) + return() + endif() + add_library(vtkm_rendering_gl_context INTERFACE) endif() -add_library(vtkm_rendering_gl_context INTERFACE) - #----------------------------------------------------------------------------- if(VTKm_ENABLE_GL_CONTEXT) if(TARGET OpenGL::GLX) diff --git a/vtkm/rendering/CMakeLists.txt b/vtkm/rendering/CMakeLists.txt index a148d3bd6..b0e38a5de 100644 --- a/vtkm/rendering/CMakeLists.txt +++ b/vtkm/rendering/CMakeLists.txt @@ -18,6 +18,10 @@ ## this software. ##============================================================================ +#unconditionally include rendering contexts so that the helper functions +#are around even if rendering isn't enabled +include(VTKmRenderingContexts) + if(NOT VTKm_ENABLE_RENDERING) return() endif() @@ -190,7 +194,6 @@ if(UNIX AND NOT APPLE) endif() #----------------------------------------------------------------------------- -include(VTKmRenderingContexts) target_link_libraries(vtkm_rendering PUBLIC vtkm_rendering_gl_context) if(NOT VTKm_INSTALL_ONLY_LIBRARIES)