meson: fix check whether both gles2 and opengl headers can be included
[platform/upstream/gstreamer.git] / gst-libs / gst / gl / meson.build
1 gl_sources = [
2   'gstglapi.c',
3   'gstglbasefilter.c',
4   'gstglbasememory.c',
5   'gstglcolorconvert.c',
6   'gstglbuffer.c',
7   'gstglbufferpool.c',
8   'gstglcontext.c',
9   'gstgldebug.c',
10   'gstgldisplay.c',
11   'gstglfeature.c',
12   'gstglfilter.c',
13   'gstglformat.c',
14   'gstglframebuffer.c',
15   'gstglmemory.c',
16   'gstglmemorypbo.c',
17   'gstgloverlaycompositor.c',
18   'gstglquery.c',
19   'gstglrenderbuffer.c',
20   'gstglshader.c',
21   'gstglshaderstrings.c',
22   'gstglsl.c',
23   'gstglslstage.c',
24   'gstglsyncmeta.c',
25   'gstglupload.c',
26   'gstglutils.c',
27   'gstglviewconvert.c',
28   'gstglwindow.c',
29 ]
30
31 gl_headers = [
32   'gl.h',
33   'gstgl_enums.h',
34   'gstgl_fwd.h',
35   'gstglapi.h',
36   'gstglbasefilter.h',
37   'gstglbasememory.h',
38   'gstglbuffer.h',
39   'gstglbufferpool.h',
40   'gstglcolorconvert.h',
41   'gstglcontext.h',
42   'gstgldebug.h',
43   'gstgldisplay.h',
44   'gstglfeature.h',
45   'gstglfilter.h',
46   'gstglformat.h',
47   'gstglfuncs.h',
48   'gstglframebuffer.h',
49   'gstglmemory.h',
50   'gstglmemorypbo.h',
51   'gstgloverlaycompositor.h',
52   'gstglquery.h',
53   'gstglrenderbuffer.h',
54   'gstglshader.h',
55   'gstglshaderstrings.h',
56   'gstglsl.h',
57   'gstglslstage.h',
58   'gstglsyncmeta.h',
59   'gstglupload.h',
60   'gstglutils.h',
61   'gstglviewconvert.h',
62   'gstglwindow.h',
63 ]
64
65 gl_prototype_headers = [
66   'glprototypes/all_functions.h',
67   'glprototypes/base.h',
68   'glprototypes/blending.h',
69   'glprototypes/buffers.h',
70   'glprototypes/debug.h',
71   'glprototypes/eglimage.h',
72   'glprototypes/fbo.h',
73   'glprototypes/fixedfunction.h',
74   'glprototypes/gles.h',
75   'glprototypes/gstgl_compat.h',
76   'glprototypes/gstgl_gles2compat.h',
77   'glprototypes/Makefile.am',
78   'glprototypes/opengl.h',
79   'glprototypes/query.h',
80   'glprototypes/README',
81   'glprototypes/shaders.h',
82   'glprototypes/sync.h',
83   'glprototypes/vao.h',
84 ]
85
86 gl_x11_headers = []
87 gl_wayland_headers = []
88 gl_win32_headers = []
89 gl_cocoa_headers = []
90 gl_egl_headers = []
91
92 glconf = configuration_data()
93 glconf_options = [
94     'GST_GL_HAVE_OPENGL',
95     'GST_GL_HAVE_GLES2',
96     'GST_GL_HAVE_GLES3',
97     'GST_GL_HAVE_GLES3EXT3_H',
98
99     'GST_GL_HAVE_WINDOW_X11',
100     'GST_GL_HAVE_WINDOW_COCOA',
101     'GST_GL_HAVE_WINDOW_WIN32',
102     'GST_GL_HAVE_WINDOW_WAYLAND',
103     'GST_GL_HAVE_WINDOW_ANDROID',
104     'GST_GL_HAVE_WINDOW_DISPMANX',
105     'GST_GL_HAVE_WINDOW_EAGL',
106     'GST_GL_HAVE_WINDOW_VIV_FB',
107
108     'GST_GL_HAVE_PLATFORM_EGL',
109     'GST_GL_HAVE_PLATFORM_GLX',
110     'GST_GL_HAVE_PLATFORM_WGL',
111     'GST_GL_HAVE_PLATFORM_CGL',
112     'GST_GL_HAVE_PLATFORM_EAGL',
113
114     'GST_GL_HAVE_DMABUF',
115     'GST_GL_HAVE_VIV_DIRECTVIV',
116
117     'GST_GL_HAVE_GLEGLIMAGEOES',
118     'GST_GL_HAVE_GLCHAR',
119     'GST_GL_HAVE_GLSIZEIPTR',
120     'GST_GL_HAVE_GLINTPTR',
121     'GST_GL_HAVE_GLSYNC',
122     'GST_GL_HAVE_GLUINT64',
123     'GST_GL_HAVE_GLINT64',
124     'GST_GL_HAVE_EGLATTRIB',
125 ]
126
127 foreach option : glconf_options
128   glconf.set10(option, false)
129 endforeach
130
131 gmodule_dep = dependency('gmodule-no-export-2.0',
132   fallback: ['glib', 'libgmodule_dep'])
133 unneeded_dep = dependency('', required : false)
134 if unneeded_dep.found()
135   error ('Found unfindable dependency')
136 endif
137
138 # OpenGL/GLES2 libraries
139 gl_lib_deps = []
140 # GL platform - EGL, GLX, CGL, WGL, etc
141 gl_platform_deps = []
142 # GL winsys - wayland, X11, Cocoa, win32, etc
143 gl_winsys_deps = []
144 # other things we need.
145 gl_misc_deps = []
146 # Other preprocessor arguments
147 gl_cpp_args = ['-DGST_EXPORTS']
148
149 enabled_gl_apis = []
150 enabled_gl_platforms = []
151 enabled_gl_winsys = []
152
153 # parse provided options
154 libegl_module_name = get_option('with_egl_module_name')
155 if libegl_module_name != ''
156   gl_cpp_args += ['-DGST_GL_LIBEGL_MODULE_NAME="@0@"'.format(libegl_module_name)]
157 endif
158 libgles2_module_name = get_option('with_gles2_module_name')
159 if libgles2_module_name != ''
160   gl_cpp_args += ['-DGST_GL_LIBGLESV2_MODULE_NAME="@0@"'.format(libgles2_module_name)]
161 endif
162 libgl_module_name = get_option('with_opengl_module_name')
163 if libgl_module_name != ''
164   gl_cpp_args += ['-DGST_GL_LIBGL_MODULE_NAME="@0@"'.format(libgl_module_name)]
165 endif
166
167 gl_apis_s = get_option ('with_gl_api')
168 if gl_apis_s == 'auto'
169   need_api_opengl = 'auto'
170   need_api_gles2 = 'auto'
171 else
172   need_api_opengl = 'no'
173   need_api_gles2 = 'no'
174   gl_apis = gl_apis_s.split(',')
175   foreach api : gl_apis
176     if api == 'opengl'
177       need_api_opengl = 'yes'
178     elif api == 'gles2'
179       need_api_gles2 = 'yes'
180     else
181       error('Unsupported GL api provided ' + api)
182     endif
183   endforeach
184 endif
185
186 gl_platforms_s = get_option ('with_gl_platform')
187 if gl_platforms_s == 'auto'
188   need_platform_egl = 'auto'
189   need_platform_glx = 'auto'
190   need_platform_cgl = 'auto'
191   need_platform_wgl = 'auto'
192   need_platform_eagl = 'auto'
193 else
194   need_platform_egl = 'no'
195   need_platform_glx = 'no'
196   need_platform_cgl = 'no'
197   need_platform_wgl = 'no'
198   need_platform_eagl = 'no'
199   gl_platforms = gl_platforms_s.split(',')
200   foreach platform : gl_platforms
201     if platform == 'egl'
202       need_platform_egl = 'yes'
203     elif platform == 'glx'
204       need_platform_glx = 'yes'
205 #    elif platform == 'cgl'
206 #      need_platform_cgl = 'yes'
207     elif platform == 'wgl'
208       need_platform_wgl = 'yes'
209 #    elif platform == 'eagl'
210 #      need_platform_eagl = 'yes'
211     else
212       error('Unsupported GL platform provided ' + platform)
213     endif
214   endforeach
215 endif
216
217 gl_winsys_s = get_option ('with_gl_winsys')
218 if gl_winsys_s == 'auto'
219   need_win_x11 = 'auto'
220   need_win_wayland = 'auto'
221   need_win_win32 = 'auto'
222   need_win_cocoa = 'auto'
223   need_win_eagl = 'auto'
224   need_win_dispmanx = 'auto'
225   need_win_viv_fb = 'auto'
226 else
227   need_win_x11 = 'no'
228   need_win_wayland = 'no'
229   need_win_win32 = 'no'
230   need_win_cocoa = 'no'
231   need_win_eagl = 'no'
232   need_win_dispmanx = 'no'
233   need_win_viv_fb = 'no'
234   gl_winsys = gl_winsys_s.split(',')
235   foreach winsys : gl_winsys
236     if winsys == 'x11'
237       need_win_x11 = 'yes'
238     elif winsys == 'wayland'
239       need_win_wayland = 'yes'
240     elif winsys == 'win32'
241       need_win_win32 = 'yes'
242 #    elif winsys == 'cocoa'
243 #      need_win_cocoa = 'yes'
244 #    elif winsys == 'eagl'
245 #      need_win_eagl = 'yes'
246     elif winsys == 'dispmanx'
247       need_win_dispmanx = 'yes'
248     elif winsys == 'viv-fb'
249       need_win_viv_fb = 'yes'
250     else
251       error('Unsupported GL winsys provided ' + winsys)
252     endif
253   endforeach
254 endif
255
256 gl_include_header = '''
257 #ifdef __GNUC__
258 #  pragma GCC diagnostic push
259 #  pragma GCC diagnostic ignored "-Wredundant-decls"
260 #endif
261 #ifndef GL_GLEXT_PROTOTYPES
262 #define GL_GLEXT_PROTOTYPES 1
263 #endif
264 '''
265
266 # Desktop OpenGL checks
267 gl_dep = unneeded_dep
268 glx_dep = unneeded_dep
269 if need_api_opengl != 'no' or need_platform_glx != 'no'
270   gl_dep = dependency('gl', required : false)
271   if not gl_dep.found()
272     if host_machine.system() == 'windows'
273       gl_dep = cc.find_library('opengl32', required : false)
274 #    elif host_machine.system() == 'darwin'
275 #      gl_dep = cc.find_library('OpenGL', required : false)
276     else
277       gl_dep = cc.find_library('GL', required : false)
278     endif
279
280     if not cc.has_header('GL/gl.h', required : false)
281       gl_dep = unneeded_dep
282     endif
283
284     if not gl_dep.found() and need_api_opengl == 'yes'
285       error ('Could not find requested OpenGL library')
286     endif
287   endif
288
289   glx_dep = gl_dep
290   if need_api_opengl == 'no'
291     gl_dep = unneeded_dep
292   endif
293   if need_platform_glx == 'no'
294     glx_dep = unneeded_dep
295   endif
296
297   opengl_includes = '''
298 #ifdef __APPLE__
299 # include <OpenGL/OpenGL.h>
300 # include <OpenGL/gl.h>
301 # if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
302 #  define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
303 #  include <OpenGL/gl3.h>
304 # endif
305 #else
306 # if _MSC_VER
307 #  include <windows.h>
308 # endif
309 # include <GL/gl.h>
310 # if __WIN32__ || _WIN32
311 #  include <GL/glext.h>
312 # endif
313 #endif
314 '''
315 endif
316
317 # GLES2 checks
318 gles2_dep = unneeded_dep
319 gles3_h = false
320 gles3ext3_h = false
321 if need_api_gles2 != 'no'
322   gles2_dep = dependency('glesv2', required : false)
323   if not gles2_dep.found()
324 #    if host_machine.system() == 'windows'
325 #    elif host_machine.system() == 'darwin'
326 #      gles2_dep = cc.find_library('GLESv2', required : false)
327 #    else
328       gles2_dep = cc.find_library('GLESv2', required : false)
329 #    endif
330
331      if not cc.has_header('GLES2/gl2.h', required : false)
332        gles2_dep = unneeded_dep
333      endif
334
335     if not gles2_dep.found() and need_api_gles2 == 'yes'
336       error ('Could not find requested OpenGL ES library')
337     endif
338   endif
339
340   gles3_h = gles2_dep.found() and cc.has_header('GLES3/gl3.h', required : false, dependencies : gles2_dep)
341
342   gles_includes = '''
343 #ifdef HAVE_IOS /* FIXME */
344 # include <OpenGLES/ES2/gl.h>
345 # include <OpenGLES/ES2/glext.h>
346 #else'''
347   if gles3_h
348     gles3ext3_h = gles3_h and cc.has_header('GLES3/gl3ext.h', required : false, dependencies : gles2_dep)
349     gles_includes += '''
350 # include <GLES3/gl3.h>
351 # include <GLES2/gl2ext.h>'''
352     if gles3ext3_h
353       gles_includes += '''
354 # include <GLES3/gl3ext.h>'''
355     endif
356   else
357     gles_includes += '''
358 # include <GLES2/gl2.h>
359 # include <GLES2/gl2ext.h>'''
360   endif
361   gles_includes += '''
362 #endif
363 '''
364 endif
365
366 # can we include both gles2 and opengl headers?
367 if gles2_dep.found() and gl_dep.found()
368   gl_include_block = gl_include_header + gles_includes + opengl_includes
369   # TODO: Revert to passing gl_include_block via prefix: once
370   # https://github.com/mesonbuild/meson/issues/2364 is fixed
371   if not cc.compiles(gl_include_block + '\n' + 'void f (void) {}',dependencies : [gles2_dep, gl_dep])
372     message ('Cannot include both OpenGL and OpenGL ES headers')
373     if need_gles2 != 'yes'
374       gles2_dep = unneeded_dep
375     elif need_opengl != 'yes'
376       gl_dep = unneeded_dep
377     else
378       error('Both OpenGL and OpenGL ES were requested but cannot be included together')
379     endif
380   endif
381 endif
382 gl_include_block = gl_include_header
383 if gles2_dep.found()
384   gl_include_block += gles_includes
385 endif
386 if gl_dep.found()
387   gl_include_block += opengl_includes
388 endif
389
390 if gles2_dep.found()
391   gl_lib_deps += gles2_dep
392   glconf.set10('GST_GL_HAVE_GLES2', 1)
393   if gles3_h
394     glconf.set10('GST_GL_HAVE_GLES3', 1)
395     if gles3ext3_h
396       glconf.set10('GST_GL_HAVE_GLES3EXT3_H', 1)
397     endif
398   endif
399   enabled_gl_apis += 'gles2'
400 endif
401
402 if gl_dep.found()
403   gl_lib_deps += gl_dep
404   glconf.set10('GST_GL_HAVE_OPENGL', 1)
405   enabled_gl_apis += 'opengl'
406 endif
407
408 # EGL checks
409 egl_dep = unneeded_dep
410 if need_platform_egl != 'no'
411   egl_dep = dependency('egl', required : false)
412   if not egl_dep.found()
413     egl_dep = cc.find_library('EGL', required : false)
414
415     if not egl_dep.found() and need_platform_egl == 'yes'
416       error ('Could not find requested EGL library')
417     endif
418   endif
419
420   if egl_dep.found()
421     gl_sources += [
422       'egl/gstegl.c',
423       'egl/gsteglimage.c',
424       'egl/gstglcontext_egl.c',
425       'egl/gstgldisplay_egl.c',
426       'egl/gstglmemoryegl.c',
427     ]
428     gl_egl_headers += [
429       'egl/gstegl.h',
430       'egl/gsteglimage.h',
431       'egl/gstgldisplay_egl.h',
432       'egl/gstglmemoryegl.h',
433     ]
434     gl_platform_deps += egl_dep
435     glconf.set10('GST_GL_HAVE_PLATFORM_EGL', 1)
436
437     if cc.has_header('libdrm/drm_fourcc.h', required : false)
438       gl_misc_deps += allocators_dep
439       glconf.set10('GST_GL_HAVE_DMABUF', 1)
440     endif
441
442     egl_includes = '''
443 #include <EGL/egl.h>
444 #include <EGL/eglext.h>
445 '''
446     enabled_gl_platforms += 'egl'
447   endif
448
449 endif
450
451 # wayland checks
452 wayland_client_dep = unneeded_dep
453 wayland_cursor_dep = unneeded_dep
454 wayland_egl_dep = unneeded_dep
455 if need_win_wayland != 'no'
456   if need_win_wayland == 'yes'
457     if need_platform_egl == 'no'
458       error('Impossible situation requested: Cannot use Wayland without EGL support')
459     endif
460   endif
461   if not egl_dep.found()
462     if need_win_wayland == 'yes'
463       error ('Could not find EGL libraries for wayland')
464     else
465       message ('Could not find EGL libraries for wayland')
466     endif
467   else
468     wayland_client_dep = dependency('wayland-client', version : '>= 1.0', required : false)
469     wayland_cursor_dep = dependency('wayland-cursor', version : '>= 1.0', required : false)
470     wayland_egl_dep = dependency('wayland-egl', version : '>= 1.0', required : false)
471
472     if wayland_client_dep.found() and wayland_cursor_dep.found() and wayland_egl_dep.found()
473       gl_sources += [
474         'wayland/gstgldisplay_wayland.c',
475         'wayland/gstglwindow_wayland_egl.c',
476         'wayland/wayland_event_source.c',
477       ]
478       gl_wayland_headers += [
479         'wayland/gstgldisplay_wayland.h'
480       ]
481       glconf.set('GST_GL_HAVE_WINDOW_WAYLAND', 1)
482       gl_winsys_deps += [wayland_client_dep, wayland_cursor_dep, wayland_egl_dep]
483       enabled_gl_winsys += 'wayland'
484     else
485       if need_win_wayland == 'yes'
486         error ('Could not find requested Wayland libraries')
487       endif
488       wayland_client_dep = unneeded_dep
489       wayland_cursor_dep = unneeded_dep
490       wayland_egl_dep = unneeded_dep
491     endif
492   endif
493 endif
494
495 # X11 checks
496 if need_platform_glx == 'yes'
497   if need_win_x11 == 'no'
498     error('Impossible situation requested: Cannot use GLX without X11 support')
499   elif need_api_opengl == 'no'
500     error('Impossible situation requested: Cannot use GLX without the OpenGL library')
501   endif
502 endif
503
504 if need_win_x11 != 'no'
505   xcb_dep = dependency('x11-xcb', required : false)
506   if x11_dep.found() and xcb_dep.found()
507     gl_sources += [
508       'x11/gstgldisplay_x11.c',
509       'x11/gstglwindow_x11.c',
510       'x11/xcb_event_source.c',
511     ]
512     gl_x11_headers += [
513       'x11/gstgldisplay_x11.h',
514     ]
515     glconf.set('GST_GL_HAVE_WINDOW_X11', 1)
516     gl_winsys_deps += [x11_dep, xcb_dep]
517     enabled_gl_winsys += 'x11'
518
519     if need_platform_glx != 'no' and glx_dep.found()
520       glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
521       gl_sources += [
522         'x11/gstglcontext_glx.c',
523       ]
524       # GLX is in the opengl library on linux
525       gl_platform_deps += glx_dep
526       enabled_gl_platforms += 'glx'
527     endif
528   elif need_win_x11 == 'yes'
529     error ('Could not find requested X11 libraries')
530   endif
531 endif
532
533 bcm_host_dep = unneeded_dep
534 if need_win_dispmanx != 'no'
535
536   # Try pkg-config for bcm_host then fallback to find_library to also
537   # support older distribution
538   bcm_host_dep = dependency('bcm_host', required : false)
539   if not bcm_host_dep.found()
540     bcm_host_dep = cc.find_library('bcm_host', required : false)
541   endif
542
543   if bcm_host_dep.found()
544     if not egl_dep.found()
545       error('dispmanx requires the use of egl')
546     endif
547
548     gl_sources += [
549       'dispmanx/gstglwindow_dispmanx_egl.c'
550     ]
551
552     glconf.set('GST_GL_HAVE_WINDOW_DISPMANX', 1)
553     gl_winsys_deps += bcm_host_dep
554     enabled_gl_winsys += 'dispmanx'
555     gl_cpp_args += ['-DUSE_EGL_RPI']
556   elif need_win_dispmanx == 'yes'
557     error('Could not find dispmanx libraries')
558   endif
559 endif
560
561 # win32 checks
562 if need_platform_wgl == 'yes'
563   if need_win_win32 == 'no'
564     error('Impossible situation requested: Cannot use WGL without the win32 window system')
565   endif
566 endif
567
568 # XXX: untested
569 if need_platform_wgl != 'no' and need_win_win32 != 'no'
570   gdi_dep = cc.find_library('gdi32', required : false)
571   # FIXME: Revert back to has_header once it gains prefix support
572   wglext_h = cc.has_header_symbol('GL/wglext.h', 'WGL_WGLEXT_VERSION',
573                                   prefix : '#include <windows.h>
574                                             #include <GL/gl.h>')
575
576   if wglext_h and gdi_dep.found() and gl_dep.found()
577     gl_platform_deps += gdi_dep
578     gl_sources += [
579       'win32/win32_message_source.c',
580       'win32/gstglwindow_win32.c',
581       'win32/gstglwindow_win32.c',
582     ]
583     enabled_gl_winsys += 'win32'
584     gl_winsys_deps += gdi_dep
585     enabled_gl_platforms += 'wgl'
586   endif
587 endif
588
589 if host_machine.system() == 'darwin'
590   # FIXME: how to know if we're on iOS or OS X?
591 #  gl_cocoa_headers += [
592 #    'gstglcontext_cocoa.h',
593 #    'gstglcaopengllayer.h',
594 #  ]
595 endif
596
597 if need_platform_egl != 'no' and need_win_viv_fb != 'no'
598   if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep)
599     if cc.has_function ('glTexDirectVIV', dependencies : gles2_dep)
600       enabled_gl_winsys += 'viv-fb'
601       glconf.set10('GST_GL_HAVE_WINDOW_VIV_FB', 1)
602       glconf.set10('GST_GL_HAVE_VIV_DIRECTVIV', 1)
603       gl_sources += [
604         'viv-fb/gstgldisplay_viv_fb.c',
605         'viv-fb/gstglwindow_viv_fb_egl.c',
606       ]
607       gl_cpp_args += ['-DEGL_API_FB']
608     endif
609   endif
610 endif
611
612 # TODO: Add rest of gl config here.
613 # iOS, OS X, win32 specific support
614
615 build_gstgl = true
616 if enabled_gl_apis.length() == 0
617   message('No OpenGL API libraries found or requested')
618   build_gstgl = false
619 endif
620 if enabled_gl_platforms.length() == 0
621   message('No OpenGL Platforms found or requested')
622   build_gstgl = false
623 endif
624 if enabled_gl_winsys.length() == 0
625   message('No OpenGL Window systems found or requested')
626   build_gstgl = false
627 endif
628
629 if build_gstgl
630   # find some types that may or may not be defined
631   if cc.has_type('GLeglImageOES', prefix : gl_include_block, dependencies : gl_lib_deps)
632     glconf.set('GST_GL_HAVE_GLEGLIMAGEOES', 1)
633   endif
634   if cc.has_type('GLchar', prefix : gl_include_block, dependencies : gl_lib_deps)
635     glconf.set('GST_GL_HAVE_GLCHAR', 1)
636   endif
637   if cc.has_type('GLsizeiptr', prefix : gl_include_block, dependencies : gl_lib_deps)
638     glconf.set('GST_GL_HAVE_GLSIZEIPTR', 1)
639   endif
640   if cc.has_type('GLintptr', prefix : gl_include_block, dependencies : gl_lib_deps)
641     glconf.set('GST_GL_HAVE_GLINTPTR', 1)
642   endif
643   if cc.has_type('GLsync', prefix : gl_include_block, dependencies : gl_lib_deps)
644     glconf.set('GST_GL_HAVE_GLSYNC', 1)
645   endif
646   if cc.has_type('GLuint64', prefix : gl_include_block, dependencies : gl_lib_deps)
647     glconf.set('GST_GL_HAVE_GLUINT64', 1)
648   endif
649   if cc.has_type('GLint64', prefix : gl_include_block, dependencies : gl_lib_deps)
650     glconf.set('GST_GL_HAVE_GLINT64', 1)
651   endif
652   if egl_dep.found() and cc.has_type('EGLAttrib', prefix : gl_include_block + egl_includes, dependencies : gl_lib_deps + [egl_dep])
653     glconf.set('GST_GL_HAVE_EGLATTRIB', 1)
654   endif
655
656   message('Building libgstgl with GL api:      ' + ' '.join(enabled_gl_apis))
657   message('Building libgstgl with GL platform: ' + ' '.join(enabled_gl_platforms))
658   message('Building libgstgl with GL winsys:   ' + ' '.join(enabled_gl_winsys))
659
660   install_headers(gl_headers, subdir : 'gstreamer-1.0/gst/gl')
661   install_headers(gl_cocoa_headers, subdir : 'gstreamer-1.0/gst/gl/cocoa')
662   install_headers(gl_egl_headers, subdir : 'gstreamer-1.0/gst/gl/egl')
663   install_headers(gl_prototype_headers, subdir : 'gstreamer-1.0/gst/gl/glprototypes')
664   install_headers(gl_x11_headers, subdir : 'gstreamer-1.0/gst/gl/x11')
665   install_headers(gl_wayland_headers, subdir : 'gstreamer-1.0/gst/gl/wayland')
666
667   configure_file(input : 'gstglconfig.h.meson',
668     output : 'gstglconfig.h',
669     install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/gl',
670     configuration : glconf)
671
672   gstgl = library('gstgl-' + api_version,
673     gl_sources,
674     c_args : gst_plugins_base_args + gl_cpp_args,
675     include_directories : [configinc, libsinc],
676     version : libversion,
677     soversion : soversion,
678     install : true,
679     dependencies : [gst_base_dep, video_dep, allocators_dep, gmodule_dep,
680                     gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps])
681   gen_sources = []
682   if build_gir
683     gl_gir = gnome.generate_gir(gstgl,
684       sources : gl_sources + gl_headers,
685       namespace : 'GstGL',
686       nsversion : api_version,
687       identifier_prefix : 'Gst',
688       symbol_prefix : 'gst',
689       export_packages : 'gstreamer-gl-1.0',
690       includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
691       install : true,
692       extra_args : gir_init_section + ['--c-include=gst/gl/gl.h'],
693       dependencies : [video_dep, gst_dep, gst_base_dep]
694     )
695     gen_sources += gl_gir
696   endif
697
698
699   gstgl_dep = declare_dependency(link_with : gstgl,
700     include_directories : [libsinc],
701     sources: gen_sources,
702     dependencies : [video_dep, gst_base_dep] + gl_winsys_deps)
703 endif