Commit 039efd6b authored by Kenneth Moreland's avatar Kenneth Moreland

Fix some issues with OpenGL configuration

Change the OpenGL configuration to require GLEW as most of the OpenGL
code actually requires GLEW (or will as soon as the VBO branch gets
merged in).

Also removed some stray find_package commands and rearranged the
configuration to use the vtkm_configure_component_* commands instead.
parent d1d7ac54
......@@ -140,17 +140,38 @@ macro(vtkm_configure_component_OpenGL)
if(NOT VTKm_OSMesa_FOUND)
find_package(OpenGL ${VTKm_FIND_PACKAGE_QUIETLY})
vtkm_finish_configure_component(OpenGL
DEPENDENT_VARIABLES VTKm_Base_FOUND OPENGL_FOUND
ADD_INCLUDES ${OPENGL_INCLUDE_DIR}
ADD_LIBRARIES ${OPENGL_LIBRARIES}
)
set(vtkm_opengl_dependent_vars VTKm_Base_FOUND OPENGL_FOUND)
set(vtkm_opengl_includes ${OPENGL_INCLUDE_DIR})
set(vtkm_opengl_libraries ${OPENGL_LIBRARIES})
else()
# OSMesa comes with its own implementation of OpenGL. So if OSMesa has been
# found, then simply report that OpenGL has been found and use the includes
# and libraries already added for OSMesa.
set(VTKm_OpenGL_FOUND TRUE)
set(vtkm_opengl_dependent_vars)
set(vtkm_opengl_includes)
set(vtkm_opengl_libraries)
endif()
# Many OpenGL classes in VTK-m require GLEW (too many to try to separate them
# out and still get something worth using). So require that too.
find_package(GLEW ${VTKm_FIND_PACKAGE_QUIETLY})
list(APPEND vtkm_opengl_dependent_vars GLEW_FOUND)
list(APPEND vtkm_opengl_includes ${GLEW_INCLUDE_DIRS})
list(APPEND vtkm_opengl_libraries ${GLEW_LIBRARIES})
#on unix/linux Glew uses pthreads, so we need to find that, and link to it
#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()
vtkm_finish_configure_component(OpenGL
DEPENDENT_VARIABLES ${vtkm_opengl_dependent_vars}
ADD_INCLUDES ${vtkm_opengl_includes}
ADD_LIBRARIES ${vtkm_opengl_libraries}
)
endmacro(vtkm_configure_component_OpenGL)
macro(vtkm_configure_component_OSMesa)
......@@ -206,24 +227,8 @@ endmacro(vtkm_configure_component_GLUT)
macro(vtkm_configure_component_Interop)
vtkm_configure_component_OpenGL()
find_package(GLEW ${VTKm_FIND_PACKAGE_QUIETLY})
set(vtkm_interop_dependent_vars
VTKm_OpenGL_FOUND
VTKm_ENABLE_OPENGL_INTEROP
GLEW_FOUND
)
#on unix/linux Glew uses pthreads, so we need to find that, and link to it
#explicitly or else in release mode we get sigsegv on launch
if (VTKm_ENABLE_OPENGL_INTEROP AND UNIX)
find_package(Threads ${VTKm_FIND_PACKAGE_QUIETLY})
set(vtkm_interop_dependent_vars ${vtkm_interop_dependent_vars} CMAKE_USE_PTHREADS_INIT)
endif()
vtkm_finish_configure_component(Interop
DEPENDENT_VARIABLES ${vtkm_interop_dependent_vars}
ADD_INCLUDES ${GLEW_INCLUDE_DIRS}
ADD_LIBRARIES ${GLEW_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
DEPENDENT_VARIABLES VTKm_OpenGL_FOUND VTKm_ENABLE_OPENGL_INTEROP
)
endmacro(vtkm_configure_component_Interop)
......
......@@ -183,30 +183,6 @@ check_type_size(int VTKm_SIZE_INT BUILTIN_TYPES_ONLY)
check_type_size(long VTKm_SIZE_LONG BUILTIN_TYPES_ONLY)
check_type_size("long long" VTKm_SIZE_LONG_LONG BUILTIN_TYPES_ONLY)
#-----------------------------------------------------------------------------
# Find OpenGL and GLEW, if both are found we can enable
# the OpenGL Interop support. We use
include(CMakeDependentOption)
# enable Interop only if we have OpenGL and GLEW
find_package(OpenGL)
find_package(GLEW)
find_package(GLUT)
#dependent option reads, value to set, if condition is true, otherwise
#use last value
CMAKE_DEPENDENT_OPTION(VTKm_ENABLE_OPENGL_INTEROP
"Enable OpenGL Interop will require GLEW"
ON "OPENGL_FOUND;GLEW_FOUND" OFF)
#Only enable OpenGL Interop tests if we have Interop enabled
#and we have GLUT
#dependent option reads, value to set, if condition is true, otherwise
#use last value
CMAKE_DEPENDENT_OPTION(VTKm_ENABLE_OPENGL_TESTS
"Enable OpenGL Interop Render Window Tests"
ON "VTKm_ENABLE_OPENGL_INTEROP;GLUT_FOUND" OFF)
#-----------------------------------------------------------------------------
# Find the Python interpreter, which we will use during the build process
find_package(PythonInterp)
......
......@@ -54,16 +54,6 @@ vtkm_declare_headers(${headers})
add_subdirectory(testing)
add_subdirectory(internal)
if(VTKm_ENABLE_OPENGL_INTEROP)
add_subdirectory(interop)
endif(VTKm_ENABLE_OPENGL_INTEROP)
#-----------------------------------------------------------------------------
# Build rendering
if(VTKm_ENABLE_RENDERING)
add_subdirectory(rendering)
endif()
#-----------------------------------------------------------------------------
#add the control and exec folders
add_subdirectory(cont)
......@@ -77,6 +67,14 @@ add_subdirectory(worklet)
#add the filter folder
add_subdirectory(filter)
#-----------------------------------------------------------------------------
# Build rendering
if(VTKm_ENABLE_RENDERING)
add_subdirectory(rendering)
endif()
add_subdirectory(interop)
#-----------------------------------------------------------------------------
#add the benchmarking folder
add_subdirectory(benchmarking)
......
......@@ -18,22 +18,33 @@
## this software.
##============================================================================
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()
# 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()
include(CMakeDependentOption)
cmake_dependent_option(
VTKm_ENABLE_OPENGL_INTEROP "Enable OpenGL Interop" ON
"VTKm_OpenGL_FOUND" OFF)
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
)
set(headers
BufferState.h
TransferToOpenGL.h
)
#-----------------------------------------------------------------------------
add_subdirectory(internal)
#-----------------------------------------------------------------------------
add_subdirectory(internal)
#-----------------------------------------------------------------------------
vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
vtkm_declare_headers(${headers})
if(VTKm_ENABLE_OPENGL_TESTS)
add_subdirectory(testing)
endif()
......@@ -27,7 +27,4 @@ set(headers
#-----------------------------------------------------------------------------
vtkm_declare_headers(${headers})
#we currently don't have to check if we have glut for these tests
if(VTKm_ENABLE_OPENGL_TESTS)
add_subdirectory(testing)
endif()
add_subdirectory(testing)
......@@ -29,10 +29,8 @@ set(unit_tests
)
# Need glut for these tests
if(VTKm_ENABLE_OPENGL_TESTS)
list(APPEND VTKm_INCLUDE_DIRS ${GLUT_INCLUDE_DIR} )
list(APPEND VTKm_LIBRARIES ${GLUT_LIBRARIES} )
vtkm_configure_component_GLUT()
if(VTKm_GLUT_FOUND)
vtkm_declare_headers(${headers})
vtkm_unit_tests(SOURCES ${unit_tests})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment