1 if get_option('gl').disabled()
2 message('GStreamer OpenGL integration disabled via options.')
3 gstgl_dep = dependency('', required: false)
12 'gstglcolorconvert.c',
24 'gstgloverlaycompositor.c',
26 'gstglrenderbuffer.c',
28 'gstglshaderstrings.c',
48 'gstglcolorconvert.h',
58 'gstgloverlaycompositor.h',
60 'gstglrenderbuffer.h',
62 'gstglshaderstrings.h',
72 gl_headers = gir_gl_headers + [
76 gl_prototype_headers = [
77 'glprototypes/all_functions.h',
78 'glprototypes/base.h',
79 'glprototypes/blending.h',
80 'glprototypes/buffers.h',
81 'glprototypes/debug.h',
82 'glprototypes/eglimage.h',
84 'glprototypes/fixedfunction.h',
85 'glprototypes/gles.h',
86 'glprototypes/gstgl_compat.h',
87 'glprototypes/gstgl_gles2compat.h',
88 'glprototypes/opengl.h',
89 'glprototypes/query.h',
90 'glprototypes/shaders.h',
91 'glprototypes/sync.h',
96 gl_wayland_headers = []
101 glconf = configuration_data()
103 'GST_GL_HAVE_OPENGL',
106 'GST_GL_HAVE_GLES3EXT3_H',
108 'GST_GL_HAVE_WINDOW_X11',
109 'GST_GL_HAVE_WINDOW_COCOA',
110 'GST_GL_HAVE_WINDOW_WIN32',
111 'GST_GL_HAVE_WINDOW_WAYLAND',
112 'GST_GL_HAVE_WINDOW_ANDROID',
113 'GST_GL_HAVE_WINDOW_DISPMANX',
114 'GST_GL_HAVE_WINDOW_EAGL',
115 'GST_GL_HAVE_WINDOW_VIV_FB',
116 'GST_GL_HAVE_WINDOW_GBM',
118 'GST_GL_HAVE_PLATFORM_EGL',
119 'GST_GL_HAVE_PLATFORM_GLX',
120 'GST_GL_HAVE_PLATFORM_WGL',
121 'GST_GL_HAVE_PLATFORM_CGL',
122 'GST_GL_HAVE_PLATFORM_EAGL',
124 'GST_GL_HAVE_DMABUF',
125 'GST_GL_HAVE_VIV_DIRECTVIV',
127 'GST_GL_HAVE_GLEGLIMAGEOES',
128 'GST_GL_HAVE_GLCHAR',
129 'GST_GL_HAVE_GLSIZEIPTR',
130 'GST_GL_HAVE_GLINTPTR',
131 'GST_GL_HAVE_GLSYNC',
132 'GST_GL_HAVE_GLUINT64',
133 'GST_GL_HAVE_GLINT64',
134 'GST_GL_HAVE_EGLATTRIB',
135 'GST_GL_HAVE_EGLUINT64KHR',
138 foreach option : glconf_options
139 glconf.set10(option, false)
142 unneeded_dep = dependency('', required : false)
143 if unneeded_dep.found()
144 error ('Found unfindable dependency')
147 # OpenGL/GLES2 libraries
149 # GL platform - EGL, GLX, CGL, WGL, etc
150 gl_platform_deps = []
151 # GL winsys - wayland, X11, Cocoa, win32, etc
153 # other things we need.
155 # Other preprocessor arguments
161 enabled_gl_platforms = []
162 enabled_gl_winsys = []
164 # parse provided options
165 libegl_module_name = get_option('egl_module_name')
166 if libegl_module_name != ''
167 gl_cpp_args += ['-DGST_GL_LIBEGL_MODULE_NAME="@0@"'.format(libegl_module_name)]
169 libgles2_module_name = get_option('gles2_module_name')
170 if libgles2_module_name != ''
171 gl_cpp_args += ['-DGST_GL_LIBGLESV2_MODULE_NAME="@0@"'.format(libgles2_module_name)]
173 libgl_module_name = get_option('opengl_module_name')
174 if libgl_module_name != ''
175 gl_cpp_args += ['-DGST_GL_LIBGL_MODULE_NAME="@0@"'.format(libgl_module_name)]
178 gl_apis = get_option('gl_api')
179 if gl_apis.contains('auto')
180 need_api_opengl = 'auto'
181 need_api_gles2 = 'auto'
183 need_api_opengl = 'no'
184 need_api_gles2 = 'no'
185 foreach api : gl_apis
187 need_api_opengl = 'yes'
189 need_api_gles2 = 'yes'
191 error('Unsupported GL api provided ' + api)
196 gl_platforms = get_option('gl_platform')
197 if gl_platforms.contains('auto')
198 need_platform_egl = 'auto'
199 need_platform_glx = 'auto'
200 need_platform_cgl = 'auto'
201 need_platform_wgl = 'auto'
202 need_platform_eagl = 'auto'
204 need_platform_egl = 'no'
205 need_platform_glx = 'no'
206 need_platform_cgl = 'no'
207 need_platform_wgl = 'no'
208 need_platform_eagl = 'no'
209 foreach platform : gl_platforms
211 need_platform_egl = 'yes'
212 elif platform == 'glx'
213 need_platform_glx = 'yes'
214 elif platform == 'cgl'
215 need_platform_cgl = 'yes'
216 elif platform == 'wgl'
217 need_platform_wgl = 'yes'
218 elif platform == 'eagl'
219 need_platform_eagl = 'yes'
221 error('Unsupported GL platform provided ' + platform)
226 gl_winsys = get_option('gl_winsys')
227 if gl_winsys.contains('auto')
228 need_win_x11 = 'auto'
229 need_win_wayland = 'auto'
230 need_win_win32 = 'auto'
231 need_win_cocoa = 'auto'
232 need_win_eagl = 'auto'
233 need_win_dispmanx = 'auto'
234 need_win_viv_fb = 'auto'
235 need_win_gbm = 'auto'
236 need_win_android = 'auto'
239 need_win_wayland = 'no'
240 need_win_win32 = 'no'
241 need_win_cocoa = 'no'
243 need_win_dispmanx = 'no'
244 need_win_viv_fb = 'no'
246 need_win_android = 'no'
247 foreach winsys : gl_winsys
250 elif winsys == 'wayland'
251 need_win_wayland = 'yes'
252 elif winsys == 'win32'
253 need_win_win32 = 'yes'
254 elif winsys == 'cocoa'
255 need_win_cocoa = 'yes'
256 elif winsys == 'eagl'
257 need_win_eagl = 'yes'
258 elif winsys == 'dispmanx'
259 need_win_dispmanx = 'yes'
260 elif winsys == 'viv-fb'
261 need_win_viv_fb = 'yes'
264 elif winsys == 'android'
265 need_win_android = 'yes'
267 error('Unsupported GL winsys provided ' + winsys)
272 gl_include_header = '''
274 # pragma GCC diagnostic push
275 # pragma GCC diagnostic ignored "-Wredundant-decls"
277 #ifndef GL_GLEXT_PROTOTYPES
278 #define GL_GLEXT_PROTOTYPES 1
282 # convoluted way of getting at the subproject taking into account the wrap-mode
283 # so we don't download a subproject unless allowed
284 # FIXME: dependency() needs a valid name to attempt to find otherwise meson
285 # short-circuits and will always fail and never look into the fallback
286 # subproject. https://github.com/mesonbuild/meson/issues/3754
287 gl_header_dep = dependency('gl-headers-not-findable', method : 'pkg-config',
288 fallback : ['gl-headers', 'gl_headers_dummy_dep'], required : false)
289 if gl_header_dep.type_name() == 'internal'
290 # this will only contain the includes of headers that are not found
291 compat_includes = subproject('gl-headers').get_variable('compatibility_includes')
296 # Desktop OpenGL checks
297 gl_dep = unneeded_dep
298 glx_dep = unneeded_dep
299 if need_api_opengl != 'no' or need_platform_glx != 'no'
300 if host_system == 'darwin'
301 gl_dep = dependency('OpenGL', required : false)
303 # override meson's braindead gl detection on osx/windows/etc by forcing pkg-config
304 gl_dep = dependency('gl', method: 'pkg-config', required : false)
307 if not gl_dep.found()
308 if host_system == 'windows'
309 gl_dep = cc.find_library('opengl32', required : false)
311 gl_dep = cc.find_library('GL', required : false)
314 if not cc.has_header('GL/gl.h', include_directories : compat_includes)
315 gl_dep = unneeded_dep
318 if not gl_dep.found() and need_api_opengl == 'yes'
319 error ('Could not find requested OpenGL library')
323 gl_includes += [compat_includes]
328 if need_api_opengl == 'no'
329 gl_dep = unneeded_dep
331 if need_platform_glx == 'no'
332 glx_dep = unneeded_dep
336 if host_system == 'darwin'
337 opengl_includes += '''
338 #include <OpenGL/OpenGL.h>
339 #include <OpenGL/gl.h>
340 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
341 # define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
342 # include <OpenGL/gl3.h>
346 opengl_includes += '''
348 # include <windows.h>
351 #if __WIN32__ || _WIN32
352 # include <GL/glext.h>
359 gles2_dep = unneeded_dep
362 if need_api_gles2 != 'no'
363 if host_system == 'ios'
364 gles2_dep = dependency('appleframeworks', modules : ['OpenGLES'], required : false)
366 gles2_dep = dependency('glesv2', required : false)
369 if not gles2_dep.found()
370 # if host_system == 'windows'
371 # elif host_system == ios
372 # gles2_dep = cc.find_library('GLESv2', required : false)
374 gles2_dep = cc.find_library('GLESv2', required : false)
377 if not cc.has_header('GLES2/gl2.h', include_directories : compat_includes)
378 gles2_dep = unneeded_dep
381 if not gles2_dep.found() and need_api_gles2 == 'yes'
382 error ('Could not find requested OpenGL ES library')
386 gl_includes += [compat_includes]
390 gles3_h = gles2_dep.found() and cc.has_header('GLES3/gl3.h', dependencies : gles2_dep, include_directories : compat_includes)
393 if host_system == 'ios'
395 # include <OpenGLES/ES2/gl.h>
396 # include <OpenGLES/ES2/glext.h>
400 gl_includes += [compat_includes]
401 gles3ext3_h = gles3_h and cc.has_header('GLES3/gl3ext.h', dependencies : gles2_dep, include_directories : compat_includes)
403 # include <GLES3/gl3.h>
404 # include <GLES2/gl2ext.h>'''
407 # include <GLES3/gl3ext.h>'''
411 # include <GLES2/gl2.h>
412 # include <GLES2/gl2ext.h>'''
417 # can we include both gles2 and opengl headers?
418 if gles2_dep.found() and gl_dep.found()
419 gl_include_block = gl_include_header + gles_includes + opengl_includes
420 # TODO: Revert to passing gl_include_block via prefix: once
421 # https://github.com/mesonbuild/meson/issues/2364 is fixed
422 if not cc.compiles(gl_include_block + '\n' + 'void f (void) {}',dependencies : [gles2_dep, gl_dep], include_directories : compat_includes)
423 message ('Cannot include both OpenGL and OpenGL ES headers')
424 if need_api_gles2 != 'yes'
425 gles2_dep = unneeded_dep
426 elif need_api_opengl != 'yes'
427 gl_dep = unneeded_dep
429 error('Both OpenGL and OpenGL ES were requested but cannot be included together')
433 gl_include_block = gl_include_header
435 gl_include_block += gles_includes
438 gl_include_block += opengl_includes
442 gl_lib_deps += gles2_dep
443 glconf.set10('GST_GL_HAVE_GLES2', 1)
445 glconf.set10('GST_GL_HAVE_GLES3', 1)
447 glconf.set10('GST_GL_HAVE_GLES3EXT3_H', 1)
450 enabled_gl_apis += 'gles2'
454 gl_lib_deps += gl_dep
455 glconf.set10('GST_GL_HAVE_OPENGL', 1)
456 enabled_gl_apis += 'opengl'
460 egl_dep = unneeded_dep
461 if need_platform_egl != 'no'
462 egl_dep = dependency('egl', required : false)
463 if not egl_dep.found()
464 egl_dep = cc.find_library('EGL', required : false)
467 if egl_dep.found() and not cc.has_header('EGL/egl.h',
468 dependencies : egl_dep,
469 include_directories : compat_includes)
470 egl_dep = unneeded_dep
472 if egl_dep.found() and not cc.has_header('EGL/eglext.h',
473 dependencies : egl_dep,
474 include_directories : compat_includes)
475 egl_dep = unneeded_dep
482 'egl/gstglcontext_egl.c',
483 'egl/gstgldisplay_egl.c',
484 'egl/gstglmemoryegl.c',
489 'egl/gstgldisplay_egl.h',
490 'egl/gstglmemoryegl.h',
492 gl_platform_deps += egl_dep
493 glconf.set10('GST_GL_HAVE_PLATFORM_EGL', 1)
495 if cc.has_header('libdrm/drm_fourcc.h')
496 gl_misc_deps += allocators_dep
497 glconf.set10('GST_GL_HAVE_DMABUF', 1)
502 #include <EGL/eglext.h>
504 enabled_gl_platforms += 'egl'
505 elif need_platform_egl == 'yes'
506 error ('Could not find requested EGL library')
511 wayland_client_dep = unneeded_dep
512 wayland_cursor_dep = unneeded_dep
513 wayland_egl_dep = unneeded_dep
514 if need_win_wayland != 'no'
515 if need_win_wayland == 'yes'
516 if need_platform_egl == 'no'
517 error('Impossible situation requested: Cannot use Wayland without EGL support')
520 if not egl_dep.found()
521 if need_win_wayland == 'yes'
522 error ('Could not find EGL libraries for wayland')
524 message ('Could not find EGL libraries for wayland')
527 wayland_client_dep = dependency('wayland-client', version : '>= 1.0', required : false)
528 wayland_cursor_dep = dependency('wayland-cursor', version : '>= 1.0', required : false)
529 wayland_egl_dep = dependency('wayland-egl', version : '>= 1.0', required : false)
531 if wayland_client_dep.found() and wayland_cursor_dep.found() and wayland_egl_dep.found()
533 'wayland/gstgldisplay_wayland.c',
534 'wayland/gstglwindow_wayland_egl.c',
535 'wayland/wayland_event_source.c',
537 gl_wayland_headers += [
538 'wayland/gstgldisplay_wayland.h'
540 glconf.set('GST_GL_HAVE_WINDOW_WAYLAND', 1)
541 gl_winsys_deps += [wayland_client_dep, wayland_cursor_dep, wayland_egl_dep]
542 enabled_gl_winsys += 'wayland'
544 if need_win_wayland == 'yes'
545 error ('Could not find requested Wayland libraries')
547 wayland_client_dep = unneeded_dep
548 wayland_cursor_dep = unneeded_dep
549 wayland_egl_dep = unneeded_dep
555 if need_platform_glx == 'yes'
556 if need_win_x11 == 'no'
557 error('Impossible situation requested: Cannot use GLX without X11 support')
558 elif need_api_opengl == 'no'
559 error('Impossible situation requested: Cannot use GLX without the OpenGL library')
563 if need_win_x11 != 'no'
564 xcb_dep = dependency('x11-xcb', required : false)
565 if x11_dep.found() and xcb_dep.found()
567 'x11/gstgldisplay_x11.c',
568 'x11/gstglwindow_x11.c',
569 'x11/xcb_event_source.c',
572 'x11/gstgldisplay_x11.h',
574 glconf.set('GST_GL_HAVE_WINDOW_X11', 1)
575 gl_winsys_deps += [x11_dep, xcb_dep]
576 enabled_gl_winsys += 'x11'
578 if need_platform_glx != 'no' and glx_dep.found()
579 glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
581 'x11/gstglcontext_glx.c',
583 # GLX is in the opengl library on linux
584 gl_platform_deps += glx_dep
585 enabled_gl_platforms += 'glx'
587 elif need_win_x11 == 'yes'
588 error ('Could not find requested X11 libraries')
592 bcm_host_dep = unneeded_dep
593 if need_win_dispmanx != 'no'
595 # Try pkg-config for bcm_host then fallback to find_library to also
596 # support older distribution
597 bcm_host_dep = dependency('bcm_host', required : false)
598 if not bcm_host_dep.found()
599 bcm_host_dep = cc.find_library('bcm_host', required : false)
602 if bcm_host_dep.found()
603 if not egl_dep.found()
604 error('dispmanx requires the use of egl')
608 'dispmanx/gstglwindow_dispmanx_egl.c'
611 glconf.set('GST_GL_HAVE_WINDOW_DISPMANX', 1)
612 gl_winsys_deps += bcm_host_dep
613 enabled_gl_winsys += 'dispmanx'
614 gl_cpp_args += ['-DUSE_EGL_RPI']
615 elif need_win_dispmanx == 'yes'
616 error('Could not find dispmanx libraries')
621 if need_platform_wgl == 'yes'
622 if need_win_win32 == 'no'
623 error('Impossible situation requested: Cannot use WGL without the win32 window system')
627 if need_platform_wgl != 'no' and need_win_win32 != 'no'
628 gdi_dep = cc.find_library('gdi32', required : false)
629 # FIXME: Revert back to has_header once it gains prefix support
630 wglext_h = cc.has_header_symbol('GL/wglext.h', 'WGL_WGLEXT_VERSION',
631 prefix : '''#include <windows.h>
632 #include <GL/gl.h>''',
633 include_directories : compat_includes)
635 if wglext_h and gdi_dep.found() and gl_dep.found()
636 gl_includes += [compat_includes]
637 gl_platform_deps += gdi_dep
639 'win32/gstglwindow_win32.c',
640 'win32/gstglwindow_win32.c',
641 'win32/gstglcontext_wgl.c',
643 enabled_gl_winsys += 'win32'
644 gl_winsys_deps += gdi_dep
645 enabled_gl_platforms += 'wgl'
646 glconf.set('GST_GL_HAVE_WINDOW_WIN32', 1)
647 glconf.set('GST_GL_HAVE_PLATFORM_WGL', 1)
651 if ['darwin', 'ios'].contains(host_system)
653 error('No ObjC compiler found')
656 objc = meson.get_compiler('objc')
657 if not objc.has_argument('-fobjc-arc')
658 error('ARC is required for building')
661 gl_objc_args += ['-fobjc-arc']
665 if need_platform_cgl == 'yes'
666 if need_win_cocoa == 'no'
667 error('Impossible situation requested: Cannot use CGL without Cocoa support')
668 elif need_api_opengl == 'no'
669 error('Impossible situation requested: Cannot use CGL without the OpenGL library')
671 elif need_platform_cgl == 'no' and need_win_cocoa == 'yes'
672 error('Impossible situation requested: Cannot use Cocoa without CGL support')
675 if host_system == 'darwin'
676 foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
677 quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
678 corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
680 if need_platform_cgl != 'no'
681 if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found()
682 gl_platform_deps += [quartzcore_dep, corefoundation_dep, foundation_dep]
683 enabled_gl_platforms += 'cgl'
684 glconf.set10('GST_GL_HAVE_PLATFORM_CGL', 1)
686 if need_win_cocoa != 'no'
687 cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : false)
690 'cocoa/gstglcaopengllayer.m',
691 'cocoa/gstglcontext_cocoa.m',
692 'cocoa/gstgldisplay_cocoa.m',
693 'cocoa/gstglwindow_cocoa.m'
695 gl_winsys_deps += cocoa_dep
696 enabled_gl_winsys += 'cocoa'
697 glconf.set10('GST_GL_HAVE_WINDOW_COCOA', 1)
698 elif need_win_cocoa == 'yes'
699 error('Could not find Cocoa')
702 elif need_platform_cgl == 'yes'
703 error('Could not find CGL dependencies')
708 if need_platform_eagl == 'yes'
709 if host_system != 'ios'
710 error('Can only use EAGL on iOS')
712 if need_win_eagl == 'no'
713 error('Impossible situation requested: Cannot use EAGL platform without the EAGL window system')
714 elif need_api_gles == 'no'
715 error('Impossible situation requested: Cannot use EAGL platform without the GLES library')
717 elif need_platform_eagl == 'no' and need_win_eagl == 'yes'
718 error('Impossible situation requested: Cannot use EAGL window system without the EAGL platform')
721 if host_system == 'ios' and need_platform_eagl != 'no' and need_win_eagl != 'no'
722 foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
723 corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
724 coregraphics_dep = dependency('appleframeworks', modules : ['CoreGraphics'], required : false)
725 uikit_dep = dependency('appleframeworks', modules : ['UIkit'], required : false)
727 if foundation_dep.found() and corefoundation_dep.found() and coregraphics_dep.found() and uikit_dep.found()
728 gl_platform_deps += [
735 'eagl/gstglcontext_eagl.m',
736 'eagl/gstglwindow_eagl.m',
738 enabled_gl_winsys += 'eagl'
739 enabled_gl_platforms += 'eagl'
740 glconf.set('GST_GL_HAVE_WINDOW_EAGL', 1)
741 glconf.set('GST_GL_HAVE_PLATFORM_EAGL', 1)
742 elif need_platform_eagl == 'yes' or need_win_eagl == 'yes'
743 error('Could not find dependencies for EAGL')
748 gbm_gudev_dep = unneeded_dep
749 gbm_libdrm_dep = unneeded_dep
750 gbm_dep = unneeded_dep
751 if need_win_gbm != 'no'
752 if need_win_gbm == 'yes'
753 if need_platform_egl == 'no'
754 error('Impossible situation requested: Cannot use GBM without EGL support')
758 gbm_gudev_dep = dependency('gudev-1.0', version : '>=147', required : false)
759 gbm_libdrm_dep = dependency('libdrm', version : '>= 2.4.55', required : false)
760 gbm_dep = dependency('gbm', required : false)
761 if egl_dep.found() and gbm_gudev_dep.found() and gbm_libdrm_dep.found() and gbm_dep.found()
763 'gbm/gstgldisplay_gbm.c',
764 'gbm/gstgl_gbm_utils.c',
765 'gbm/gstglwindow_gbm_egl.c',
767 enabled_gl_winsys += 'gbm'
768 gl_winsys_deps += [gbm_gudev_dep, gbm_libdrm_dep, gbm_dep]
769 glconf.set('GST_GL_HAVE_WINDOW_GBM', 1)
771 if need_win_gbm == 'yes'
772 error ('Could not find requested GBM libraries')
774 gbm_gudev_dep = unneeded_dep
775 gbm_libdrm_dep = unneeded_dep
776 gbm_dep = unneeded_dep
780 if need_platform_egl != 'no' and need_win_viv_fb != 'no'
781 if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep)
782 if cc.has_function ('glTexDirectVIV', dependencies : gles2_dep)
783 enabled_gl_winsys += 'viv-fb'
784 glconf.set10('GST_GL_HAVE_WINDOW_VIV_FB', 1)
785 glconf.set10('GST_GL_HAVE_VIV_DIRECTVIV', 1)
787 'viv-fb/gstgldisplay_viv_fb.c',
788 'viv-fb/gstglwindow_viv_fb_egl.c',
790 gl_cpp_args += ['-DEGL_API_FB']
795 if need_win_android == 'yes'
796 if need_platform_egl == 'no'
797 error('Impossible situation requested: Cannot build for Android without EGL')
798 elif need_api_gles2 == 'no'
799 error('Impossible situation requested: Cannot build for Android without GLES2 support')
800 elif host_system != 'android'
801 error('Impossible situation requested: Cannot build for Android without an android system')
805 if host_system == 'android' and need_win_android != 'no' and need_platform_egl != 'no'
806 if gles2_dep.found() and egl_dep.found()
807 enabled_gl_winsys += ['android']
808 glconf.set10('GST_GL_HAVE_WINDOW_ANDROID', 1)
810 'android/gstglwindow_android_egl.c'
815 # TODO: Add rest of gl config here.
816 # iOS, specific support
819 if enabled_gl_apis.length() == 0
820 message('No OpenGL API libraries found or requested')
823 if enabled_gl_platforms.length() == 0
824 message('No OpenGL Platforms found or requested')
827 if enabled_gl_winsys.length() == 0
828 message('No OpenGL Window systems found or requested')
833 # find some types that may or may not be defined
834 if cc.has_type('GLeglImageOES', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
835 glconf.set('GST_GL_HAVE_GLEGLIMAGEOES', 1)
837 if cc.has_type('GLchar', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
838 glconf.set('GST_GL_HAVE_GLCHAR', 1)
840 if cc.has_type('GLsizeiptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
841 glconf.set('GST_GL_HAVE_GLSIZEIPTR', 1)
843 if cc.has_type('GLintptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
844 glconf.set('GST_GL_HAVE_GLINTPTR', 1)
846 if cc.has_type('GLsync', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
847 glconf.set('GST_GL_HAVE_GLSYNC', 1)
849 if cc.has_type('GLuint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
850 glconf.set('GST_GL_HAVE_GLUINT64', 1)
852 if cc.has_type('GLint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
853 glconf.set('GST_GL_HAVE_GLINT64', 1)
855 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)
856 glconf.set('GST_GL_HAVE_EGLATTRIB', 1)
858 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)
859 glconf.set('GST_GL_HAVE_EGLUINT64KHR', 1)
862 message('Building libgstgl with GL api: ' + ' '.join(enabled_gl_apis))
863 message('Building libgstgl with GL platform: ' + ' '.join(enabled_gl_platforms))
864 message('Building libgstgl with GL winsys: ' + ' '.join(enabled_gl_winsys))
866 install_headers(gl_headers, subdir : 'gstreamer-1.0/gst/gl')
867 install_headers(gl_cocoa_headers, subdir : 'gstreamer-1.0/gst/gl/cocoa')
868 install_headers(gl_egl_headers, subdir : 'gstreamer-1.0/gst/gl/egl')
869 install_headers(gl_prototype_headers, subdir : 'gstreamer-1.0/gst/gl/glprototypes')
870 install_headers(gl_x11_headers, subdir : 'gstreamer-1.0/gst/gl/x11')
871 install_headers(gl_wayland_headers, subdir : 'gstreamer-1.0/gst/gl/wayland')
873 configure_file(input : 'gstglconfig.h.meson',
874 output : 'gstglconfig.h',
875 install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/gl',
876 configuration : glconf)
878 gstgl = library('gstgl-' + api_version,
880 c_args : gst_plugins_base_args + gl_cpp_args + ['-DBUILDING_GST_GL'],
881 objc_args : gst_plugins_base_args + gl_cpp_args + gl_objc_args + ['-DBUILDING_GST_GL'],
882 include_directories : [configinc, libsinc, gl_includes],
883 version : libversion,
884 soversion : soversion,
885 darwin_versions : osxversion,
887 dependencies : [gst_base_dep, video_dep, allocators_dep, gmodule_dep,
888 gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps])
891 gl_gir = gnome.generate_gir(gstgl,
892 sources : gl_sources + gir_gl_headers + gl_x11_headers + gl_wayland_headers + gl_win32_headers + gl_cocoa_headers + gl_egl_headers,
894 nsversion : api_version,
895 identifier_prefix : 'Gst',
896 symbol_prefix : 'gst',
897 export_packages : 'gstreamer-gl-1.0',
898 includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
900 extra_args : gir_init_section + ['--c-include=gst/gl/gl.h'],
901 dependencies : [video_dep, gst_dep, gst_base_dep]
903 gen_sources += gl_gir
907 gstgl_dep = declare_dependency(link_with : gstgl,
908 include_directories : [libsinc, compat_includes],
909 sources: gen_sources,
910 dependencies : [video_dep, gst_base_dep] + gl_winsys_deps)
912 elif get_option('gl').enabled()
913 error('GStreamer OpenGL integration required via options, but needed dependencies not found.')
915 gstgl_dep = dependency('', required : false)