From e08dcdf6220d439a46f67d773812b5462adf7d0e Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 14 May 2021 14:10:55 +0200 Subject: [PATCH] gl: Try GLVND 'opengl' and 'glx' first This fixes targetting desktop OpenGL without libGL.so Part-of: --- gst-libs/gst/gl/meson.build | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/gst-libs/gst/gl/meson.build b/gst-libs/gst/gl/meson.build index 7694883..bfaaf1d 100644 --- a/gst-libs/gst/gl/meson.build +++ b/gst-libs/gst/gl/meson.build @@ -309,7 +309,14 @@ endif # Desktop OpenGL checks gl_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' gl_dep = dependency('appleframeworks', modules : ['OpenGL'], required : false) else @@ -336,20 +343,24 @@ if need_api_opengl != 'no' or need_platform_glx != 'no' gl_includes += [compat_includes] endif endif +endif - if host_system == 'darwin' - glx_dep = cc.find_library('GL', required : false) - else - glx_dep = gl_dep - endif - - if need_api_opengl == 'no' - gl_dep = unneeded_dep - endif - if need_platform_glx == 'no' - glx_dep = unneeded_dep +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' + glx_dep = cc.find_library('GL', required : false) + elif gl_dep.found() + glx_dep = gl_dep + elif need_platform_glx == 'yes' + error ('Could not find requested GLX library') + endif endif +endif +if need_api_opengl != 'no' opengl_includes = '' if host_system == 'darwin' opengl_includes += ''' -- 2.7.4