Skip to content

Commit

Permalink
Add option for EGL and OpenGL preference. (#22)
Browse files Browse the repository at this point in the history
* Add VTK_OPENGL_HAS_EGL option

* Add OpenGL_GL_PREFERENCE option initialized by default to LEGACY

* Bump required version of CMake to 3.10. This is the version that supports the OpenGL_GL_PREFERENCE option.

Co-authored-by: Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
  • Loading branch information
2 people authored and jcfr committed Oct 10, 2018
1 parent 330ed92 commit b16b084
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.10)

project(VTKPythonPackage NONE)

Expand Down Expand Up @@ -61,6 +61,23 @@ if(VTKPythonPackage_SUPERBUILD)
option(VTK_Group_Web "Build VTK web module" OFF)
mark_as_advanced(VTK_Group_Web)

option(VTK_OPENGL_HAS_EGL "Use EGL for offscreen rendering" OFF)
mark_as_advanced(VTK_OPENGL_HAS_EGL)

# This is a Linux only option and the valid values can be either
# "LEGACY" or "GLVND". More information here:
# https://cmake.org/cmake/help/git-stage/policy/CMP0072.html
if(UNIX AND NOT APPLE)
set(OpenGL_GL_PREFERENCE "LEGACY" CACHE STRING "Set the preferred OpenGL library")

if(NOT OpenGL_GL_PREFERENCE MATCHES "^(LEGACY|GLVND)$")
message(FATAL_ERROR "Unknown value for OpenGL_GL_PREFERENCE. Valid values are LEGACY or GLVND")
endif()

# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "LEGACY" "GLVND")

This comment has been minimized.

Copy link
@thewtex

thewtex Oct 24, 2018

Member

Should this be CMAKE_BUILD_TYPE -> OpenGL_GL_PREFERENCE ?

CC @prabhuramachandran @jcfr

This comment has been minimized.

Copy link
@jcfr

jcfr Oct 24, 2018

Collaborator

Good catch. Indeed, would you mind creating a PR ?

This comment has been minimized.

Copy link
@thewtex

thewtex Oct 24, 2018

Member

Et voila: #23

endif()

option(VTK_OPENGL_HAS_OSMESA "Use OSMesa for offscreen rendering" OFF)
mark_as_advanced(VTK_OPENGL_HAS_OSMESA)
if(VTK_OPENGL_HAS_OSMESA OR APPLE OR WIN32)
Expand All @@ -69,6 +86,13 @@ if(VTKPythonPackage_SUPERBUILD)
set(VTK_USE_X ON)
endif()


if(UNIX AND NOT APPLE)
list(APPEND ep_common_cmake_cache_args
-DOpenGL_GL_PREFERENCE:STRING=${OpenGL_GL_PREFERENCE})
endif()


#-----------------------------------------------------------------------------
include(ExternalProject)

Expand Down Expand Up @@ -218,6 +242,7 @@ if(VTKPythonPackage_SUPERBUILD)
-DVTK_Group_Qt:BOOL=OFF # XXX Enabled this later
-DVTK_RENDERING_BACKEND:STRING=OpenGL2
-DVTK_OPENGL_HAS_OSMESA:BOOL=${VTK_OPENGL_HAS_OSMESA}
-DVTK_OPENGL_HAS_EGL:BOOL=${VTK_OPENGL_HAS_EGL}
-DVTK_USE_X:BOOL=${VTK_USE_X}

# Module options
Expand Down

0 comments on commit b16b084

Please sign in to comment.