Commit 245097a6 authored by jcfr's avatar jcfr

BUG: Fix linux package removing dependency to GLVND libraries

By setting OpenGL_GL_PREFERENCE to LEGACY, this commit ensures that
the applications and libraries are linked against libGL.so (legacy) instead
of libOpenGL.so and libGLX.so (GL Vendor Neutral Dispatch library). It allows
to run the application on system where only libGL is available.

It fixes a regression introduced in r27988 (COMP: Update CMake minimum required
version from 3.5 to 3.13) after which one CMP0072 was set to NEW and led to
have the GLVND libraries being used by default.

Detailed explanation about GLVND (thanks @chuckatkins):
libOpenGL.so and libGLX.so are actually just the stub GLVND interface
libraries with no implementation behind them. GLVND uses a config file
to locate and dlopen the implementation at runtime like a plugin
(/usr/lib64/libGLX_nvidia.so.418.39 for instance).
So it's not really suitable for redistribution unless an implementation
like a glvnd-enabled mesa and associated config files are also packaged.
For broad redistributability, it is preferable to use use the legacy libGL
for now so at runtime it will be available on most systems.
That will likely need to be the case for the next few years until
the non-glvnd implementations are much less common.
Co-authored-by: Chuck Atkins's avatarChuck Atkins <chuck.atkins@kitware.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@27996 3bd1e089-480b-0410-8dfb-8563597acbee
parent 72bc6b4d
......@@ -455,6 +455,14 @@ include(SlicerVersion)
set(Slicer_EXTENSIONS_DIRBASENAME "Extensions")
set(Slicer_EXTENSIONS_DIRNAME "${Slicer_EXTENSIONS_DIRBASENAME}-${Slicer_WC_REVISION}")
#-----------------------------------------------------------------------------
# Slicer OpenGL Options
#-----------------------------------------------------------------------------
if(UNIX AND NOT APPLE)
set(OpenGL_GL_PREFERENCE "LEGACY")
mark_as_superbuild(OpenGL_GL_PREFERENCE:STRING)
endif()
#-----------------------------------------------------------------------------
# Slicer VTK Options
#-----------------------------------------------------------------------------
......
......@@ -99,6 +99,14 @@ if((NOT DEFINED VTK_DIR OR NOT DEFINED VTK_SOURCE_DIR) AND NOT Slicer_USE_SYSTEM
-DModule_vtkRenderingFreeTypeFontConfig:BOOL=ON
)
endif()
# OpenGL_GL_PREFERENCE
if(NOT "${OpenGL_GL_PREFERENCE}" MATCHES "^(LEGACY|GLVND)$")
message(FATAL_ERROR "OpenGL_GL_PREFERENCE variable is expected to be set to LEGACY or GLVND")
endif()
list(APPEND EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
-DOpenGL_GL_PREFERENCE:STRING=${OpenGL_GL_PREFERENCE}
)
endif()
# Disable Tk when Python wrapping is enabled
......
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