gl:meson: Minor typo fix
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-base / gst-libs / gst / gl / meson.build
1 gstgl_dep = dependency('', required : false)
2 gstglproto_dep = dependency('', required : false)
3 gstglx11_dep = dependency('', required : false)
4 gstglwayland_dep = dependency('', required : false)
5 gstglegl_dep = dependency('', required : false)
6
7 if get_option('gl').disabled()
8   message('GStreamer OpenGL integration disabled via options.')
9   build_gstgl = false
10   subdir_done()
11 endif
12
13 gl_sources = files([
14   'gstglapi.c',
15   'gstglbasefilter.c',
16   'gstglbasememory.c',
17   'gstglbasesrc.c',
18   'gstglcolorconvert.c',
19   'gstglbuffer.c',
20   'gstglbufferpool.c',
21   'gstglcontext.c',
22   'gstglcontextconfig.c',
23   'gstglcontextquirks.c',
24   'gstgldebug.c',
25   'gstgldisplay.c',
26   'gstglfeature.c',
27   'gstglfilter.c',
28   'gstglformat.c',
29   'gstglframebuffer.c',
30   'gstglmemory.c',
31   'gstglmemorypbo.c',
32   'gstgloverlaycompositor.c',
33   'gstglquery.c',
34   'gstglrenderbuffer.c',
35   'gstglshader.c',
36   'gstglshaderstrings.c',
37   'gstglsl.c',
38   'gstglslstage.c',
39   'gstglsyncmeta.c',
40   'gstglupload.c',
41   'gstglutils.c',
42   'gstglviewconvert.c',
43   'gstglwindow.c',
44 ])
45
46 gl_priv_sources = []
47
48 gir_gl_headers = files([
49   'gl.h',
50   'gl-prelude.h',
51   'gstgl_enums.h',
52   'gstgl_fwd.h',
53   'gstglapi.h',
54   'gstglbasefilter.h',
55   'gstglbasememory.h',
56   'gstglbasesrc.h',
57   'gstglbuffer.h',
58   'gstglbufferpool.h',
59   'gstglcolorconvert.h',
60   'gstglcontext.h',
61   'gstglcontextconfig.h',
62   'gstgldebug.h',
63   'gstgldisplay.h',
64   'gstglfeature.h',
65   'gstglfilter.h',
66   'gstglformat.h',
67   'gstglframebuffer.h',
68   'gstglmemory.h',
69   'gstglmemorypbo.h',
70   'gstgloverlaycompositor.h',
71   'gstglquery.h',
72   'gstglrenderbuffer.h',
73   'gstglshader.h',
74   'gstglshaderstrings.h',
75   'gstglsl.h',
76   'gstglslstage.h',
77   'gstglsyncmeta.h',
78   'gstglupload.h',
79   'gstglutils.h',
80   'gstglviewconvert.h',
81   'gstglwindow.h',
82 ])
83
84 gl_headers = gir_gl_headers + files([
85   'gstglfuncs.h',
86 ])
87
88 gl_prototype_headers = files([
89   'glprototypes/all_functions.h',
90   'glprototypes/base.h',
91   'glprototypes/buffer_storage.h',
92   'glprototypes/blending.h',
93   'glprototypes/buffers.h',
94   'glprototypes/debug.h',
95   'glprototypes/eglimage.h',
96   'glprototypes/fbo.h',
97   'glprototypes/fixedfunction.h',
98   'glprototypes/gles.h',
99   'glprototypes/gstgl_compat.h',
100   'glprototypes/gstgl_gles2compat.h',
101   'glprototypes/opengl.h',
102   'glprototypes/query.h',
103   'glprototypes/shaders.h',
104   'glprototypes/sync.h',
105   'glprototypes/vao.h',
106 ])
107
108 gl_x11_sources = []
109 gl_x11_headers = []
110 gl_wayland_sources = []
111 gl_wayland_headers = []
112 gl_egl_sources = []
113 gl_egl_headers = []
114
115 glconf = configuration_data()
116 glconf_options = [
117     'GST_GL_HAVE_OPENGL',
118     'GST_GL_HAVE_GLES2',
119     'GST_GL_HAVE_GLES3',
120     'GST_GL_HAVE_GLES3EXT3_H',
121
122     'GST_GL_HAVE_WINDOW_X11',
123     'GST_GL_HAVE_WINDOW_COCOA',
124     'GST_GL_HAVE_WINDOW_WIN32',
125     'GST_GL_HAVE_WINDOW_WINRT',
126     'GST_GL_HAVE_WINDOW_WAYLAND',
127     'GST_GL_HAVE_WINDOW_ANDROID',
128     'GST_GL_HAVE_WINDOW_DISPMANX',
129     'GST_GL_HAVE_WINDOW_EAGL',
130     'GST_GL_HAVE_WINDOW_VIV_FB',
131     'GST_GL_HAVE_WINDOW_GBM',
132
133     'GST_GL_HAVE_PLATFORM_EGL',
134     'GST_GL_HAVE_PLATFORM_GLX',
135     'GST_GL_HAVE_PLATFORM_WGL',
136     'GST_GL_HAVE_PLATFORM_CGL',
137     'GST_GL_HAVE_PLATFORM_EAGL',
138
139     'GST_GL_HAVE_DMABUF',
140     'GST_GL_HAVE_VIV_DIRECTVIV',
141
142     'GST_GL_HAVE_GLEGLIMAGEOES',
143     'GST_GL_HAVE_GLCHAR',
144     'GST_GL_HAVE_GLSIZEIPTR',
145     'GST_GL_HAVE_GLINTPTR',
146     'GST_GL_HAVE_GLSYNC',
147     'GST_GL_HAVE_GLUINT64',
148     'GST_GL_HAVE_GLINT64',
149     'GST_GL_HAVE_EGLATTRIB',
150     'GST_GL_HAVE_EGLUINT64KHR',
151 ]
152
153 foreach option : glconf_options
154   glconf.set(option, 0)
155 endforeach
156
157 unneeded_dep = dependency('', required : false)
158 if unneeded_dep.found()
159   error ('Found unfindable dependency')
160 endif
161
162 # OpenGL/GLES2 libraries
163 gl_lib_deps = []
164 # GL platform - EGL, GLX, CGL, WGL, etc
165 gl_platform_deps = []
166 # GL winsys - wayland, X11, Cocoa, win32, etc
167 gl_winsys_deps = []
168 # other things we need.
169 gl_misc_deps = []
170 # Other preprocessor arguments
171 gl_cpp_args = []
172 gl_includes = []
173 gl_objc_args = []
174
175 enabled_gl_apis = []
176 enabled_gl_platforms = []
177 enabled_gl_winsys = []
178
179 # parse provided options
180 libegl_module_name = get_option('egl_module_name')
181 if libegl_module_name != ''
182   gl_cpp_args += ['-DGST_GL_LIBEGL_MODULE_NAME="@0@"'.format(libegl_module_name)]
183 endif
184 libgles2_module_name = get_option('gles2_module_name')
185 if libgles2_module_name != ''
186   gl_cpp_args += ['-DGST_GL_LIBGLESV2_MODULE_NAME="@0@"'.format(libgles2_module_name)]
187 endif
188 libgl_module_name = get_option('opengl_module_name')
189 if libgl_module_name != ''
190   gl_cpp_args += ['-DGST_GL_LIBGL_MODULE_NAME="@0@"'.format(libgl_module_name)]
191 endif
192
193 gl_apis = get_option('gl_api')
194 if gl_apis.contains('auto')
195   need_api_opengl = 'auto'
196   need_api_gles2 = 'auto'
197 else
198   need_api_opengl = 'no'
199   need_api_gles2 = 'no'
200   foreach api : gl_apis
201     if api == 'opengl'
202       need_api_opengl = 'yes'
203     elif api == 'gles2'
204       need_api_gles2 = 'yes'
205     else
206       error('Unsupported GL api provided ' + api)
207     endif
208   endforeach
209 endif
210
211 gl_platforms = get_option('gl_platform')
212 if gl_platforms.contains('auto')
213   need_platform_egl = 'auto'
214   need_platform_glx = 'auto'
215   need_platform_cgl = 'auto'
216   need_platform_wgl = 'auto'
217   need_platform_eagl = 'auto'
218 else
219   need_platform_egl = 'no'
220   need_platform_glx = 'no'
221   need_platform_cgl = 'no'
222   need_platform_wgl = 'no'
223   need_platform_eagl = 'no'
224   foreach platform : gl_platforms
225     if platform == 'egl'
226       need_platform_egl = 'yes'
227     elif platform == 'glx'
228       need_platform_glx = 'yes'
229     elif platform == 'cgl'
230       need_platform_cgl = 'yes'
231     elif platform == 'wgl'
232       need_platform_wgl = 'yes'
233     elif platform == 'eagl'
234       need_platform_eagl = 'yes'
235     else
236       error('Unsupported GL platform provided ' + platform)
237     endif
238   endforeach
239 endif
240
241 gl_winsys = get_option('gl_winsys')
242 if gl_winsys.contains('auto')
243   need_win_x11 = 'auto'
244   need_win_wayland = 'auto'
245   need_win_win32 = 'auto'
246   need_win_winrt = 'auto'
247   need_win_cocoa = 'auto'
248   need_win_egl = 'auto'
249   need_win_eagl = 'auto'
250   need_win_dispmanx = 'auto'
251   need_win_viv_fb = 'auto'
252   need_win_gbm = 'auto'
253   need_win_android = 'auto'
254 else
255   need_win_x11 = 'no'
256   need_win_wayland = 'no'
257   need_win_win32 = 'no'
258   need_win_winrt = 'no'
259   need_win_cocoa = 'no'
260   need_win_egl = 'no'
261   need_win_eagl = 'no'
262   need_win_dispmanx = 'no'
263   need_win_viv_fb = 'no'
264   need_win_gbm = 'no'
265   need_win_android = 'no'
266   foreach winsys : gl_winsys
267     if winsys == 'x11'
268       need_win_x11 = 'yes'
269     elif winsys == 'wayland'
270       need_win_wayland = 'yes'
271     elif winsys == 'win32'
272       need_win_win32 = 'yes'
273     elif winsys == 'winrt'
274       need_win_winrt = 'yes'
275     elif winsys == 'cocoa'
276       need_win_cocoa = 'yes'
277     elif winsys == 'egl'
278       need_win_egl = 'yes'
279     elif winsys == 'eagl'
280       need_win_eagl = 'yes'
281     elif winsys == 'dispmanx'
282       need_win_dispmanx = 'yes'
283     elif winsys == 'viv-fb'
284       need_win_viv_fb = 'yes'
285     elif winsys == 'gbm'
286       need_win_gbm = 'yes'
287     elif winsys == 'android'
288       need_win_android = 'yes'
289     else
290       error('Unsupported GL winsys provided ' + winsys)
291     endif
292   endforeach
293 endif
294
295 gl_include_header = '''
296 #ifdef __GNUC__
297 #  pragma GCC diagnostic push
298 #  pragma GCC diagnostic ignored "-Wredundant-decls"
299 #endif
300 #ifndef GL_GLEXT_PROTOTYPES
301 #define GL_GLEXT_PROTOTYPES 1
302 #endif
303 '''
304
305 # convoluted way of getting at the subproject taking into account the wrap-mode
306 # so we don't download a subproject unless allowed
307 gl_header_dep = dependency('', fallback : ['gl-headers', 'gl_headers_dummy_dep'],
308     required : false)
309 if gl_header_dep.type_name() == 'internal'
310   # this will only contain the includes of headers that are not found
311   compat_includes = subproject('gl-headers').get_variable('compatibility_includes')
312 else
313   compat_includes = []
314 endif
315
316 # Desktop OpenGL checks
317 gl_dep = unneeded_dep
318 glx_dep = unneeded_dep
319
320 # (GLVND) OpenGL (without GLX) headers and interface
321 if need_api_opengl != 'no'
322   gl_dep = dependency('opengl', method: 'pkg-config', required : false)
323 endif
324
325 # non-GLVND aka Legacy OpenGL
326 if need_api_opengl != 'no' and not gl_dep.found()
327   if host_system == 'darwin'
328     gl_dep = dependency('appleframeworks', modules : ['OpenGL'], required : false)
329   else
330     # override meson's braindead gl detection on osx/windows/etc by forcing pkg-config
331     gl_dep = dependency('gl', method: 'pkg-config', required : false)
332   endif
333
334   if not gl_dep.found()
335     if host_system == 'windows'
336       gl_dep = cc.find_library('opengl32', required : false)
337     else
338       gl_dep = cc.find_library('GL', required : false)
339     endif
340
341     if not cc.has_header('GL/gl.h', include_directories : compat_includes)
342       gl_dep = unneeded_dep
343     endif
344
345     if not gl_dep.found() and need_api_opengl == 'yes'
346       error ('Could not find requested OpenGL library')
347     endif
348
349     if gl_dep.found()
350       gl_includes += [compat_includes]
351     endif
352   endif
353 endif
354
355 if need_platform_glx != 'no'
356   # (GLVND) GLX library and headers.
357   glx_dep = dependency('glx', method: 'pkg-config', required : false)
358
359   if not glx_dep.found()
360     if host_system == 'darwin'
361       glx_dep = cc.find_library('GL', required : false)
362     elif gl_dep.found()
363       glx_dep = gl_dep
364     elif need_platform_glx == 'yes'
365       error ('Could not find requested GLX library')
366     endif
367   endif
368 endif
369
370 if need_api_opengl != 'no'
371   opengl_includes = ''
372   if host_system == 'darwin'
373     opengl_includes += '''
374 #if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1014
375 # define GL_SILENCE_DEPRECATION
376 #endif
377 #include <OpenGL/OpenGL.h>
378 #include <OpenGL/gl.h>
379 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
380 # define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
381 # include <OpenGL/gl3.h>
382 #endif
383 '''
384   else
385     opengl_includes += '''
386 #if _MSC_VER
387 # include <windows.h>
388 #endif
389 #include <GL/gl.h>
390 #if __WIN32__ || _WIN32
391 # include <GL/glext.h>
392 #endif
393 '''
394   endif
395 endif
396
397 bcm_host_dep = unneeded_dep
398 if need_win_dispmanx != 'no'
399
400   # Try pkg-config for bcm_host then fallback to find_library to also
401   # support older distribution
402   bcm_host_dep = dependency('bcm_host', required : false)
403   if not bcm_host_dep.found()
404     bcm_host_dep = cc.find_library('bcm_host', required : false)
405   endif
406 endif
407
408 # GLES2 checks
409 gles2_dep = unneeded_dep
410 gles3_h = false
411 gles3ext3_h = false
412 if need_api_gles2 != 'no'
413   if host_system == 'ios'
414     gles2_dep = dependency('appleframeworks', modules : ['OpenGLES'], required : false)
415   else
416     if bcm_host_dep.found()
417       gles2_dep = dependency('brcmglesv2', required : false)
418     endif
419     if not gles2_dep.found()
420       gles2_dep = dependency('glesv2', required : false)
421     endif
422   endif
423
424   if not gles2_dep.found()
425 #    if host_system == 'windows'
426 #    elif host_system == ios
427 #      gles2_dep = cc.find_library('GLESv2', required : false)
428 #    else
429       gles2_dep = cc.find_library('GLESv2', required : false)
430 #    endif
431
432     if not cc.has_header('GLES2/gl2.h', include_directories : compat_includes)
433       gles2_dep = unneeded_dep
434     endif
435
436     if not gles2_dep.found() and need_api_gles2 == 'yes'
437       error ('Could not find requested OpenGL ES library')
438     endif
439
440     if gles2_dep.found()
441       gl_includes += [compat_includes]
442     endif
443   endif
444
445   gles3_h = gles2_dep.found() and cc.has_header('GLES3/gl3.h', dependencies : gles2_dep, include_directories : compat_includes)
446
447   gles_includes = ''
448   if host_system == 'ios'
449     gles_includes += '''
450 # include <OpenGLES/ES2/gl.h>
451 # include <OpenGLES/ES2/glext.h>
452 '''
453   else
454     if gles3_h
455       gl_includes += [compat_includes]
456       gles3ext3_h = gles3_h and cc.has_header('GLES3/gl3ext.h', dependencies : gles2_dep, include_directories : compat_includes)
457       gles_includes += '''
458 # include <GLES3/gl3.h>
459 # include <GLES2/gl2ext.h>'''
460       if gles3ext3_h
461         gles_includes += '''
462 # include <GLES3/gl3ext.h>'''
463       endif
464     else
465       gles_includes += '''
466 # include <GLES2/gl2.h>
467 # include <GLES2/gl2ext.h>'''
468     endif
469   endif
470 endif
471
472 # can we include both gles2 and opengl headers?
473 if gles2_dep.found() and gl_dep.found()
474   gl_include_block = gl_include_header + gles_includes + opengl_includes
475   # TODO: Revert to passing gl_include_block via prefix: once
476   # https://github.com/mesonbuild/meson/issues/2364 is fixed
477   if not cc.compiles(gl_include_block + '\n' + 'void f (void) {}',dependencies : [gles2_dep, gl_dep], include_directories : compat_includes)
478     message ('Cannot include both OpenGL and OpenGL ES headers')
479     if need_api_gles2 != 'yes'
480       gles2_dep = unneeded_dep
481     elif need_api_opengl != 'yes'
482       gl_dep = unneeded_dep
483     else
484       error('Both OpenGL and OpenGL ES were requested but cannot be included together')
485     endif
486   endif
487 endif
488 gl_include_block = gl_include_header
489 if gles2_dep.found()
490   gl_include_block += gles_includes
491 endif
492 if gl_dep.found()
493   gl_include_block += opengl_includes
494 endif
495
496 if gles2_dep.found()
497   gl_lib_deps += gles2_dep
498   glconf.set('GST_GL_HAVE_GLES2', 1)
499   if gles3_h
500     glconf.set('GST_GL_HAVE_GLES3',1)
501     if gles3ext3_h
502       glconf.set('GST_GL_HAVE_GLES3EXT3_H', 1)
503     endif
504   endif
505   enabled_gl_apis += 'gles2'
506 endif
507
508 if gl_dep.found()
509   gl_lib_deps += gl_dep
510   glconf.set('GST_GL_HAVE_OPENGL', 1)
511   enabled_gl_apis += 'gl'
512 endif
513
514 # EGL checks
515 egl_dep = unneeded_dep
516 if need_platform_egl != 'no'
517   if bcm_host_dep.found()
518     egl_dep = dependency('brcmegl', required : false)
519   endif
520   if not egl_dep.found()
521     egl_dep = dependency('egl', required : false)
522   endif
523   if not egl_dep.found()
524     egl_dep = cc.find_library('EGL', required : false)
525   endif
526
527   if egl_dep.found() and not cc.has_header('EGL/egl.h',
528                                            dependencies : egl_dep,
529                                            include_directories : compat_includes)
530     egl_dep = unneeded_dep
531   endif
532   if egl_dep.found() and not cc.has_header('EGL/eglext.h',
533                                            dependencies : egl_dep,
534                                            include_directories : compat_includes)
535     egl_dep = unneeded_dep
536   endif
537
538   if egl_dep.found()
539     gl_egl_sources += files([
540       'egl/gstegl.c',
541       'egl/gsteglimage.c',
542       'egl/gstglcontext_egl.c',
543       'egl/gstgldisplay_egl.c',
544       'egl/gstglmemoryegl.c',
545       'egl/gstgldisplay_egl_device.c',
546     ])
547     gl_egl_headers += files([
548       'egl/egl.h',
549       'egl/gstegl.h',
550       'egl/gsteglimage.h',
551       'egl/gstgldisplay_egl.h',
552       'egl/gstglmemoryegl.h',
553       'egl/gstgldisplay_egl_device.h',
554     ])
555     gl_platform_deps += egl_dep
556     glconf.set('GST_GL_HAVE_PLATFORM_EGL', 1)
557
558     if cc.has_header('libdrm/drm_fourcc.h')
559       gl_misc_deps += allocators_dep
560       glconf.set('GST_GL_HAVE_DMABUF', 1)
561     endif
562
563     egl_includes = '''
564 #include <EGL/egl.h>
565 #include <EGL/eglext.h>
566 '''
567     enabled_gl_platforms += 'egl'
568   elif need_platform_egl == 'yes'
569     error ('Could not find requested EGL library')
570   endif
571 endif
572
573 # winsys_egl checks
574 if need_win_egl == 'yes'
575   if need_platform_egl == 'no'
576     error('Impossible situation requested: Cannot use Winsys egl without EGL support')
577   elif not egl_dep.found()
578     error ('Could not find EGL libraries for Winsys egl')
579   else
580     enabled_gl_winsys += 'egl'
581   endif
582 endif
583
584 # wayland checks
585 wayland_client_dep = unneeded_dep
586 wayland_cursor_dep = unneeded_dep
587 wayland_egl_dep = unneeded_dep
588 if need_win_wayland != 'no'
589   if need_win_wayland == 'yes'
590     if need_platform_egl == 'no'
591       error('Impossible situation requested: Cannot use Wayland without EGL support')
592     endif
593   endif
594   if not egl_dep.found()
595     if need_win_wayland == 'yes'
596       error ('Could not find EGL libraries for wayland')
597     else
598       message ('Could not find EGL libraries for wayland')
599     endif
600   else
601     wayland_client_dep = dependency('wayland-client', version : '>= 1.11', required : false)
602     wayland_cursor_dep = dependency('wayland-cursor', version : '>= 1.0', required : false)
603     wayland_egl_dep = dependency('wayland-egl', version : '>= 1.0', required : false)
604     wayland_protocols_dep = dependency('wayland-protocols', version : '>= 1.15', required : false)
605     wayland_scanner = find_program('wayland-scanner', required: false)
606
607     if wayland_client_dep.found() and wayland_cursor_dep.found() and wayland_egl_dep.found() and wayland_protocols_dep.found() and wayland_scanner.found()
608       # Generate the XDG shell interface
609       wayland_protocols_basedir = wayland_protocols_dep.get_variable('pkgdatadir')
610       xdg_shell_xml_spec = join_paths(wayland_protocols_basedir, 'stable', 'xdg-shell', 'xdg-shell.xml')
611       xdg_shell_header = custom_target('xdg-shell-client-header',
612         command: [ wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@' ],
613         input: xdg_shell_xml_spec,
614         output: 'xdg-shell-client-protocol.h',
615       )
616       xdg_shell_code = custom_target('xdg-shell-client-code',
617         command: [ wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@' ],
618         input: xdg_shell_xml_spec,
619         output: 'xdg-shell-client-protocol.c',
620       )
621
622       gl_wayland_sources += files([
623         'wayland/gstgldisplay_wayland.c',
624       ])
625       gl_priv_sources += [
626         'wayland/gstglwindow_wayland_egl.c',
627         'wayland/wayland_event_source.c',
628         xdg_shell_header,
629         xdg_shell_code,
630       ]
631       gl_wayland_headers += files([
632         'wayland/wayland.h',
633         'wayland/gstgldisplay_wayland.h'
634       ])
635       glconf.set('GST_GL_HAVE_WINDOW_WAYLAND', 1)
636       gl_winsys_deps += [wayland_client_dep, wayland_cursor_dep, wayland_egl_dep]
637       enabled_gl_winsys += 'wayland'
638     else
639       if need_win_wayland == 'yes'
640         error ('Could not find requested Wayland libraries')
641       endif
642       wayland_client_dep = unneeded_dep
643       wayland_cursor_dep = unneeded_dep
644       wayland_egl_dep = unneeded_dep
645       wayland_protocols_dep = unneeded_dep
646     endif
647   endif
648 endif
649
650 # X11 checks
651 if need_platform_glx == 'yes'
652   if need_win_x11 == 'no'
653     error('Impossible situation requested: Cannot use GLX without X11 support')
654   elif need_api_opengl == 'no'
655     error('Impossible situation requested: Cannot use GLX without the OpenGL library')
656   endif
657 endif
658
659 xcb_dep = unneeded_dep
660 if need_win_x11 != 'no'
661   xcb_dep = dependency('x11-xcb', required : false)
662   if x11_dep.found() and xcb_dep.found()
663     gl_x11_sources += files([
664       'x11/gstgldisplay_x11.c',
665     ])
666     gl_priv_sources += [
667       'x11/gstglwindow_x11.c',
668       'x11/xcb_event_source.c',
669     ]
670     gl_x11_headers += files([
671       'x11/x11.h',
672       'x11/gstgldisplay_x11.h',
673     ])
674     glconf.set('GST_GL_HAVE_WINDOW_X11', 1)
675     gl_winsys_deps += [x11_dep, xcb_dep]
676     enabled_gl_winsys += 'x11'
677
678     if need_platform_glx != 'no' and glx_dep.found() and cc.has_function ('glXMakeCurrent', dependencies : glx_dep)
679       glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
680       gl_priv_sources += [
681         'x11/gstglcontext_glx.c',
682       ]
683       # GLX is in the opengl library on linux
684       gl_platform_deps += glx_dep
685       enabled_gl_platforms += 'glx'
686     endif
687   elif need_win_x11 == 'yes'
688     error ('Could not find requested X11 libraries')
689   endif
690 endif
691
692 if need_win_dispmanx != 'no'
693   if bcm_host_dep.found()
694     if not egl_dep.found()
695       error('dispmanx requires the use of egl')
696     endif
697
698     gl_priv_sources += [
699       'dispmanx/gstglwindow_dispmanx_egl.c'
700     ]
701
702     glconf.set('GST_GL_HAVE_WINDOW_DISPMANX', 1)
703     gl_winsys_deps += bcm_host_dep
704     enabled_gl_winsys += 'dispmanx'
705     gl_cpp_args += ['-DUSE_EGL_RPI']
706   elif need_win_dispmanx == 'yes'
707     error('Could not find dispmanx libraries')
708   endif
709 endif
710
711 # win32 checks
712 if need_platform_wgl == 'yes'
713   if need_win_win32 == 'no'
714     error('Impossible situation requested: Cannot use WGL without the win32 window system')
715   endif
716 endif
717
718 if host_system == 'windows' and need_win_win32 != 'no'
719   gdi_dep = cc.find_library('gdi32', required : false)
720   if gdi_dep.found()
721     have_wgl = false
722     have_egl_win32 = false
723     if need_platform_wgl != 'no'
724       wglext_h = cc.has_header('GL/wglext.h',
725                                prefix : '''#include <windows.h>
726                                            #include <GL/gl.h>''',
727                                include_directories : compat_includes)
728       have_wgl = wglext_h and gl_dep.found()
729     endif
730
731     have_egl_win32 = enabled_gl_platforms.contains('egl') and gles2_dep.found()
732     if have_wgl or have_egl_win32
733       gl_includes += [compat_includes]
734       gl_platform_deps += gdi_dep
735       gl_priv_sources += [
736         'win32/gstglwindow_win32.c',
737       ]
738       enabled_gl_winsys += 'win32'
739       gl_winsys_deps += gdi_dep
740       glconf.set('GST_GL_HAVE_WINDOW_WIN32', 1)
741     endif
742
743     if have_wgl
744       gl_priv_sources += [
745         'wgl/gstglcontext_wgl.c',
746       ]
747       enabled_gl_platforms += 'wgl'
748       glconf.set('GST_GL_HAVE_PLATFORM_WGL', 1)
749     endif
750   endif
751 endif
752
753 # WinRT ANGLE checks
754 if need_win_winrt != 'no' and host_system == 'windows'
755   if need_win_winrt == 'yes' and not enabled_gl_platforms.contains('egl')
756     error('Impossible situation requested: Cannot use WinRT ANGLE without EGL support')
757   endif
758
759   if egl_dep.found()
760     windows_graphics_h = cc.has_header('windows.graphics.h')
761     windows_app_dep = cc.find_library('WindowsApp', required: false)
762     runtimeobject_lib = cc.find_library('runtimeobject', required: false)
763
764     if windows_graphics_h and windows_app_dep.found() and runtimeobject_lib.found()
765       enabled_gl_winsys += 'winrt'
766       glconf.set('GST_GL_HAVE_WINDOW_WINRT', 1)
767       gl_priv_sources += [
768         'winrt/gstglwindow_winrt_egl.cpp'
769       ]
770       gl_winsys_deps += runtimeobject_lib
771     elif need_win_winrt == 'yes'
772       error('WinRT is enabled, but headers/libraries were not found')
773     endif
774   elif need_win_winrt == 'yes'
775     error('WinRT ANGLE is enabled, but EGL was not found')
776   else
777     message('WinRT ANGLE disabled because EGL was not found')
778   endif
779 endif
780
781 if ['darwin', 'ios'].contains(host_system)
782   if not have_objc
783     error('No ObjC compiler found')
784   endif
785
786   objc = meson.get_compiler('objc')
787   if not objc.has_argument('-fobjc-arc')
788     error('ARC is required for building')
789   endif
790
791   gl_objc_args += ['-fobjc-arc']
792 endif
793
794 # OSX check
795 if need_platform_cgl == 'yes'
796   if need_win_cocoa == 'no'
797     error('Impossible situation requested: Cannot use CGL without Cocoa support')
798   elif need_api_opengl == 'no'
799     error('Impossible situation requested: Cannot use CGL without the OpenGL library')
800   endif
801 elif need_platform_cgl == 'no' and need_win_cocoa == 'yes'
802   error('Impossible situation requested: Cannot use Cocoa without CGL support')
803 endif
804
805 if host_system == 'darwin'
806   foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
807   quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
808   corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
809
810   if need_platform_cgl != 'no'
811     if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found()
812       gl_platform_deps += [quartzcore_dep, corefoundation_dep, foundation_dep]
813       enabled_gl_platforms += 'cgl'
814       glconf.set('GST_GL_HAVE_PLATFORM_CGL', 1)
815
816       if need_win_cocoa != 'no'
817         cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : false)
818         if cocoa_dep.found()
819           gl_priv_sources += [
820             'cocoa/gstglcaopengllayer.m',
821             'cocoa/gstglcontext_cocoa.m',
822             'cocoa/gstgldisplay_cocoa.m',
823             'cocoa/gstglwindow_cocoa.m'
824           ]
825           gl_winsys_deps += cocoa_dep
826           enabled_gl_winsys += 'cocoa'
827           glconf.set('GST_GL_HAVE_WINDOW_COCOA', 1)
828         elif need_win_cocoa == 'yes'
829           error('Could not find Cocoa')
830         endif
831       endif
832     elif need_platform_cgl == 'yes'
833       error('Could not find CGL dependencies')
834     endif
835   endif
836 endif
837
838 if need_platform_eagl == 'yes'
839   if host_system != 'ios'
840     error('Can only use EAGL on iOS')
841   endif
842   if need_win_eagl == 'no'
843     error('Impossible situation requested: Cannot use EAGL platform without the EAGL window system')
844   elif need_api_gles == 'no'
845     error('Impossible situation requested: Cannot use EAGL platform without the GLES library')
846   endif
847 elif need_platform_eagl == 'no' and need_win_eagl == 'yes'
848   error('Impossible situation requested: Cannot use EAGL window system without the EAGL platform')
849 endif
850
851 if host_system == 'ios' and need_platform_eagl != 'no' and need_win_eagl != 'no'
852   foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
853   corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
854   coregraphics_dep = dependency('appleframeworks', modules : ['CoreGraphics'], required : false)
855   quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
856   uikit_dep = dependency('appleframeworks', modules : ['UIkit'], required : false)
857
858   if foundation_dep.found() and corefoundation_dep.found() and coregraphics_dep.found() and quartzcore_dep.found() and uikit_dep.found()
859     gl_platform_deps += [
860       corefoundation_dep,
861       foundation_dep,
862       coregraphics_dep,
863       quartzcore_dep,
864       uikit_dep,
865     ]
866     gl_priv_sources += [
867       'eagl/gstglcontext_eagl.m',
868       'eagl/gstglwindow_eagl.m',
869     ]
870     enabled_gl_winsys += 'eagl'
871     enabled_gl_platforms += 'eagl'
872     glconf.set('GST_GL_HAVE_WINDOW_EAGL', 1)
873     glconf.set('GST_GL_HAVE_PLATFORM_EAGL', 1)
874   elif need_platform_eagl == 'yes' or need_win_eagl == 'yes'
875     error('Could not find dependencies for EAGL')
876   endif
877 endif
878
879 # GBM Checks
880 gbm_gudev_dep = unneeded_dep
881 gbm_libdrm_dep = unneeded_dep
882 gbm_dep = unneeded_dep
883 if need_win_gbm != 'no'
884   if need_win_gbm == 'yes'
885     if need_platform_egl == 'no'
886       error('Impossible situation requested: Cannot use GBM without EGL support')
887     endif
888   endif
889
890   gbm_gudev_dep = dependency('gudev-1.0', version : '>=147', required : false)
891   gbm_libdrm_dep = dependency('libdrm', version : '>= 2.4.55', required : false)
892   gbm_dep = dependency('gbm', required : false)
893   if egl_dep.found() and gbm_gudev_dep.found() and gbm_libdrm_dep.found() and gbm_dep.found()
894     gl_priv_sources += [
895       'gbm/gstgldisplay_gbm.c',
896       'gbm/gstgl_gbm_utils.c',
897       'gbm/gstglwindow_gbm_egl.c',
898     ]
899     enabled_gl_winsys += 'gbm'
900     gl_winsys_deps += [gbm_gudev_dep, gbm_libdrm_dep, gbm_dep]
901     glconf.set('GST_GL_HAVE_WINDOW_GBM', 1)
902   else
903     if need_win_gbm == 'yes'
904       error ('Could not find requested GBM libraries')
905     endif
906     gbm_gudev_dep = unneeded_dep
907     gbm_libdrm_dep = unneeded_dep
908     gbm_dep = unneeded_dep
909   endif
910 endif
911
912 if need_platform_egl != 'no' and need_win_viv_fb != 'no'
913   if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep)
914     if cc.has_function ('glTexDirectVIV', dependencies : gles2_dep)
915       enabled_gl_winsys += 'viv-fb'
916       glconf.set('GST_GL_HAVE_WINDOW_VIV_FB', 1)
917       glconf.set('GST_GL_HAVE_VIV_DIRECTVIV', 1)
918       gl_priv_sources += [
919         'viv-fb/gstgldisplay_viv_fb.c',
920         'viv-fb/gstglwindow_viv_fb_egl.c',
921       ]
922       gl_cpp_args += ['-DEGL_API_FB']
923     endif
924   endif
925 endif
926
927 if need_win_android == 'yes'
928   if need_platform_egl == 'no'
929     error('Impossible situation requested: Cannot build for Android without EGL')
930   elif need_api_gles2 == 'no'
931     error('Impossible situation requested: Cannot build for Android without GLES2 support')
932   elif host_system != 'android'
933     error('Impossible situation requested: Cannot build for Android without an android system')
934   endif
935 endif
936
937 if host_system == 'android' and need_win_android != 'no' and need_platform_egl != 'no'
938   if gles2_dep.found() and egl_dep.found()
939     enabled_gl_winsys += ['android']
940     glconf.set('GST_GL_HAVE_WINDOW_ANDROID', 1)
941     gl_priv_sources += [
942       'android/gstglwindow_android_egl.c'
943     ]
944   endif
945 endif
946
947 gl_nvmm = false
948 nvbuf_utils_dep = unneeded_dep
949 if egl_dep.found()
950   # XXX: provide options for this?
951   # c_args and c_link_args can also cover this case just fine e.g.:
952   # -Dc_args='-I/usr/src/jetson_multimedia_api/include' -Dc_link_args='-L/usr/lib/aarch64-linux-gnu/tegra/'
953   nvbuf_utils_dep = cc.find_library('nvbuf_utils', required : false)
954   nvbuf_utils_h = cc.has_header('nvbuf_utils.h')
955   if nvbuf_utils_dep.found() and nvbuf_utils_h
956     gl_misc_deps += [nvbuf_utils_dep]
957     gl_nvmm = true
958     gl_cpp_args += ['-DHAVE_NVMM']
959   endif
960 endif
961
962 build_gstgl = true
963 if enabled_gl_apis.length() == 0
964   message('No OpenGL API libraries found or requested')
965   build_gstgl = false
966 endif
967 if enabled_gl_platforms.length() == 0
968   message('No OpenGL Platforms found or requested')
969   build_gstgl = false
970 endif
971 if enabled_gl_winsys.length() == 0
972   message('No OpenGL Window systems found or requested')
973   build_gstgl = false
974 endif
975
976 if build_gstgl
977   # find some types that may or may not be defined
978   if cc.has_type('GLeglImageOES', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
979     glconf.set('GST_GL_HAVE_GLEGLIMAGEOES', 1)
980   endif
981   if cc.has_type('GLchar', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
982     glconf.set('GST_GL_HAVE_GLCHAR', 1)
983   endif
984   if cc.has_type('GLsizeiptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
985     glconf.set('GST_GL_HAVE_GLSIZEIPTR', 1)
986   endif
987   if cc.has_type('GLintptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
988     glconf.set('GST_GL_HAVE_GLINTPTR', 1)
989   endif
990   if cc.has_type('GLsync', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
991     glconf.set('GST_GL_HAVE_GLSYNC', 1)
992   endif
993   if cc.has_type('GLuint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
994     glconf.set('GST_GL_HAVE_GLUINT64', 1)
995   endif
996   if cc.has_type('GLint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
997     glconf.set('GST_GL_HAVE_GLINT64', 1)
998   endif
999   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)
1000     glconf.set('GST_GL_HAVE_EGLATTRIB', 1)
1001   endif
1002   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)
1003     glconf.set('GST_GL_HAVE_EGLUINT64KHR', 1)
1004   endif
1005
1006   summary('GL api', enabled_gl_apis, list_sep: ', ')
1007   summary('GL platform', enabled_gl_platforms, list_sep: ', ')
1008   summary('GL winsys', enabled_gl_winsys, list_sep: ', ')
1009
1010   install_headers(gl_headers, subdir : 'gstreamer-1.0/gst/gl')
1011   install_headers(gl_prototype_headers, subdir : 'gstreamer-1.0/gst/gl/glprototypes')
1012
1013   configure_file(input : 'gstglconfig.h.meson',
1014     output : 'gstglconfig.h',
1015     install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/gl',
1016     install_tag : 'devel',
1017     configuration : glconf)
1018
1019   glib_mkenums = find_program('glib-mkenums')
1020   mkenums = find_program('gl_mkenum.py')
1021   gl_enumtypes_h = custom_target('gstglenumtypes_h',
1022     output : 'gl-enumtypes.h',
1023     input : gir_gl_headers,
1024     install : true,
1025     install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/gl/'),
1026     command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
1027
1028   gl_enumtypes_c = custom_target('gstglenumtypes_c',
1029     output : 'gl-enumtypes.c',
1030     input : gir_gl_headers,
1031     depends : [gl_enumtypes_h],
1032     command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
1033   gen_sources = [gl_enumtypes_h]
1034
1035   common_args = gst_plugins_base_args + gl_cpp_args + ['-DBUILDING_GST_GL', '-DG_LOG_DOMAIN="GStreamer-GL"']
1036
1037   # We have custom_target() that generate headers in the current build dir,
1038   # but with implicit_include_directories: false, meson >= 0.58.0 won't include
1039   # it by default. We cannot use include_directories('.') here because it would
1040   # also include current source dir which is what we want to avoid because
1041   # case-insensitive FS would include gst-libs/gl/egl/egl.h as EGL/egl.h.
1042   common_args += '-I@0@'.format(meson.current_build_dir())
1043
1044   gstgl = library('gstgl-' + api_version,
1045     gl_sources, gl_egl_sources, gl_x11_sources, gl_wayland_sources, gl_priv_sources, gl_enumtypes_c, gl_enumtypes_h,
1046     c_args : common_args,
1047     cpp_args : common_args,
1048     objc_args : common_args + gl_objc_args,
1049     include_directories : [configinc, libsinc, gl_includes],
1050     version : libversion,
1051     soversion : soversion,
1052     darwin_versions : osxversion,
1053     install : true,
1054     dependencies : [gst_base_dep, video_dep, allocators_dep, gmodule_dep,
1055                     gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps],
1056     # don't confuse EGL/egl.h with gst-libs/gl/egl/egl.h on case-insensitive file systems
1057     implicit_include_directories : false)
1058
1059   pkgconfig_gl_variables = [
1060     'gl_platforms=' + ' '.join(enabled_gl_platforms),
1061     'gl_winsys=' + ' '.join(enabled_gl_winsys),
1062     'gl_apis=' + ' '.join(enabled_gl_apis),
1063   ]
1064
1065   library_def = {'lib': gstgl}
1066   pkg_name = 'gstreamer-gl-1.0'
1067   pkgconfig.generate(gstgl,
1068     libraries : [gstvideo, gst_base_dep, gst_dep],
1069     variables : pkgconfig_variables + pkgconfig_gl_variables,
1070     uninstalled_variables : pkgconfig_gl_variables,
1071     subdirs : pkgconfig_subdirs,
1072     extra_cflags : ['-I${libdir}/gstreamer-1.0/include'],
1073     name : pkg_name,
1074     description : 'Streaming media framework, OpenGL plugins libraries',
1075   )
1076
1077   # Desperate times, desperate measures... fix up escaping of our variables
1078   run_command(meson_pkg_config_file_fixup_script,
1079     'gstreamer-gl-1.0', 'gl_platforms', 'gl_winsys', 'gl_apis',
1080     check: true)
1081
1082   pkgconfig.generate(
1083     libraries : [gstgl, gl_lib_deps],
1084     subdirs : pkgconfig_subdirs,
1085     name : 'gstreamer-gl-prototypes-1.0',
1086     description : 'Streaming media framework, OpenGL plugins libraries (OpenGL Prototypes)',
1087   )
1088
1089   if build_gir
1090     gir = {
1091         'sources' : gl_sources + [gl_enumtypes_h] + [gl_enumtypes_c] + gir_gl_headers,
1092         'namespace' : 'GstGL',
1093         'nsversion' : api_version,
1094         'identifier_prefix' : 'Gst',
1095         'symbol_prefix' : 'gst',
1096         'export_packages' : pkg_name,
1097         'includes' : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
1098         'install' : true,
1099         'extra_args' : gir_init_section + ['--c-include=gst/gl/gl.h'],
1100         'dependencies' : [video_dep, gst_dep, gst_base_dep],
1101     }
1102     library_def += {'gir': [gir]}
1103     if not static_build
1104       gl_gir = gnome.generate_gir(gstgl, kwargs: gir)
1105       gen_sources += [gl_gir]
1106     endif
1107   endif
1108   gst_libraries += [[pkg_name, library_def]]
1109   gstgl_dep = declare_dependency(link_with : gstgl,
1110     include_directories : [libsinc, compat_includes],
1111     sources: gen_sources,
1112     dependencies : [video_dep, gst_base_dep])
1113   gstglproto_dep = declare_dependency(
1114     dependencies : [gstgl_dep] + gl_lib_deps,
1115     sources: gen_sources
1116   )
1117   meson.override_dependency('gstreamer-gl-1.0', gstgl_dep)
1118   meson.override_dependency('gstreamer-gl-prototypes-1.0', gstglproto_dep)
1119
1120   if gl_x11_headers.length() > 0
1121     install_headers(gl_x11_headers, subdir : 'gstreamer-1.0/gst/gl/x11')
1122     pkg_name = 'gstreamer-gl-x11-1.0'
1123     pkgconfig.generate(
1124       libraries : [gstgl],
1125       requires: ['x11-xcb'],
1126       subdirs : pkgconfig_subdirs,
1127       name : pkg_name,
1128       description : 'Streaming media framework, OpenGL plugins libraries (X11 specifics)',
1129     )
1130     gl_x11_gir = []
1131     if build_gir
1132       gir = {
1133         'sources' : gl_x11_sources + gl_x11_headers,
1134         'namespace' : 'GstGLX11',
1135         'nsversion' : api_version,
1136         'identifier_prefix' : 'Gst',
1137         'symbol_prefix' : 'gst',
1138         'export_packages' : 'gstreamer-gl-x11-1.0',
1139         'includes' : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
1140         'install' : true,
1141         'extra_args' : gir_init_section + ['--c-include=gst/gl/x11/x11.h'],
1142         'dependencies' : [video_dep, gst_dep, gst_base_dep]
1143       }
1144       gir_dict = gir + {'includes': gir['includes'] + ['GstGL-1.0']}
1145       gst_libraries += [[pkg_name, {'gir': gir_dict}]]
1146       if not static_build
1147         gir += {'includes': gir['includes'] + [gl_gir[0]]}
1148         gl_x11_gir = gnome.generate_gir(gstgl, kwargs: gir)
1149       endif
1150     endif
1151     gstglx11_dep = declare_dependency(dependencies : [gstgl_dep, x11_dep, xcb_dep],
1152       sources : gl_x11_gir)
1153     meson.override_dependency('gstreamer-gl-x11-1.0', gstglx11_dep)
1154   endif
1155
1156   if gl_wayland_headers.length() > 0
1157     install_headers(gl_wayland_headers, subdir : 'gstreamer-1.0/gst/gl/wayland')
1158     pkg_name = 'gstreamer-gl-wayland-1.0'
1159     pkgconfig.generate(
1160       libraries : [gstgl],
1161       requires: ['wayland-egl', 'wayland-client'],
1162       subdirs : pkgconfig_subdirs,
1163       name : pkg_name,
1164       description : 'Streaming media framework, OpenGL plugins libraries (Wayland specifics)',
1165     )
1166     gl_wayland_gir = []
1167     if build_gir
1168       gir = {
1169         'sources' : gl_wayland_sources + gl_wayland_headers,
1170         'namespace' : 'GstGLWayland',
1171         'nsversion' : api_version,
1172         'identifier_prefix' : 'Gst',
1173         'symbol_prefix' : 'gst',
1174         'export_packages' : 'gstreamer-gl-wayland-1.0',
1175         'includes' : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
1176         'install' : true,
1177         'extra_args' : gir_init_section + ['--c-include=gst/gl/wayland/wayland.h'],
1178         'dependencies' : [video_dep, gst_dep, gst_base_dep]
1179       }
1180
1181       gir_dict = gir + {'includes': gir['includes'] + ['GstGL-1.0']}
1182       gst_libraries += [[pkg_name, {'gir': gir_dict}]]
1183       if not static_build
1184         gir += {'includes': gir['includes'] + [gl_gir[0]]}
1185         gl_wayland_gir = gnome.generate_gir(gstgl, kwargs: gir)
1186       endif
1187     endif
1188     gstglwayland_dep = declare_dependency(dependencies : [gstgl_dep],
1189       sources : gl_wayland_gir)
1190     meson.override_dependency(pkg_name, gstglwayland_dep)
1191   endif
1192
1193   if gl_egl_headers.length() > 0
1194     install_headers(gl_egl_headers, subdir : 'gstreamer-1.0/gst/gl/egl')
1195     pkg_name = 'gstreamer-gl-egl-1.0'
1196     pkgconfig.generate(
1197       libraries : [gstgl, egl_dep],
1198       subdirs : pkgconfig_subdirs,
1199       name : pkg_name,
1200       description : 'Streaming media framework, OpenGL plugins libraries (EGL specifics)',
1201     )
1202     gl_egl_gir = []
1203     if build_gir
1204       gir = {
1205         'sources' : gl_egl_sources + gl_egl_headers,
1206         'namespace' : 'GstGLEGL',
1207         'nsversion' : api_version,
1208         'identifier_prefix' : 'Gst',
1209         'symbol_prefix' : 'gst',
1210         'export_packages' : pkg_name,
1211         'includes' : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
1212         'install' : true,
1213         'extra_args' : gir_init_section + ['--c-include=gst/gl/egl/egl.h'],
1214         'dependencies' : [video_dep, gst_dep, gst_base_dep]
1215       }
1216       gir_dict = gir + {'includes': gir['includes'] + ['GstGL-1.0']}
1217       gst_libraries += [[pkg_name, {'gir': gir_dict}]]
1218       if not static_build
1219         gir += {'includes': gir['includes'] + [gl_gir[0]]}
1220         gl_egl_gir = gnome.generate_gir(gstgl, kwargs: gir)
1221       endif
1222     endif
1223     gstglegl_dep = declare_dependency(dependencies : [gstgl_dep],
1224       sources : gl_egl_gir)
1225     meson.override_dependency(pkg_name, gstglegl_dep)
1226   endif
1227
1228 elif get_option('gl').enabled()
1229   error('GStreamer OpenGL integration required via options, but needed dependencies not found.')
1230 endif