meson/gl: use separate deps for gl and glx

e.g. passing with_gl_api=gles2 would still build the glx code but not be
linking against the libGL library which is where the glX* functions are
located and would result in a linker error.

Solved by checking for the libGL library if either opengl or glx may be
needed and then disabling the corresponding deps as requested.
This commit is contained in:
Matthew Waters 2016-09-09 23:24:01 +10:00
parent a969048003
commit 32273c2c9c

View file

@ -208,7 +208,8 @@ gl_include_header = '''
# Desktop OpenGL checks # Desktop OpenGL checks
gl_dep = unneeded_dep gl_dep = unneeded_dep
if need_api_opengl != 'no' glx_dep = unneeded_dep
if need_api_opengl != 'no' and need_platform_glx != 'no'
gl_dep = dependency('GL', required : false) gl_dep = dependency('GL', required : false)
if not gl_dep.found() if not gl_dep.found()
# if host_machine.system() == 'windows' # if host_machine.system() == 'windows'
@ -224,6 +225,14 @@ if need_api_opengl != 'no'
endif endif
endif endif
glx_dep = gl_dep
if need_api_opengl == 'no'
gl_dep = unneeded_dep
endif
if need_platform_glx == 'no'
glx_dep = unneeded_dep
endif
opengl_includes = ''' opengl_includes = '''
#ifdef __APPLE__ #ifdef __APPLE__
# include <OpenGL/OpenGL.h> # include <OpenGL/OpenGL.h>
@ -423,13 +432,13 @@ if need_win_x11 != 'no'
gl_winsys_deps += x11_dep gl_winsys_deps += x11_dep
enabled_gl_winsys += 'x11' enabled_gl_winsys += 'x11'
if need_platform_glx != 'no' if need_platform_glx != 'no' and glx_dep.found()
glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1) glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
gl_sources += [ gl_sources += [
'x11/gstglcontext_glx.c', 'x11/gstglcontext_glx.c',
] ]
# GLX is in the opengl library on linux # GLX is in the opengl library on linux
gl_platform_deps += gl_dep gl_platform_deps += glx_dep
enabled_gl_platforms += 'glx' enabled_gl_platforms += 'glx'
endif endif
elif need_win_x11 == 'yes' elif need_win_x11 == 'yes'