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',
101 gl_wayland_sources = []
102 gl_wayland_headers = []
106 glconf = configuration_data()
108 'GST_GL_HAVE_OPENGL',
111 'GST_GL_HAVE_GLES3EXT3_H',
113 'GST_GL_HAVE_WINDOW_X11',
114 'GST_GL_HAVE_WINDOW_COCOA',
115 'GST_GL_HAVE_WINDOW_WIN32',
116 'GST_GL_HAVE_WINDOW_WINRT',
117 'GST_GL_HAVE_WINDOW_WAYLAND',
118 'GST_GL_HAVE_WINDOW_ANDROID',
119 'GST_GL_HAVE_WINDOW_DISPMANX',
120 'GST_GL_HAVE_WINDOW_EAGL',
121 'GST_GL_HAVE_WINDOW_VIV_FB',
122 'GST_GL_HAVE_WINDOW_GBM',
124 'GST_GL_HAVE_PLATFORM_EGL',
125 'GST_GL_HAVE_PLATFORM_GLX',
126 'GST_GL_HAVE_PLATFORM_WGL',
127 'GST_GL_HAVE_PLATFORM_CGL',
128 'GST_GL_HAVE_PLATFORM_EAGL',
130 'GST_GL_HAVE_DMABUF',
131 'GST_GL_HAVE_VIV_DIRECTVIV',
133 'GST_GL_HAVE_GLEGLIMAGEOES',
134 'GST_GL_HAVE_GLCHAR',
135 'GST_GL_HAVE_GLSIZEIPTR',
136 'GST_GL_HAVE_GLINTPTR',
137 'GST_GL_HAVE_GLSYNC',
138 'GST_GL_HAVE_GLUINT64',
139 'GST_GL_HAVE_GLINT64',
140 'GST_GL_HAVE_EGLATTRIB',
141 'GST_GL_HAVE_EGLUINT64KHR',
144 foreach option : glconf_options
145 glconf.set10(option, false)
148 unneeded_dep = dependency('', required : false)
149 if unneeded_dep.found()
150 error ('Found unfindable dependency')
153 # OpenGL/GLES2 libraries
155 # GL platform - EGL, GLX, CGL, WGL, etc
156 gl_platform_deps = []
157 # GL winsys - wayland, X11, Cocoa, win32, etc
159 # other things we need.
161 # Other preprocessor arguments
167 enabled_gl_platforms = []
168 enabled_gl_winsys = []
170 # parse provided options
171 libegl_module_name = get_option('egl_module_name')
172 if libegl_module_name != ''
173 gl_cpp_args += ['-DGST_GL_LIBEGL_MODULE_NAME="@0@"'.format(libegl_module_name)]
175 libgles2_module_name = get_option('gles2_module_name')
176 if libgles2_module_name != ''
177 gl_cpp_args += ['-DGST_GL_LIBGLESV2_MODULE_NAME="@0@"'.format(libgles2_module_name)]
179 libgl_module_name = get_option('opengl_module_name')
180 if libgl_module_name != ''
181 gl_cpp_args += ['-DGST_GL_LIBGL_MODULE_NAME="@0@"'.format(libgl_module_name)]
184 gl_apis = get_option('gl_api')
185 if gl_apis.contains('auto')
186 need_api_opengl = 'auto'
187 need_api_gles2 = 'auto'
189 need_api_opengl = 'no'
190 need_api_gles2 = 'no'
191 foreach api : gl_apis
193 need_api_opengl = 'yes'
195 need_api_gles2 = 'yes'
197 error('Unsupported GL api provided ' + api)
202 gl_platforms = get_option('gl_platform')
203 if gl_platforms.contains('auto')
204 need_platform_egl = 'auto'
205 need_platform_glx = 'auto'
206 need_platform_cgl = 'auto'
207 need_platform_wgl = 'auto'
208 need_platform_eagl = 'auto'
210 need_platform_egl = 'no'
211 need_platform_glx = 'no'
212 need_platform_cgl = 'no'
213 need_platform_wgl = 'no'
214 need_platform_eagl = 'no'
215 foreach platform : gl_platforms
217 need_platform_egl = 'yes'
218 elif platform == 'glx'
219 need_platform_glx = 'yes'
220 elif platform == 'cgl'
221 need_platform_cgl = 'yes'
222 elif platform == 'wgl'
223 need_platform_wgl = 'yes'
224 elif platform == 'eagl'
225 need_platform_eagl = 'yes'
227 error('Unsupported GL platform provided ' + platform)
232 gl_winsys = get_option('gl_winsys')
233 if gl_winsys.contains('auto')
234 need_win_x11 = 'auto'
235 need_win_wayland = 'auto'
236 need_win_win32 = 'auto'
237 need_win_winrt = 'auto'
238 need_win_cocoa = 'auto'
239 need_win_egl = 'auto'
240 need_win_eagl = 'auto'
241 need_win_dispmanx = 'auto'
242 need_win_viv_fb = 'auto'
243 need_win_gbm = 'auto'
244 need_win_android = 'auto'
247 need_win_wayland = 'no'
248 need_win_win32 = 'no'
249 need_win_winrt = 'no'
250 need_win_cocoa = 'no'
253 need_win_dispmanx = 'no'
254 need_win_viv_fb = 'no'
256 need_win_android = 'no'
257 foreach winsys : gl_winsys
260 elif winsys == 'wayland'
261 need_win_wayland = 'yes'
262 elif winsys == 'win32'
263 need_win_win32 = 'yes'
264 elif winsys == 'winrt'
265 need_win_winrt = 'yes'
266 elif winsys == 'cocoa'
267 need_win_cocoa = 'yes'
270 elif winsys == 'eagl'
271 need_win_eagl = 'yes'
272 elif winsys == 'dispmanx'
273 need_win_dispmanx = 'yes'
274 elif winsys == 'viv-fb'
275 need_win_viv_fb = 'yes'
278 elif winsys == 'android'
279 need_win_android = 'yes'
281 error('Unsupported GL winsys provided ' + winsys)
286 gl_include_header = '''
288 # pragma GCC diagnostic push
289 # pragma GCC diagnostic ignored "-Wredundant-decls"
291 #ifndef GL_GLEXT_PROTOTYPES
292 #define GL_GLEXT_PROTOTYPES 1
296 # convoluted way of getting at the subproject taking into account the wrap-mode
297 # so we don't download a subproject unless allowed
298 gl_header_dep = dependency('', fallback : ['gl-headers', 'gl_headers_dummy_dep'],
300 if gl_header_dep.type_name() == 'internal'
301 # this will only contain the includes of headers that are not found
302 compat_includes = subproject('gl-headers').get_variable('compatibility_includes')
307 # Desktop OpenGL checks
308 gl_dep = unneeded_dep
309 glx_dep = unneeded_dep
310 if need_api_opengl != 'no' or need_platform_glx != 'no'
311 if host_system == 'darwin'
312 gl_dep = dependency('appleframeworks', modules : ['OpenGL'], required : false)
314 # override meson's braindead gl detection on osx/windows/etc by forcing pkg-config
315 gl_dep = dependency('gl', method: 'pkg-config', required : false)
318 if not gl_dep.found()
319 if host_system == 'windows'
320 gl_dep = cc.find_library('opengl32', required : false)
322 gl_dep = cc.find_library('GL', required : false)
325 if not cc.has_header('GL/gl.h', include_directories : compat_includes)
326 gl_dep = unneeded_dep
329 if not gl_dep.found() and need_api_opengl == 'yes'
330 error ('Could not find requested OpenGL library')
334 gl_includes += [compat_includes]
338 if host_system == 'darwin'
339 glx_dep = cc.find_library('GL', required : false)
344 if need_api_opengl == 'no'
345 gl_dep = unneeded_dep
347 if need_platform_glx == 'no'
348 glx_dep = unneeded_dep
352 if host_system == 'darwin'
353 opengl_includes += '''
354 #include <OpenGL/OpenGL.h>
355 #include <OpenGL/gl.h>
356 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
357 # define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
358 # include <OpenGL/gl3.h>
362 opengl_includes += '''
364 # include <windows.h>
367 #if __WIN32__ || _WIN32
368 # include <GL/glext.h>
375 gles2_dep = unneeded_dep
378 if need_api_gles2 != 'no'
379 if host_system == 'ios'
380 gles2_dep = dependency('appleframeworks', modules : ['OpenGLES'], required : false)
382 gles2_dep = dependency('glesv2', required : false)
385 if not gles2_dep.found()
386 # if host_system == 'windows'
387 # elif host_system == ios
388 # gles2_dep = cc.find_library('GLESv2', required : false)
390 gles2_dep = cc.find_library('GLESv2', required : false)
393 if not cc.has_header('GLES2/gl2.h', include_directories : compat_includes)
394 gles2_dep = unneeded_dep
397 if not gles2_dep.found() and need_api_gles2 == 'yes'
398 error ('Could not find requested OpenGL ES library')
402 gl_includes += [compat_includes]
406 gles3_h = gles2_dep.found() and cc.has_header('GLES3/gl3.h', dependencies : gles2_dep, include_directories : compat_includes)
409 if host_system == 'ios'
411 # include <OpenGLES/ES2/gl.h>
412 # include <OpenGLES/ES2/glext.h>
416 gl_includes += [compat_includes]
417 gles3ext3_h = gles3_h and cc.has_header('GLES3/gl3ext.h', dependencies : gles2_dep, include_directories : compat_includes)
419 # include <GLES3/gl3.h>
420 # include <GLES2/gl2ext.h>'''
423 # include <GLES3/gl3ext.h>'''
427 # include <GLES2/gl2.h>
428 # include <GLES2/gl2ext.h>'''
433 # can we include both gles2 and opengl headers?
434 if gles2_dep.found() and gl_dep.found()
435 gl_include_block = gl_include_header + gles_includes + opengl_includes
436 # TODO: Revert to passing gl_include_block via prefix: once
437 # https://github.com/mesonbuild/meson/issues/2364 is fixed
438 if not cc.compiles(gl_include_block + '\n' + 'void f (void) {}',dependencies : [gles2_dep, gl_dep], include_directories : compat_includes)
439 message ('Cannot include both OpenGL and OpenGL ES headers')
440 if need_api_gles2 != 'yes'
441 gles2_dep = unneeded_dep
442 elif need_api_opengl != 'yes'
443 gl_dep = unneeded_dep
445 error('Both OpenGL and OpenGL ES were requested but cannot be included together')
449 gl_include_block = gl_include_header
451 gl_include_block += gles_includes
454 gl_include_block += opengl_includes
458 gl_lib_deps += gles2_dep
459 glconf.set10('GST_GL_HAVE_GLES2', 1)
461 glconf.set10('GST_GL_HAVE_GLES3', 1)
463 glconf.set10('GST_GL_HAVE_GLES3EXT3_H', 1)
466 enabled_gl_apis += 'gles2'
470 gl_lib_deps += gl_dep
471 glconf.set10('GST_GL_HAVE_OPENGL', 1)
472 enabled_gl_apis += 'gl'
476 egl_dep = unneeded_dep
477 if need_platform_egl != 'no'
478 egl_dep = dependency('egl', required : false)
479 if not egl_dep.found()
480 egl_dep = cc.find_library('EGL', required : false)
483 if egl_dep.found() and not cc.has_header('EGL/egl.h',
484 dependencies : egl_dep,
485 include_directories : compat_includes)
486 egl_dep = unneeded_dep
488 if egl_dep.found() and not cc.has_header('EGL/eglext.h',
489 dependencies : egl_dep,
490 include_directories : compat_includes)
491 egl_dep = unneeded_dep
498 'egl/gstglcontext_egl.c',
499 'egl/gstgldisplay_egl.c',
500 'egl/gstglmemoryegl.c',
501 'egl/gstgldisplay_egl_device.c',
507 'egl/gstgldisplay_egl.h',
508 'egl/gstglmemoryegl.h',
509 'egl/gstgldisplay_egl_device.h',
511 gl_platform_deps += egl_dep
512 glconf.set10('GST_GL_HAVE_PLATFORM_EGL', 1)
514 if cc.has_header('libdrm/drm_fourcc.h')
515 gl_misc_deps += allocators_dep
516 glconf.set10('GST_GL_HAVE_DMABUF', 1)
521 #include <EGL/eglext.h>
523 enabled_gl_platforms += 'egl'
524 elif need_platform_egl == 'yes'
525 error ('Could not find requested EGL library')
530 if need_win_egl == 'yes'
531 if need_platform_egl == 'no'
532 error('Impossible situation requested: Cannot use Winsys egl without EGL support')
533 elif not egl_dep.found()
534 error ('Could not find EGL libraries for Winsys egl')
536 enabled_gl_winsys += 'egl'
541 wayland_client_dep = unneeded_dep
542 wayland_cursor_dep = unneeded_dep
543 wayland_egl_dep = unneeded_dep
544 if need_win_wayland != 'no'
545 if need_win_wayland == 'yes'
546 if need_platform_egl == 'no'
547 error('Impossible situation requested: Cannot use Wayland without EGL support')
550 if not egl_dep.found()
551 if need_win_wayland == 'yes'
552 error ('Could not find EGL libraries for wayland')
554 message ('Could not find EGL libraries for wayland')
557 wayland_client_dep = dependency('wayland-client', version : '>= 1.11', required : false)
558 wayland_cursor_dep = dependency('wayland-cursor', version : '>= 1.0', required : false)
559 wayland_egl_dep = dependency('wayland-egl', version : '>= 1.0', required : false)
560 wayland_protocols_dep = dependency('wayland-protocols', version : '>= 1.15', required : false)
561 wayland_scanner = find_program('wayland-scanner', required: false)
563 if wayland_client_dep.found() and wayland_cursor_dep.found() and wayland_egl_dep.found() and wayland_protocols_dep.found() and wayland_scanner.found()
564 # Generate the XDG shell interface
565 wayland_protocols_basedir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir')
566 xdg_shell_xml_spec = join_paths(wayland_protocols_basedir, 'stable', 'xdg-shell', 'xdg-shell.xml')
567 xdg_shell_header = custom_target('xdg-shell-client-header',
568 command: [ wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@' ],
569 input: xdg_shell_xml_spec,
570 output: 'xdg-shell-client-protocol.h',
572 xdg_shell_code = custom_target('xdg-shell-client-code',
573 command: [ wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@' ],
574 input: xdg_shell_xml_spec,
575 output: 'xdg-shell-client-protocol.c',
578 gl_wayland_sources += [
579 'wayland/gstgldisplay_wayland.c',
582 'wayland/gstglwindow_wayland_egl.c',
583 'wayland/wayland_event_source.c',
587 gl_wayland_headers += [
589 'wayland/gstgldisplay_wayland.h'
591 glconf.set('GST_GL_HAVE_WINDOW_WAYLAND', 1)
592 gl_winsys_deps += [wayland_client_dep, wayland_cursor_dep, wayland_egl_dep]
593 enabled_gl_winsys += 'wayland'
595 if need_win_wayland == 'yes'
596 error ('Could not find requested Wayland libraries')
598 wayland_client_dep = unneeded_dep
599 wayland_cursor_dep = unneeded_dep
600 wayland_egl_dep = unneeded_dep
601 wayland_protocols_dep = unneeded_dep
607 if need_platform_glx == 'yes'
608 if need_win_x11 == 'no'
609 error('Impossible situation requested: Cannot use GLX without X11 support')
610 elif need_api_opengl == 'no'
611 error('Impossible situation requested: Cannot use GLX without the OpenGL library')
615 if need_win_x11 != 'no'
616 xcb_dep = dependency('x11-xcb', required : false)
617 if x11_dep.found() and xcb_dep.found()
619 'x11/gstgldisplay_x11.c',
622 'x11/gstglwindow_x11.c',
623 'x11/xcb_event_source.c',
627 'x11/gstgldisplay_x11.h',
629 glconf.set('GST_GL_HAVE_WINDOW_X11', 1)
630 gl_winsys_deps += [x11_dep, xcb_dep]
631 enabled_gl_winsys += 'x11'
633 if need_platform_glx != 'no' and glx_dep.found() and cc.has_function ('glXMakeCurrent', dependencies : glx_dep)
634 glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
636 'x11/gstglcontext_glx.c',
638 # GLX is in the opengl library on linux
639 gl_platform_deps += glx_dep
640 enabled_gl_platforms += 'glx'
642 elif need_win_x11 == 'yes'
643 error ('Could not find requested X11 libraries')
647 bcm_host_dep = unneeded_dep
648 if need_win_dispmanx != 'no'
650 # Try pkg-config for bcm_host then fallback to find_library to also
651 # support older distribution
652 bcm_host_dep = dependency('bcm_host', required : false)
653 if not bcm_host_dep.found()
654 bcm_host_dep = cc.find_library('bcm_host', required : false)
657 if bcm_host_dep.found()
658 if not egl_dep.found()
659 error('dispmanx requires the use of egl')
663 'dispmanx/gstglwindow_dispmanx_egl.c'
666 glconf.set('GST_GL_HAVE_WINDOW_DISPMANX', 1)
667 gl_winsys_deps += bcm_host_dep
668 enabled_gl_winsys += 'dispmanx'
669 gl_cpp_args += ['-DUSE_EGL_RPI']
670 elif need_win_dispmanx == 'yes'
671 error('Could not find dispmanx libraries')
676 if need_platform_wgl == 'yes'
677 if need_win_win32 == 'no'
678 error('Impossible situation requested: Cannot use WGL without the win32 window system')
682 if host_system == 'windows' and need_win_win32 != 'no'
683 gdi_dep = cc.find_library('gdi32', required : false)
686 have_egl_win32 = false
687 if need_platform_wgl != 'no'
688 wglext_h = cc.has_header('GL/wglext.h',
689 prefix : '''#include <windows.h>
690 #include <GL/gl.h>''',
691 include_directories : compat_includes)
692 have_wgl = wglext_h and gl_dep.found()
695 have_egl_win32 = enabled_gl_platforms.contains('egl') and gles2_dep.found()
696 if have_wgl or have_egl_win32
697 gl_includes += [compat_includes]
698 gl_platform_deps += gdi_dep
700 'win32/gstglwindow_win32.c',
702 enabled_gl_winsys += 'win32'
703 gl_winsys_deps += gdi_dep
704 glconf.set('GST_GL_HAVE_WINDOW_WIN32', 1)
709 'wgl/gstglcontext_wgl.c',
711 enabled_gl_platforms += 'wgl'
712 glconf.set('GST_GL_HAVE_PLATFORM_WGL', 1)
718 if need_win_winrt != 'no' and host_system == 'windows'
719 if need_win_winrt == 'yes' and not enabled_gl_platforms.contains('egl')
720 error('Impossible situation requested: Cannot use WinRT ANGLE without EGL support')
724 windows_graphics_h = cc.has_header('windows.graphics.h')
725 windows_app_dep = cc.find_library('WindowsApp', required: false)
726 runtimeobject_lib = cc.find_library('runtimeobject', required: false)
728 if windows_graphics_h and windows_app_dep.found() and runtimeobject_lib.found()
729 enabled_gl_winsys += 'winrt'
730 glconf.set10('GST_GL_HAVE_WINDOW_WINRT', 1)
732 'winrt/gstglwindow_winrt_egl.cpp'
734 gl_winsys_deps += runtimeobject_lib
735 elif need_win_winrt == 'yes'
736 error('WinRT is enabled, but headers/libraries were not found')
738 elif need_win_winrt == 'yes'
739 error('WinRT ANGLE is enabled, but EGL was not found')
741 message('WinRT ANGLE disabled because EGL was not found')
745 if ['darwin', 'ios'].contains(host_system)
747 error('No ObjC compiler found')
750 objc = meson.get_compiler('objc')
751 if not objc.has_argument('-fobjc-arc')
752 error('ARC is required for building')
755 gl_objc_args += ['-fobjc-arc']
759 if need_platform_cgl == 'yes'
760 if need_win_cocoa == 'no'
761 error('Impossible situation requested: Cannot use CGL without Cocoa support')
762 elif need_api_opengl == 'no'
763 error('Impossible situation requested: Cannot use CGL without the OpenGL library')
765 elif need_platform_cgl == 'no' and need_win_cocoa == 'yes'
766 error('Impossible situation requested: Cannot use Cocoa without CGL support')
769 if host_system == 'darwin'
770 foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
771 quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
772 corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
774 if need_platform_cgl != 'no'
775 if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found()
776 gl_platform_deps += [quartzcore_dep, corefoundation_dep, foundation_dep]
777 enabled_gl_platforms += 'cgl'
778 glconf.set10('GST_GL_HAVE_PLATFORM_CGL', 1)
780 if need_win_cocoa != 'no'
781 cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : false)
784 'cocoa/gstglcaopengllayer.m',
785 'cocoa/gstglcontext_cocoa.m',
786 'cocoa/gstgldisplay_cocoa.m',
787 'cocoa/gstglwindow_cocoa.m'
789 gl_winsys_deps += cocoa_dep
790 enabled_gl_winsys += 'cocoa'
791 glconf.set10('GST_GL_HAVE_WINDOW_COCOA', 1)
792 elif need_win_cocoa == 'yes'
793 error('Could not find Cocoa')
796 elif need_platform_cgl == 'yes'
797 error('Could not find CGL dependencies')
802 if need_platform_eagl == 'yes'
803 if host_system != 'ios'
804 error('Can only use EAGL on iOS')
806 if need_win_eagl == 'no'
807 error('Impossible situation requested: Cannot use EAGL platform without the EAGL window system')
808 elif need_api_gles == 'no'
809 error('Impossible situation requested: Cannot use EAGL platform without the GLES library')
811 elif need_platform_eagl == 'no' and need_win_eagl == 'yes'
812 error('Impossible situation requested: Cannot use EAGL window system without the EAGL platform')
815 if host_system == 'ios' and need_platform_eagl != 'no' and need_win_eagl != 'no'
816 foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
817 corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
818 coregraphics_dep = dependency('appleframeworks', modules : ['CoreGraphics'], required : false)
819 quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
820 uikit_dep = dependency('appleframeworks', modules : ['UIkit'], required : false)
822 if foundation_dep.found() and corefoundation_dep.found() and coregraphics_dep.found() and quartzcore_dep.found() and uikit_dep.found()
823 gl_platform_deps += [
831 'eagl/gstglcontext_eagl.m',
832 'eagl/gstglwindow_eagl.m',
834 enabled_gl_winsys += 'eagl'
835 enabled_gl_platforms += 'eagl'
836 glconf.set('GST_GL_HAVE_WINDOW_EAGL', 1)
837 glconf.set('GST_GL_HAVE_PLATFORM_EAGL', 1)
838 elif need_platform_eagl == 'yes' or need_win_eagl == 'yes'
839 error('Could not find dependencies for EAGL')
844 gbm_gudev_dep = unneeded_dep
845 gbm_libdrm_dep = unneeded_dep
846 gbm_dep = unneeded_dep
847 if need_win_gbm != 'no'
848 if need_win_gbm == 'yes'
849 if need_platform_egl == 'no'
850 error('Impossible situation requested: Cannot use GBM without EGL support')
854 gbm_gudev_dep = dependency('gudev-1.0', version : '>=147', required : false)
855 gbm_libdrm_dep = dependency('libdrm', version : '>= 2.4.55', required : false)
856 gbm_dep = dependency('gbm', required : false)
857 if egl_dep.found() and gbm_gudev_dep.found() and gbm_libdrm_dep.found() and gbm_dep.found()
859 'gbm/gstgldisplay_gbm.c',
860 'gbm/gstgl_gbm_utils.c',
861 'gbm/gstglwindow_gbm_egl.c',
863 enabled_gl_winsys += 'gbm'
864 gl_winsys_deps += [gbm_gudev_dep, gbm_libdrm_dep, gbm_dep]
865 glconf.set('GST_GL_HAVE_WINDOW_GBM', 1)
867 if need_win_gbm == 'yes'
868 error ('Could not find requested GBM libraries')
870 gbm_gudev_dep = unneeded_dep
871 gbm_libdrm_dep = unneeded_dep
872 gbm_dep = unneeded_dep
876 if need_platform_egl != 'no' and need_win_viv_fb != 'no'
877 if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep)
878 if cc.has_function ('glTexDirectVIV', dependencies : gles2_dep)
879 enabled_gl_winsys += 'viv-fb'
880 glconf.set10('GST_GL_HAVE_WINDOW_VIV_FB', 1)
881 glconf.set10('GST_GL_HAVE_VIV_DIRECTVIV', 1)
883 'viv-fb/gstgldisplay_viv_fb.c',
884 'viv-fb/gstglwindow_viv_fb_egl.c',
886 gl_cpp_args += ['-DEGL_API_FB']
891 if need_win_android == 'yes'
892 if need_platform_egl == 'no'
893 error('Impossible situation requested: Cannot build for Android without EGL')
894 elif need_api_gles2 == 'no'
895 error('Impossible situation requested: Cannot build for Android without GLES2 support')
896 elif host_system != 'android'
897 error('Impossible situation requested: Cannot build for Android without an android system')
901 if host_system == 'android' and need_win_android != 'no' and need_platform_egl != 'no'
902 if gles2_dep.found() and egl_dep.found()
903 enabled_gl_winsys += ['android']
904 glconf.set10('GST_GL_HAVE_WINDOW_ANDROID', 1)
906 'android/gstglwindow_android_egl.c'
911 # TODO: Add rest of gl config here.
912 # iOS, specific support
915 if enabled_gl_apis.length() == 0
916 message('No OpenGL API libraries found or requested')
919 if enabled_gl_platforms.length() == 0
920 message('No OpenGL Platforms found or requested')
923 if enabled_gl_winsys.length() == 0
924 message('No OpenGL Window systems found or requested')
928 gstgl_dep = dependency('', required : false)
929 gstglproto_dep = dependency('', required : false)
930 gstglx11_dep = dependency('', required : false)
931 gstglwayland_dep = dependency('', required : false)
932 gstglegl_dep = dependency('', required : false)
935 # find some types that may or may not be defined
936 if cc.has_type('GLeglImageOES', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
937 glconf.set('GST_GL_HAVE_GLEGLIMAGEOES', 1)
939 if cc.has_type('GLchar', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
940 glconf.set('GST_GL_HAVE_GLCHAR', 1)
942 if cc.has_type('GLsizeiptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
943 glconf.set('GST_GL_HAVE_GLSIZEIPTR', 1)
945 if cc.has_type('GLintptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
946 glconf.set('GST_GL_HAVE_GLINTPTR', 1)
948 if cc.has_type('GLsync', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
949 glconf.set('GST_GL_HAVE_GLSYNC', 1)
951 if cc.has_type('GLuint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
952 glconf.set('GST_GL_HAVE_GLUINT64', 1)
954 if cc.has_type('GLint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
955 glconf.set('GST_GL_HAVE_GLINT64', 1)
957 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)
958 glconf.set('GST_GL_HAVE_EGLATTRIB', 1)
960 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)
961 glconf.set('GST_GL_HAVE_EGLUINT64KHR', 1)
964 summary('GL api', enabled_gl_apis, list_sep: ', ')
965 summary('GL platform', enabled_gl_platforms, list_sep: ', ')
966 summary('GL winsys', enabled_gl_winsys, list_sep: ', ')
968 install_headers(gl_headers, subdir : 'gstreamer-1.0/gst/gl')
969 install_headers(gl_prototype_headers, subdir : 'gstreamer-1.0/gst/gl/glprototypes')
971 configure_file(input : 'gstglconfig.h.meson',
972 output : 'gstglconfig.h',
973 install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/gl',
974 configuration : glconf)
976 glib_mkenums = find_program('glib-mkenums')
977 mkenums = find_program('gl_mkenum.py')
978 gl_enumtypes_h = custom_target('gstglenumtypes_h',
979 output : 'gl-enumtypes.h',
980 input : gir_gl_headers,
982 install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/gl/'),
983 command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
985 gl_enumtypes_c = custom_target('gstglenumtypes_c',
986 output : 'gl-enumtypes.c',
987 input : gir_gl_headers,
988 depends : [gl_enumtypes_h],
989 command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
990 gen_sources = [gl_enumtypes_h]
992 gstgl = library('gstgl-' + api_version,
993 gl_sources, gl_egl_sources, gl_x11_sources, gl_wayland_sources, gl_priv_sources, gl_enumtypes_c, gl_enumtypes_h,
994 c_args : gst_plugins_base_args + gl_cpp_args + ['-DBUILDING_GST_GL'],
995 cpp_args : gst_plugins_base_args + gl_cpp_args + ['-DBUILDING_GST_GL'],
996 objc_args : gst_plugins_base_args + gl_cpp_args + gl_objc_args + ['-DBUILDING_GST_GL'],
997 include_directories : [configinc, libsinc, gl_includes],
998 version : libversion,
999 soversion : soversion,
1000 darwin_versions : osxversion,
1002 dependencies : [gst_base_dep, video_dep, allocators_dep, gmodule_dep,
1003 gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps],
1004 # don't confuse EGL/egl.h with gst-libs/gl/egl/egl.h on case-insensitive file systems
1005 implicit_include_directories : false)
1008 gl_gir = gnome.generate_gir(gstgl,
1009 sources : gl_sources + [gl_enumtypes_h] + [gl_enumtypes_c] + gir_gl_headers,
1010 namespace : 'GstGL',
1011 nsversion : api_version,
1012 identifier_prefix : 'Gst',
1013 symbol_prefix : 'gst',
1014 export_packages : 'gstreamer-gl-1.0',
1015 includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
1017 extra_args : gir_init_section + ['--c-include=gst/gl/gl.h'],
1018 dependencies : [video_dep, gst_dep, gst_base_dep]
1020 gen_sources += gl_gir
1023 gstgl_dep = declare_dependency(link_with : gstgl,
1024 include_directories : [libsinc, compat_includes],
1025 sources: gen_sources,
1026 dependencies : [video_dep, gst_base_dep])
1027 gstglproto_dep = declare_dependency(dependencies : [gstgl_dep] + gl_lib_deps)
1029 if gl_x11_headers.length() > 0
1030 install_headers(gl_x11_headers, subdir : 'gstreamer-1.0/gst/gl/x11')
1033 gl_x11_gir = gnome.generate_gir(gstgl,
1034 sources : gl_x11_sources + gl_x11_headers,
1035 namespace : 'GstGLX11',
1036 nsversion : api_version,
1037 identifier_prefix : 'Gst',
1038 symbol_prefix : 'gst',
1039 export_packages : 'gstreamer-gl-x11-1.0',
1040 includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0', gl_gir[0]],
1042 extra_args : gir_init_section + ['--c-include=gst/gl/x11/x11.h'],
1043 dependencies : [video_dep, gst_dep, gst_base_dep]
1046 gstglx11_dep = declare_dependency(dependencies : [gstgl_dep],
1047 sources : gl_x11_gir)
1050 if gl_wayland_headers.length() > 0
1051 install_headers(gl_wayland_headers, subdir : 'gstreamer-1.0/gst/gl/wayland')
1054 gl_wayland_gir = gnome.generate_gir(gstgl,
1055 sources : gl_wayland_sources + gl_wayland_headers,
1056 namespace : 'GstGLWayland',
1057 nsversion : api_version,
1058 identifier_prefix : 'Gst',
1059 symbol_prefix : 'gst',
1060 export_packages : 'gstreamer-gl-wayland-1.0',
1061 includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0', gl_gir[0]],
1063 extra_args : gir_init_section + ['--c-include=gst/gl/wayland/wayland.h'],
1064 dependencies : [video_dep, gst_dep, gst_base_dep]
1067 gstglwayland_dep = declare_dependency(dependencies : [gstgl_dep],
1068 sources : gl_wayland_gir)
1071 if gl_egl_headers.length() > 0
1072 install_headers(gl_egl_headers, subdir : 'gstreamer-1.0/gst/gl/egl')
1075 gl_egl_gir = gnome.generate_gir(gstgl,
1076 sources : gl_egl_sources + gl_egl_headers,
1077 namespace : 'GstGLEGL',
1078 nsversion : api_version,
1079 identifier_prefix : 'Gst',
1080 symbol_prefix : 'gst',
1081 export_packages : 'gstreamer-gl-egl-1.0',
1082 includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0', gl_gir[0]],
1084 extra_args : gir_init_section + ['--c-include=gst/gl/egl/egl.h'],
1085 dependencies : [video_dep, gst_dep, gst_base_dep]
1088 gstglegl_dep = declare_dependency(dependencies : [gstgl_dep],
1089 sources : gl_egl_gir)
1092 elif get_option('gl').enabled()
1093 error('GStreamer OpenGL integration required via options, but needed dependencies not found.')