CMake configuration definitions to enable OpenGL Interop

Copy all OpenGL interop related configurations from the DAX CMake files
This commit is contained in:
hschroot 2015-08-11 14:48:30 -07:00
parent 9622905c79
commit d943348060
4 changed files with 115 additions and 0 deletions

78
CMake/FindGLEW.cmake Normal file

@ -0,0 +1,78 @@
# - Find the OpenGL Extension Wrangler Library (GLEW)
# This module defines the following variables:
# GLEW_INCLUDE_DIRS - include directories for GLEW
# GLEW_LIBRARIES - libraries to link against GLEW
# GLEW_FOUND - true if GLEW has been found and can be used
#=============================================================================
# Copyright 2012 Benjamin Eikel
#
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ------------------------------------------------------------------------------
#
# The above copyright and license notice applies to distributions of
# CMake in source and binary form. Some source files contain additional
# notices of original copyright by their contributors; see each source
# for details. Third-party software packages supplied with CMake under
# compatible licenses provide their own copyright notices documented in
# corresponding subdirectories.
#
# ------------------------------------------------------------------------------
#
# CMake was initially developed by Kitware with the following sponsorship:
#
# * National Library of Medicine at the National Institutes of Health
# as part of the Insight Segmentation and Registration Toolkit (ITK).
#
# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
# Visualization Initiative.
#
# * National Alliance for Medical Image Computing (NAMIC) is funded by the
# National Institutes of Health through the NIH Roadmap for Medical Research,
# Grant U54 EB005149.
#
# * Kitware, Inc.
find_path(GLEW_INCLUDE_DIR GL/glew.h)
find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLEW
REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)

@ -157,6 +157,30 @@ unset(VTKM_USE_DOUBLE_PRECISION)
unset(VTKM_USE_64BIT_IDS)
#-----------------------------------------------------------------------------
# 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_package(Pyexpander)
#-----------------------------------------------------------------------------
@ -217,6 +241,9 @@ install(FILES ${VTKm_SOURCE_DIR}/LICENSE.txt
install(
FILES
${VTKm_SOURCE_DIR}/CMake/FindBoostHeaders.cmake
${VTKm_SOURCE_DIR}/CMake/FindGLEW.cmake
${VTKm_SOURCE_DIR}/CMake/FindTBB.cmake
${VTKm_SOURCE_DIR}/CMake/FindThrust.cmake
DESTINATION ${VTKm_INSTALL_CMAKE_MODULE_DIR}
)
@ -224,6 +251,7 @@ install(
install(
FILES
${VTKm_SOURCE_DIR}/CMake/UseVTKmSerial.cmake
${VTKm_SOURCE_DIR}/CMake/UseVTKmTBB.cmake
${VTKm_SOURCE_DIR}/CMake/UseVTKmCuda.cmake
DESTINATION ${VTKm_INSTALL_CMAKE_MODULE_DIR}
)

@ -48,6 +48,10 @@ vtkm_declare_headers(${headers})
add_subdirectory(testing)
add_subdirectory(internal)
if(VTKm_ENABLE_OPENGL_INTEROP)
add_subdirectory(opengl)
endif(VTKm_ENABLE_OPENGL_INTEROP)
#-----------------------------------------------------------------------------
#add the control and exec folders
add_subdirectory(cont)

@ -131,6 +131,11 @@
#define VTKM_THIRDPARTY_POST_INCLUDE
#endif
//Mark if we are building with interop enabled
#ifndef VTKm_ENABLE_OPENGL_INTEROP
#cmakedefine VTKm_ENABLE_OPENGL_INTEROP
#endif
// Determine whether we will use variadic templates (a new feature in C++11).
// Currently have VARIADIC_TEMPLATE support off.
#cmakedefine VTKM_NO_VARIADIC_TEMPLATE