mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-08 03:18:58 +00:00
Refactor VTK-m to make the interop code non-conditional.
This commit is contained in:
parent
0d7b199cf1
commit
8e2751e1a4
@ -65,7 +65,6 @@ endif()
|
||||
set(VTKm_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
|
||||
set(VTKm_ENABLE_CUDA "@VTKm_ENABLE_CUDA@")
|
||||
set(VTKm_ENABLE_TBB "@VTKm_ENABLE_TBB@")
|
||||
set(VTKm_ENABLE_OPENGL_INTEROP "@VTKm_ENABLE_OPENGL_INTEROP@")
|
||||
set(VTKm_ENABLE_OSMESA "@VTKm_ENABLE_OSMESA@")
|
||||
set(VTKm_ENABLE_RENDERING "@VTKm_ENABLE_RENDERING@")
|
||||
|
||||
|
@ -41,7 +41,6 @@ set(VTKm_AVAILABLE_COMPONENTS
|
||||
EGL
|
||||
GLFW
|
||||
GLUT
|
||||
Interop
|
||||
Rendering
|
||||
TBB
|
||||
CUDA
|
||||
@ -162,7 +161,6 @@ macro(vtkm_configure_component_OpenGL)
|
||||
#explicitly or else in release mode we get sigsegv on launch
|
||||
if(UNIX)
|
||||
find_package(Threads ${VTKm_FIND_PACKAGE_QUIETLY})
|
||||
list(APPEND vtkm_interop_dependent_vars CMAKE_USE_PTHREADS_INIT)
|
||||
list(APPEND vtkm_opengl_libraries ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
@ -232,14 +230,6 @@ macro(vtkm_configure_component_GLUT)
|
||||
)
|
||||
endmacro(vtkm_configure_component_GLUT)
|
||||
|
||||
macro(vtkm_configure_component_Interop)
|
||||
vtkm_configure_component_OpenGL()
|
||||
|
||||
vtkm_finish_configure_component(Interop
|
||||
DEPENDENT_VARIABLES VTKm_OpenGL_FOUND VTKm_ENABLE_OPENGL_INTEROP
|
||||
)
|
||||
endmacro(vtkm_configure_component_Interop)
|
||||
|
||||
macro(vtkm_configure_component_Rendering)
|
||||
if(VTKm_ENABLE_RENDERING)
|
||||
vtkm_configure_component_OpenGL()
|
||||
|
@ -25,7 +25,7 @@ project(GameOfLife CXX)
|
||||
|
||||
#Find the VTK-m package
|
||||
find_package(VTKm REQUIRED
|
||||
OPTIONAL_COMPONENTS Serial CUDA TBB OpenGL GLUT Interop
|
||||
OPTIONAL_COMPONENTS Serial CUDA TBB OpenGL GLUT
|
||||
)
|
||||
|
||||
if(VTKm_CUDA_FOUND)
|
||||
|
@ -22,10 +22,10 @@
|
||||
|
||||
#Find the VTK-m package
|
||||
find_package(VTKm REQUIRED QUIET
|
||||
OPTIONAL_COMPONENTS Serial CUDA TBB OpenGL GLUT Interop
|
||||
OPTIONAL_COMPONENTS Serial CUDA TBB OpenGL GLUT
|
||||
)
|
||||
|
||||
if(VTKm_Interop_FOUND AND VTKm_OpenGL_FOUND AND VTKm_GLUT_FOUND)
|
||||
if(VTKm_OpenGL_FOUND AND VTKm_GLUT_FOUND)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_executable(HelloWorld_SERIAL HelloWorld.cxx LoadShaders.h)
|
||||
set_source_files_properties(LoadShaders.h PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
@ -29,8 +29,6 @@ set(VTKM_USE_64BIT_IDS ${VTKm_USE_64BIT_IDS})
|
||||
set(VTKM_ENABLE_CUDA ${VTKm_ENABLE_CUDA})
|
||||
set(VTKM_ENABLE_TBB ${VTKm_ENABLE_TBB})
|
||||
|
||||
set(VTKM_ENABLE_OPENGL_INTEROP ${VTKm_ENABLE_OPENGL_INTEROP})
|
||||
|
||||
vtkm_get_kit_name(kit_name kit_dir)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Configure.h.in
|
||||
${VTKm_BINARY_DIR}/include/${kit_dir}/Configure.h
|
||||
@ -38,8 +36,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Configure.h.in
|
||||
vtkm_install_headers(
|
||||
vtkm/internal ${VTKm_BINARY_DIR}/include/${kit_dir}/Configure.h)
|
||||
|
||||
unset(VTKM_ENABLE_OPENGL_INTEROP)
|
||||
|
||||
unset(VTKM_ENABLE_TBB)
|
||||
unset(VTKM_ENABLE_CUDA)
|
||||
|
||||
|
@ -255,11 +255,6 @@
|
||||
#cmakedefine VTKM_ENABLE_TBB
|
||||
#endif
|
||||
|
||||
//Mark if we are building with interop enabled
|
||||
#ifndef VTKM_ENABLE_OPENGL_INTEROP
|
||||
#cmakedefine VTKM_ENABLE_OPENGL_INTEROP
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L || \
|
||||
( defined(VTKM_MSVC) && _MSC_VER >= 1800 ) || \
|
||||
( defined(VTKM_ICC) && defined(__INTEL_CXX11_MODE__) )
|
||||
|
@ -18,33 +18,23 @@
|
||||
## this software.
|
||||
##============================================================================
|
||||
|
||||
# Determine if we actually want to compile OpenGL Interop.
|
||||
# We defer declaration of the option because whether we offer it depends on
|
||||
# dependent components that are not loaded in the base directories.
|
||||
vtkm_configure_component_OpenGL()
|
||||
set(headers
|
||||
BufferState.h
|
||||
TransferToOpenGL.h
|
||||
)
|
||||
|
||||
include(CMakeDependentOption)
|
||||
if(VTKm_ENABLE_TESTING)
|
||||
# Determine if we actually want to compile OpenGL Interop tests.
|
||||
vtkm_configure_component_OpenGL()
|
||||
endif()
|
||||
|
||||
cmake_dependent_option(
|
||||
VTKm_ENABLE_OPENGL_INTEROP "Enable OpenGL Interop" ON
|
||||
"VTKm_OpenGL_FOUND" OFF)
|
||||
#-----------------------------------------------------------------------------
|
||||
add_subdirectory(internal)
|
||||
|
||||
if(VTKm_ENABLE_OPENGL_INTEROP)
|
||||
vtkm_configure_component_Interop()
|
||||
if(NOT VTKm_Interop_FOUND)
|
||||
message(SEND_ERROR "Could not configure for OpenGL Interop. Either configure necessary subcomponents or turn off VTKm_ENABLE_OPENGL_INTEROP.")
|
||||
endif()
|
||||
|
||||
set(headers
|
||||
BufferState.h
|
||||
TransferToOpenGL.h
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
add_subdirectory(internal)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
vtkm_declare_headers(${headers})
|
||||
#-----------------------------------------------------------------------------
|
||||
vtkm_declare_headers(${headers} TESTABLE FALSE)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
if(VTKm_OpenGL_FOUND)
|
||||
add_subdirectory(testing)
|
||||
endif()
|
||||
|
@ -25,6 +25,9 @@ set(headers
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
vtkm_declare_headers(${headers})
|
||||
vtkm_declare_headers(${headers} TESTABLE FALSE)
|
||||
|
||||
add_subdirectory(testing)
|
||||
#-----------------------------------------------------------------------------
|
||||
if(VTKm_OpenGL_FOUND)
|
||||
add_subdirectory(testing)
|
||||
endif()
|
||||
|
@ -23,12 +23,9 @@
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <vtkm/interop/internal/BufferTypePicker.h>
|
||||
|
||||
namespace
|
||||
|
@ -17,6 +17,7 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#include <GL/glew.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/interop/internal/OpenGLHeaders.h>
|
||||
|
||||
|
@ -54,7 +54,7 @@ else()
|
||||
endif()
|
||||
|
||||
|
||||
vtkm_declare_headers(${headers})
|
||||
vtkm_declare_headers(${headers} TESTABLE FALSE)
|
||||
vtkm_unit_tests(SOURCES ${unit_tests})
|
||||
if(needs_rendering)
|
||||
target_link_libraries(UnitTests_vtkm_interop_testing PRIVATE vtkm_rendering)
|
||||
|
@ -17,7 +17,7 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <vtkm/interop/testing/TestingTransferFancyHandles.h>
|
||||
#include <vtkm/rendering/CanvasEGL.h>
|
||||
|
||||
|
@ -17,6 +17,15 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
// OpenGL Graphics includes
|
||||
//glew needs to go before glut
|
||||
#include <GL/glew.h>
|
||||
#include <vtkm/interop/internal/OpenGLHeaders.h>
|
||||
#if defined(__APPLE__)
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
#include <vtkm/interop/testing/TestingTransferFancyHandles.h>
|
||||
|
||||
@ -26,15 +35,6 @@
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
// OpenGL Graphics includes
|
||||
//glew needs to go before glut
|
||||
#include <vtkm/interop/internal/OpenGLHeaders.h>
|
||||
#if defined(__APPLE__)
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
#if defined(VTKM_GCC) && defined(VTKM_POSIX) && !defined(__APPLE__)
|
||||
//
|
||||
// 1. Some Linux distributions default linker implicitly enables the as-needed
|
||||
|
@ -18,6 +18,7 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <vtkm/interop/testing/TestingTransferFancyHandles.h>
|
||||
#include <vtkm/rendering/CanvasOSMesa.h>
|
||||
|
||||
|
@ -17,13 +17,13 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
//This sets up testing with the default device adapter and array container
|
||||
|
||||
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
|
||||
#include <GL/glew.h>
|
||||
#include <vtkm/interop/testing/TestingOpenGLInterop.h>
|
||||
#include <vtkm/rendering/CanvasEGL.h>
|
||||
|
||||
//This sets up testing with the default device adapter and array container
|
||||
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
|
||||
|
||||
int UnitTestTransferEGL(int, char* [])
|
||||
{
|
||||
//get egl canvas to construct a context for us
|
||||
|
@ -17,6 +17,15 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
// OpenGL Graphics includes
|
||||
//glew needs to go before glut
|
||||
#include <GL/glew.h>
|
||||
#include <vtkm/interop/internal/OpenGLHeaders.h>
|
||||
#if defined(__APPLE__)
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
//This sets up testing with the default device adapter and array container
|
||||
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
|
||||
@ -28,15 +37,6 @@
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
// OpenGL Graphics includes
|
||||
//glew needs to go before glut
|
||||
#include <vtkm/interop/internal/OpenGLHeaders.h>
|
||||
#if defined(__APPLE__)
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
#if defined(VTKM_GCC) && defined(VTKM_POSIX) && !defined(__APPLE__)
|
||||
//
|
||||
// 1. Some Linux distributions default linker implicitly enables the as-needed
|
||||
|
@ -17,13 +17,13 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
//This sets up testing with the default device adapter and array container
|
||||
|
||||
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
|
||||
#include <GL/glew.h>
|
||||
#include <vtkm/interop/testing/TestingOpenGLInterop.h>
|
||||
#include <vtkm/rendering/CanvasOSMesa.h>
|
||||
|
||||
//This sets up testing with the default device adapter and array container
|
||||
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
|
||||
|
||||
int UnitTestTransferOSMesa(int, char* [])
|
||||
{
|
||||
//get osmesa canvas to construct a context for us
|
||||
|
Loading…
Reference in New Issue
Block a user