gl: Try GLVND 'opengl' and 'glx' first

This fixes targetting desktop OpenGL without libGL.so

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1143>
This commit is contained in:
Haelwenn (lanodan) Monnier 2021-05-14 14:10:55 +02:00 committed by GStreamer Marge Bot
parent 9243418a23
commit e08dcdf622

View file

@ -309,7 +309,14 @@ endif
# Desktop OpenGL checks # Desktop OpenGL checks
gl_dep = unneeded_dep gl_dep = unneeded_dep
glx_dep = unneeded_dep glx_dep = unneeded_dep
if need_api_opengl != 'no' or need_platform_glx != 'no'
# (GLVND) OpenGL (without GLX) headers and interface
if need_api_opengl != 'no'
gl_dep = dependency('opengl', method: 'pkg-config', required : false)
endif
# non-GLVND aka Legacy OpenGL
if need_api_opengl != 'no' and not gl_dep.found()
if host_system == 'darwin' if host_system == 'darwin'
gl_dep = dependency('appleframeworks', modules : ['OpenGL'], required : false) gl_dep = dependency('appleframeworks', modules : ['OpenGL'], required : false)
else else
@ -336,20 +343,24 @@ if need_api_opengl != 'no' or need_platform_glx != 'no'
gl_includes += [compat_includes] gl_includes += [compat_includes]
endif endif
endif endif
endif
if need_platform_glx != 'no'
# (GLVND) GLX library and headers.
glx_dep = dependency('glx', method: 'pkg-config', required : false)
if not glx_dep.found()
if host_system == 'darwin' if host_system == 'darwin'
glx_dep = cc.find_library('GL', required : false) glx_dep = cc.find_library('GL', required : false)
else elif gl_dep.found()
glx_dep = gl_dep glx_dep = gl_dep
elif need_platform_glx == 'yes'
error ('Could not find requested GLX library')
endif
endif
endif endif
if need_api_opengl == 'no' if need_api_opengl != 'no'
gl_dep = unneeded_dep
endif
if need_platform_glx == 'no'
glx_dep = unneeded_dep
endif
opengl_includes = '' opengl_includes = ''
if host_system == 'darwin' if host_system == 'darwin'
opengl_includes += ''' opengl_includes += '''