1 if get_option('gl').disabled()
2 message('GStreamer OpenGL integration disabled via options.')
3 gstgl_dep = dependency('', required: false)
13 'gstglcolorconvert.c',
25 'gstgloverlaycompositor.c',
27 'gstglrenderbuffer.c',
29 'gstglshaderstrings.c',
52 'gstglcolorconvert.h',
62 'gstgloverlaycompositor.h',
64 'gstglrenderbuffer.h',
66 'gstglshaderstrings.h',
76 gl_headers = gir_gl_headers + [
80 gl_prototype_headers = [
81 'glprototypes/all_functions.h',
82 'glprototypes/base.h',
83 'glprototypes/blending.h',
84 'glprototypes/buffers.h',
85 'glprototypes/debug.h',
86 'glprototypes/eglimage.h',
88 'glprototypes/fixedfunction.h',
89 'glprototypes/gles.h',
90 'glprototypes/gstgl_compat.h',
91 'glprototypes/gstgl_gles2compat.h',
92 'glprototypes/opengl.h',
93 'glprototypes/query.h',
94 'glprototypes/shaders.h',
95 'glprototypes/sync.h',
100 gl_wayland_headers = []
101 gl_win32_headers = []
102 gl_cocoa_headers = []
105 glconf = configuration_data()
107 'GST_GL_HAVE_OPENGL',
110 'GST_GL_HAVE_GLES3EXT3_H',
112 'GST_GL_HAVE_WINDOW_X11',
113 'GST_GL_HAVE_WINDOW_COCOA',
114 'GST_GL_HAVE_WINDOW_WIN32',
115 'GST_GL_HAVE_WINDOW_WINRT',
116 'GST_GL_HAVE_WINDOW_WAYLAND',
117 'GST_GL_HAVE_WINDOW_ANDROID',
118 'GST_GL_HAVE_WINDOW_DISPMANX',
119 'GST_GL_HAVE_WINDOW_EAGL',
120 'GST_GL_HAVE_WINDOW_VIV_FB',
121 'GST_GL_HAVE_WINDOW_GBM',
123 'GST_GL_HAVE_PLATFORM_EGL',
124 'GST_GL_HAVE_PLATFORM_GLX',
125 'GST_GL_HAVE_PLATFORM_WGL',
126 'GST_GL_HAVE_PLATFORM_CGL',
127 'GST_GL_HAVE_PLATFORM_EAGL',
129 'GST_GL_HAVE_DMABUF',
130 'GST_GL_HAVE_VIV_DIRECTVIV',
132 'GST_GL_HAVE_GLEGLIMAGEOES',
133 'GST_GL_HAVE_GLCHAR',
134 'GST_GL_HAVE_GLSIZEIPTR',
135 'GST_GL_HAVE_GLINTPTR',
136 'GST_GL_HAVE_GLSYNC',
137 'GST_GL_HAVE_GLUINT64',
138 'GST_GL_HAVE_GLINT64',
139 'GST_GL_HAVE_EGLATTRIB',
140 'GST_GL_HAVE_EGLUINT64KHR',
143 foreach option : glconf_options
144 glconf.set10(option, false)
147 unneeded_dep = dependency('', required : false)
148 if unneeded_dep.found()
149 error ('Found unfindable dependency')
152 # OpenGL/GLES2 libraries
154 # GL platform - EGL, GLX, CGL, WGL, etc
155 gl_platform_deps = []
156 # GL winsys - wayland, X11, Cocoa, win32, etc
158 # other things we need.
160 # Other preprocessor arguments
166 enabled_gl_platforms = []
167 enabled_gl_winsys = []
169 # parse provided options
170 libegl_module_name = get_option('egl_module_name')
171 if libegl_module_name != ''
172 gl_cpp_args += ['-DGST_GL_LIBEGL_MODULE_NAME="@0@"'.format(libegl_module_name)]
174 libgles2_module_name = get_option('gles2_module_name')
175 if libgles2_module_name != ''
176 gl_cpp_args += ['-DGST_GL_LIBGLESV2_MODULE_NAME="@0@"'.format(libgles2_module_name)]
178 libgl_module_name = get_option('opengl_module_name')
179 if libgl_module_name != ''
180 gl_cpp_args += ['-DGST_GL_LIBGL_MODULE_NAME="@0@"'.format(libgl_module_name)]
183 gl_apis = get_option('gl_api')
184 if gl_apis.contains('auto')
185 need_api_opengl = 'auto'
186 need_api_gles2 = 'auto'
188 need_api_opengl = 'no'
189 need_api_gles2 = 'no'
190 foreach api : gl_apis
192 need_api_opengl = 'yes'
194 need_api_gles2 = 'yes'
196 error('Unsupported GL api provided ' + api)
201 gl_platforms = get_option('gl_platform')
202 if gl_platforms.contains('auto')
203 need_platform_egl = 'auto'
204 need_platform_glx = 'auto'
205 need_platform_cgl = 'auto'
206 need_platform_wgl = 'auto'
207 need_platform_eagl = 'auto'
209 need_platform_egl = 'no'
210 need_platform_glx = 'no'
211 need_platform_cgl = 'no'
212 need_platform_wgl = 'no'
213 need_platform_eagl = 'no'
214 foreach platform : gl_platforms
216 need_platform_egl = 'yes'
217 elif platform == 'glx'
218 need_platform_glx = 'yes'
219 elif platform == 'cgl'
220 need_platform_cgl = 'yes'
221 elif platform == 'wgl'
222 need_platform_wgl = 'yes'
223 elif platform == 'eagl'
224 need_platform_eagl = 'yes'
226 error('Unsupported GL platform provided ' + platform)
231 gl_winsys = get_option('gl_winsys')
232 if gl_winsys.contains('auto')
233 need_win_x11 = 'auto'
234 need_win_wayland = 'auto'
235 need_win_win32 = 'auto'
236 need_win_winrt = 'auto'
237 need_win_cocoa = 'auto'
238 need_win_eagl = 'auto'
239 need_win_dispmanx = 'auto'
240 need_win_viv_fb = 'auto'
241 need_win_gbm = 'auto'
242 need_win_android = 'auto'
245 need_win_wayland = 'no'
246 need_win_win32 = 'no'
247 need_win_winrt = 'no'
248 need_win_cocoa = 'no'
250 need_win_dispmanx = 'no'
251 need_win_viv_fb = 'no'
253 need_win_android = 'no'
254 foreach winsys : gl_winsys
257 elif winsys == 'wayland'
258 need_win_wayland = 'yes'
259 elif winsys == 'win32'
260 need_win_win32 = 'yes'
261 elif winsys == 'winrt'
262 need_win_winrt = 'yes'
263 elif winsys == 'cocoa'
264 need_win_cocoa = 'yes'
265 elif winsys == 'eagl'
266 need_win_eagl = 'yes'
267 elif winsys == 'dispmanx'
268 need_win_dispmanx = 'yes'
269 elif winsys == 'viv-fb'
270 need_win_viv_fb = 'yes'
273 elif winsys == 'android'
274 need_win_android = 'yes'
276 error('Unsupported GL winsys provided ' + winsys)
281 gl_include_header = '''
283 # pragma GCC diagnostic push
284 # pragma GCC diagnostic ignored "-Wredundant-decls"
286 #ifndef GL_GLEXT_PROTOTYPES
287 #define GL_GLEXT_PROTOTYPES 1
291 # convoluted way of getting at the subproject taking into account the wrap-mode
292 # so we don't download a subproject unless allowed
293 gl_header_dep = dependency('', fallback : ['gl-headers', 'gl_headers_dummy_dep'],
295 if gl_header_dep.type_name() == 'internal'
296 # this will only contain the includes of headers that are not found
297 compat_includes = subproject('gl-headers').get_variable('compatibility_includes')
302 # Desktop OpenGL checks
303 gl_dep = unneeded_dep
304 glx_dep = unneeded_dep
305 if need_api_opengl != 'no' or need_platform_glx != 'no'
306 if host_system == 'darwin'
307 gl_dep = dependency('appleframeworks', modules : ['OpenGL'], required : false)
309 # override meson's braindead gl detection on osx/windows/etc by forcing pkg-config
310 gl_dep = dependency('gl', method: 'pkg-config', required : false)
313 if not gl_dep.found()
314 if host_system == 'windows'
315 gl_dep = cc.find_library('opengl32', required : false)
317 gl_dep = cc.find_library('GL', required : false)
320 if not cc.has_header('GL/gl.h', include_directories : compat_includes)
321 gl_dep = unneeded_dep
324 if not gl_dep.found() and need_api_opengl == 'yes'
325 error ('Could not find requested OpenGL library')
329 gl_includes += [compat_includes]
333 if host_system == 'darwin'
334 glx_dep = cc.find_library('GL', required : false)
339 if need_api_opengl == 'no'
340 gl_dep = unneeded_dep
342 if need_platform_glx == 'no'
343 glx_dep = unneeded_dep
347 if host_system == 'darwin'
348 opengl_includes += '''
349 #include <OpenGL/OpenGL.h>
350 #include <OpenGL/gl.h>
351 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
352 # define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
353 # include <OpenGL/gl3.h>
357 opengl_includes += '''
359 # include <windows.h>
362 #if __WIN32__ || _WIN32
363 # include <GL/glext.h>
370 gles2_dep = unneeded_dep
373 if need_api_gles2 != 'no'
374 if host_system == 'ios'
375 gles2_dep = dependency('appleframeworks', modules : ['OpenGLES'], required : false)
377 gles2_dep = dependency('glesv2', required : false)
380 if not gles2_dep.found()
381 # if host_system == 'windows'
382 # elif host_system == ios
383 # gles2_dep = cc.find_library('GLESv2', required : false)
385 gles2_dep = cc.find_library('GLESv2', required : false)
388 if not cc.has_header('GLES2/gl2.h', include_directories : compat_includes)
389 gles2_dep = unneeded_dep
392 if not gles2_dep.found() and need_api_gles2 == 'yes'
393 error ('Could not find requested OpenGL ES library')
397 gl_includes += [compat_includes]
401 gles3_h = gles2_dep.found() and cc.has_header('GLES3/gl3.h', dependencies : gles2_dep, include_directories : compat_includes)
404 if host_system == 'ios'
406 # include <OpenGLES/ES2/gl.h>
407 # include <OpenGLES/ES2/glext.h>
411 gl_includes += [compat_includes]
412 gles3ext3_h = gles3_h and cc.has_header('GLES3/gl3ext.h', dependencies : gles2_dep, include_directories : compat_includes)
414 # include <GLES3/gl3.h>
415 # include <GLES2/gl2ext.h>'''
418 # include <GLES3/gl3ext.h>'''
422 # include <GLES2/gl2.h>
423 # include <GLES2/gl2ext.h>'''
428 # can we include both gles2 and opengl headers?
429 if gles2_dep.found() and gl_dep.found()
430 gl_include_block = gl_include_header + gles_includes + opengl_includes
431 # TODO: Revert to passing gl_include_block via prefix: once
432 # https://github.com/mesonbuild/meson/issues/2364 is fixed
433 if not cc.compiles(gl_include_block + '\n' + 'void f (void) {}',dependencies : [gles2_dep, gl_dep], include_directories : compat_includes)
434 message ('Cannot include both OpenGL and OpenGL ES headers')
435 if need_api_gles2 != 'yes'
436 gles2_dep = unneeded_dep
437 elif need_api_opengl != 'yes'
438 gl_dep = unneeded_dep
440 error('Both OpenGL and OpenGL ES were requested but cannot be included together')
444 gl_include_block = gl_include_header
446 gl_include_block += gles_includes
449 gl_include_block += opengl_includes
453 gl_lib_deps += gles2_dep
454 glconf.set10('GST_GL_HAVE_GLES2', 1)
456 glconf.set10('GST_GL_HAVE_GLES3', 1)
458 glconf.set10('GST_GL_HAVE_GLES3EXT3_H', 1)
461 enabled_gl_apis += 'gles2'
465 gl_lib_deps += gl_dep
466 glconf.set10('GST_GL_HAVE_OPENGL', 1)
467 enabled_gl_apis += 'gl'
471 egl_dep = unneeded_dep
472 if need_platform_egl != 'no'
473 egl_dep = dependency('egl', required : false)
474 if not egl_dep.found()
475 egl_dep = cc.find_library('EGL', required : false)
478 if egl_dep.found() and not cc.has_header('EGL/egl.h',
479 dependencies : egl_dep,
480 include_directories : compat_includes)
481 egl_dep = unneeded_dep
483 if egl_dep.found() and not cc.has_header('EGL/eglext.h',
484 dependencies : egl_dep,
485 include_directories : compat_includes)
486 egl_dep = unneeded_dep
493 'egl/gstglcontext_egl.c',
494 'egl/gstgldisplay_egl.c',
495 'egl/gstglmemoryegl.c',
496 'egl/gstgldisplay_egl_device.c',
501 'egl/gstgldisplay_egl.h',
502 'egl/gstglmemoryegl.h',
503 'egl/gstgldisplay_egl_device.h',
505 gl_platform_deps += egl_dep
506 glconf.set10('GST_GL_HAVE_PLATFORM_EGL', 1)
508 if cc.has_header('libdrm/drm_fourcc.h')
509 gl_misc_deps += allocators_dep
510 glconf.set10('GST_GL_HAVE_DMABUF', 1)
515 #include <EGL/eglext.h>
517 enabled_gl_platforms += 'egl'
518 elif need_platform_egl == 'yes'
519 error ('Could not find requested EGL library')
524 wayland_client_dep = unneeded_dep
525 wayland_cursor_dep = unneeded_dep
526 wayland_egl_dep = unneeded_dep
527 if need_win_wayland != 'no'
528 if need_win_wayland == 'yes'
529 if need_platform_egl == 'no'
530 error('Impossible situation requested: Cannot use Wayland without EGL support')
533 if not egl_dep.found()
534 if need_win_wayland == 'yes'
535 error ('Could not find EGL libraries for wayland')
537 message ('Could not find EGL libraries for wayland')
540 wayland_client_dep = dependency('wayland-client', version : '>= 1.0', required : false)
541 wayland_cursor_dep = dependency('wayland-cursor', version : '>= 1.0', required : false)
542 wayland_egl_dep = dependency('wayland-egl', version : '>= 1.0', required : false)
543 wayland_protocols_dep = dependency('wayland-protocols', version : '>= 1.15', required : false)
544 wayland_scanner = find_program('wayland-scanner', required: false)
546 if wayland_client_dep.found() and wayland_cursor_dep.found() and wayland_egl_dep.found() and wayland_protocols_dep.found() and wayland_scanner.found()
547 # Generate the XDG shell interface
548 wayland_protocols_basedir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir')
549 xdg_shell_xml_spec = join_paths(wayland_protocols_basedir, 'stable', 'xdg-shell', 'xdg-shell.xml')
550 xdg_shell_header = custom_target('xdg-shell-client-header',
551 command: [ wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@' ],
552 input: xdg_shell_xml_spec,
553 output: 'xdg-shell-client-protocol.h',
555 xdg_shell_code = custom_target('xdg-shell-client-code',
556 command: [ wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@' ],
557 input: xdg_shell_xml_spec,
558 output: 'xdg-shell-client-protocol.c',
562 'wayland/gstgldisplay_wayland.c',
563 'wayland/gstglwindow_wayland_egl.c',
564 'wayland/wayland_event_source.c',
570 gl_wayland_headers += [
571 'wayland/gstgldisplay_wayland.h'
573 glconf.set('GST_GL_HAVE_WINDOW_WAYLAND', 1)
574 gl_winsys_deps += [wayland_client_dep, wayland_cursor_dep, wayland_egl_dep]
575 enabled_gl_winsys += 'wayland'
577 if need_win_wayland == 'yes'
578 error ('Could not find requested Wayland libraries')
580 wayland_client_dep = unneeded_dep
581 wayland_cursor_dep = unneeded_dep
582 wayland_egl_dep = unneeded_dep
583 wayland_protocols_dep = unneeded_dep
589 if need_platform_glx == 'yes'
590 if need_win_x11 == 'no'
591 error('Impossible situation requested: Cannot use GLX without X11 support')
592 elif need_api_opengl == 'no'
593 error('Impossible situation requested: Cannot use GLX without the OpenGL library')
597 if need_win_x11 != 'no'
598 xcb_dep = dependency('x11-xcb', required : false)
599 if x11_dep.found() and xcb_dep.found()
601 'x11/gstgldisplay_x11.c',
602 'x11/gstglwindow_x11.c',
603 'x11/xcb_event_source.c',
606 'x11/gstgldisplay_x11.h',
608 glconf.set('GST_GL_HAVE_WINDOW_X11', 1)
609 gl_winsys_deps += [x11_dep, xcb_dep]
610 enabled_gl_winsys += 'x11'
612 if need_platform_glx != 'no' and glx_dep.found() and cc.has_function ('glXMakeCurrent', dependencies : glx_dep)
613 glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
615 'x11/gstglcontext_glx.c',
617 # GLX is in the opengl library on linux
618 gl_platform_deps += glx_dep
619 enabled_gl_platforms += 'glx'
621 elif need_win_x11 == 'yes'
622 error ('Could not find requested X11 libraries')
626 bcm_host_dep = unneeded_dep
627 if need_win_dispmanx != 'no'
629 # Try pkg-config for bcm_host then fallback to find_library to also
630 # support older distribution
631 bcm_host_dep = dependency('bcm_host', required : false)
632 if not bcm_host_dep.found()
633 bcm_host_dep = cc.find_library('bcm_host', required : false)
636 if bcm_host_dep.found()
637 if not egl_dep.found()
638 error('dispmanx requires the use of egl')
642 'dispmanx/gstglwindow_dispmanx_egl.c'
645 glconf.set('GST_GL_HAVE_WINDOW_DISPMANX', 1)
646 gl_winsys_deps += bcm_host_dep
647 enabled_gl_winsys += 'dispmanx'
648 gl_cpp_args += ['-DUSE_EGL_RPI']
649 elif need_win_dispmanx == 'yes'
650 error('Could not find dispmanx libraries')
655 if need_platform_wgl == 'yes'
656 if need_win_win32 == 'no'
657 error('Impossible situation requested: Cannot use WGL without the win32 window system')
661 if need_platform_wgl != 'no' and need_win_win32 != 'no'
662 gdi_dep = cc.find_library('gdi32', required : false)
663 wglext_h = cc.has_header('GL/wglext.h',
664 prefix : '''#include <windows.h>
665 #include <GL/gl.h>''',
666 include_directories : compat_includes)
668 if wglext_h and gdi_dep.found() and gl_dep.found()
669 gl_includes += [compat_includes]
670 gl_platform_deps += gdi_dep
672 'win32/gstglwindow_win32.c',
673 'win32/gstglwindow_win32.c',
674 'wgl/gstglcontext_wgl.c',
676 enabled_gl_winsys += 'win32'
677 gl_winsys_deps += gdi_dep
678 enabled_gl_platforms += 'wgl'
679 glconf.set('GST_GL_HAVE_WINDOW_WIN32', 1)
680 glconf.set('GST_GL_HAVE_PLATFORM_WGL', 1)
685 if need_win_winrt != 'no' and host_system == 'windows'
686 if need_win_winrt == 'yes' and not enabled_gl_platforms.contains('egl')
687 error('Impossible situation requested: Cannot use WinRT ANGLE without EGL support')
691 windows_graphics_h = cc.has_header('windows.graphics.h')
692 windows_app_dep = cc.find_library('WindowsApp', required: false)
694 if windows_graphics_h and windows_app_dep.found()
695 enabled_gl_winsys += 'winrt'
696 glconf.set10('GST_GL_HAVE_WINDOW_WINRT', 1)
698 'winrt/gstglwindow_winrt_egl.c'
700 elif need_win_winrt == 'yes'
701 error('WinRT is enabled, but headers/libraries were not found')
703 elif need_win_winrt == 'yes'
704 error('WinRT ANGLE is enabled, but EGL was not found')
706 message('WinRT ANGLE disabled because EGL was not found')
710 if ['darwin', 'ios'].contains(host_system)
712 error('No ObjC compiler found')
715 objc = meson.get_compiler('objc')
716 if not objc.has_argument('-fobjc-arc')
717 error('ARC is required for building')
720 gl_objc_args += ['-fobjc-arc']
724 if need_platform_cgl == 'yes'
725 if need_win_cocoa == 'no'
726 error('Impossible situation requested: Cannot use CGL without Cocoa support')
727 elif need_api_opengl == 'no'
728 error('Impossible situation requested: Cannot use CGL without the OpenGL library')
730 elif need_platform_cgl == 'no' and need_win_cocoa == 'yes'
731 error('Impossible situation requested: Cannot use Cocoa without CGL support')
734 if host_system == 'darwin'
735 foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
736 quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
737 corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
739 if need_platform_cgl != 'no'
740 if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found()
741 gl_platform_deps += [quartzcore_dep, corefoundation_dep, foundation_dep]
742 enabled_gl_platforms += 'cgl'
743 glconf.set10('GST_GL_HAVE_PLATFORM_CGL', 1)
745 if need_win_cocoa != 'no'
746 cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : false)
749 'cocoa/gstglcaopengllayer.m',
750 'cocoa/gstglcontext_cocoa.m',
751 'cocoa/gstgldisplay_cocoa.m',
752 'cocoa/gstglwindow_cocoa.m'
754 gl_winsys_deps += cocoa_dep
755 enabled_gl_winsys += 'cocoa'
756 glconf.set10('GST_GL_HAVE_WINDOW_COCOA', 1)
757 elif need_win_cocoa == 'yes'
758 error('Could not find Cocoa')
761 elif need_platform_cgl == 'yes'
762 error('Could not find CGL dependencies')
767 if need_platform_eagl == 'yes'
768 if host_system != 'ios'
769 error('Can only use EAGL on iOS')
771 if need_win_eagl == 'no'
772 error('Impossible situation requested: Cannot use EAGL platform without the EAGL window system')
773 elif need_api_gles == 'no'
774 error('Impossible situation requested: Cannot use EAGL platform without the GLES library')
776 elif need_platform_eagl == 'no' and need_win_eagl == 'yes'
777 error('Impossible situation requested: Cannot use EAGL window system without the EAGL platform')
780 if host_system == 'ios' and need_platform_eagl != 'no' and need_win_eagl != 'no'
781 foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
782 corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
783 coregraphics_dep = dependency('appleframeworks', modules : ['CoreGraphics'], required : false)
784 uikit_dep = dependency('appleframeworks', modules : ['UIkit'], required : false)
786 if foundation_dep.found() and corefoundation_dep.found() and coregraphics_dep.found() and uikit_dep.found()
787 gl_platform_deps += [
794 'eagl/gstglcontext_eagl.m',
795 'eagl/gstglwindow_eagl.m',
797 enabled_gl_winsys += 'eagl'
798 enabled_gl_platforms += 'eagl'
799 glconf.set('GST_GL_HAVE_WINDOW_EAGL', 1)
800 glconf.set('GST_GL_HAVE_PLATFORM_EAGL', 1)
801 elif need_platform_eagl == 'yes' or need_win_eagl == 'yes'
802 error('Could not find dependencies for EAGL')
807 gbm_gudev_dep = unneeded_dep
808 gbm_libdrm_dep = unneeded_dep
809 gbm_dep = unneeded_dep
810 if need_win_gbm != 'no'
811 if need_win_gbm == 'yes'
812 if need_platform_egl == 'no'
813 error('Impossible situation requested: Cannot use GBM without EGL support')
817 gbm_gudev_dep = dependency('gudev-1.0', version : '>=147', required : false)
818 gbm_libdrm_dep = dependency('libdrm', version : '>= 2.4.55', required : false)
819 gbm_dep = dependency('gbm', required : false)
820 if egl_dep.found() and gbm_gudev_dep.found() and gbm_libdrm_dep.found() and gbm_dep.found()
822 'gbm/gstgldisplay_gbm.c',
823 'gbm/gstgl_gbm_utils.c',
824 'gbm/gstglwindow_gbm_egl.c',
826 enabled_gl_winsys += 'gbm'
827 gl_winsys_deps += [gbm_gudev_dep, gbm_libdrm_dep, gbm_dep]
828 glconf.set('GST_GL_HAVE_WINDOW_GBM', 1)
830 if need_win_gbm == 'yes'
831 error ('Could not find requested GBM libraries')
833 gbm_gudev_dep = unneeded_dep
834 gbm_libdrm_dep = unneeded_dep
835 gbm_dep = unneeded_dep
839 if need_platform_egl != 'no' and need_win_viv_fb != 'no'
840 if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep)
841 if cc.has_function ('glTexDirectVIV', dependencies : gles2_dep)
842 enabled_gl_winsys += 'viv-fb'
843 glconf.set10('GST_GL_HAVE_WINDOW_VIV_FB', 1)
844 glconf.set10('GST_GL_HAVE_VIV_DIRECTVIV', 1)
846 'viv-fb/gstgldisplay_viv_fb.c',
847 'viv-fb/gstglwindow_viv_fb_egl.c',
849 gl_cpp_args += ['-DEGL_API_FB']
854 if need_win_android == 'yes'
855 if need_platform_egl == 'no'
856 error('Impossible situation requested: Cannot build for Android without EGL')
857 elif need_api_gles2 == 'no'
858 error('Impossible situation requested: Cannot build for Android without GLES2 support')
859 elif host_system != 'android'
860 error('Impossible situation requested: Cannot build for Android without an android system')
864 if host_system == 'android' and need_win_android != 'no' and need_platform_egl != 'no'
865 if gles2_dep.found() and egl_dep.found()
866 enabled_gl_winsys += ['android']
867 glconf.set10('GST_GL_HAVE_WINDOW_ANDROID', 1)
869 'android/gstglwindow_android_egl.c'
874 # TODO: Add rest of gl config here.
875 # iOS, specific support
878 if enabled_gl_apis.length() == 0
879 message('No OpenGL API libraries found or requested')
882 if enabled_gl_platforms.length() == 0
883 message('No OpenGL Platforms found or requested')
886 if enabled_gl_winsys.length() == 0
887 message('No OpenGL Window systems found or requested')
892 # find some types that may or may not be defined
893 if cc.has_type('GLeglImageOES', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
894 glconf.set('GST_GL_HAVE_GLEGLIMAGEOES', 1)
896 if cc.has_type('GLchar', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
897 glconf.set('GST_GL_HAVE_GLCHAR', 1)
899 if cc.has_type('GLsizeiptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
900 glconf.set('GST_GL_HAVE_GLSIZEIPTR', 1)
902 if cc.has_type('GLintptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
903 glconf.set('GST_GL_HAVE_GLINTPTR', 1)
905 if cc.has_type('GLsync', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
906 glconf.set('GST_GL_HAVE_GLSYNC', 1)
908 if cc.has_type('GLuint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
909 glconf.set('GST_GL_HAVE_GLUINT64', 1)
911 if cc.has_type('GLint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
912 glconf.set('GST_GL_HAVE_GLINT64', 1)
914 if egl_dep.found() and cc.has_type('EGLAttrib', prefix : gl_include_block + egl_includes, dependencies : gl_lib_deps + [egl_dep], include_directories : gl_includes)
915 glconf.set('GST_GL_HAVE_EGLATTRIB', 1)
917 if egl_dep.found() and cc.has_type('EGLuint64KHR', prefix : gl_include_block + egl_includes, dependencies : gl_lib_deps + [egl_dep], include_directories : gl_includes)
918 glconf.set('GST_GL_HAVE_EGLUINT64KHR', 1)
921 message('Building libgstgl with GL api: ' + ' '.join(enabled_gl_apis))
922 message('Building libgstgl with GL platform: ' + ' '.join(enabled_gl_platforms))
923 message('Building libgstgl with GL winsys: ' + ' '.join(enabled_gl_winsys))
925 install_headers(gl_headers, subdir : 'gstreamer-1.0/gst/gl')
926 install_headers(gl_cocoa_headers, subdir : 'gstreamer-1.0/gst/gl/cocoa')
927 install_headers(gl_egl_headers, subdir : 'gstreamer-1.0/gst/gl/egl')
928 install_headers(gl_prototype_headers, subdir : 'gstreamer-1.0/gst/gl/glprototypes')
929 install_headers(gl_x11_headers, subdir : 'gstreamer-1.0/gst/gl/x11')
930 install_headers(gl_wayland_headers, subdir : 'gstreamer-1.0/gst/gl/wayland')
932 configure_file(input : 'gstglconfig.h.meson',
933 output : 'gstglconfig.h',
934 install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/gl',
935 configuration : glconf)
937 gl_enums = gnome.mkenums_simple('gl-enumtypes',
938 sources : gir_gl_headers,
939 body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
940 header_prefix : '#include <gst/gl/gl-prelude.h>',
941 decorator : 'GST_GL_API',
942 install_header: true,
943 install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/gl'))
944 gl_enumtypes_c = gl_enums[0]
945 gl_enumtypes_h = gl_enums[1]
946 gen_sources = [gl_enumtypes_h]
948 gstgl = library('gstgl-' + api_version,
949 gl_sources, gl_priv_sources, gl_enumtypes_c, gl_enumtypes_h,
950 c_args : gst_plugins_base_args + gl_cpp_args + ['-DBUILDING_GST_GL'],
951 objc_args : gst_plugins_base_args + gl_cpp_args + gl_objc_args + ['-DBUILDING_GST_GL'],
952 include_directories : [configinc, libsinc, gl_includes],
953 version : libversion,
954 soversion : soversion,
955 darwin_versions : osxversion,
957 dependencies : [gst_base_dep, video_dep, allocators_dep, gmodule_dep,
958 gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps])
960 gl_gir = gnome.generate_gir(gstgl,
961 sources : gl_sources + [gl_enumtypes_h] + [gl_enumtypes_c] + gir_gl_headers + gl_x11_headers + gl_wayland_headers + gl_win32_headers + gl_cocoa_headers + gl_egl_headers,
963 nsversion : api_version,
964 identifier_prefix : 'Gst',
965 symbol_prefix : 'gst',
966 export_packages : 'gstreamer-gl-1.0',
967 includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
969 extra_args : gir_init_section + ['--c-include=gst/gl/gl.h'],
970 dependencies : [video_dep, gst_dep, gst_base_dep]
972 gen_sources += gl_gir
976 gstgl_dep = declare_dependency(link_with : gstgl,
977 include_directories : [libsinc, compat_includes],
978 sources: gen_sources,
979 dependencies : [video_dep, gst_base_dep] + gl_winsys_deps)
981 elif get_option('gl').enabled()
982 error('GStreamer OpenGL integration required via options, but needed dependencies not found.')
984 gstgl_dep = dependency('', required : false)