1wl_sources = [
2    'gstwaylandsink.c',
3    'wlshmallocator.c',
4    'wlbuffer.c',
5    'wldisplay.c',
6    'wlwindow.c',
7    'wlvideoformat.c',
8    'wllinuxdmabuf.c'
9]
10
11libdrm_dep = dependency('libdrm', version: '>= 2.4.55', required:get_option('wayland'))
12
13if use_wayland
14    protocols_datadir = wl_protocol_dep.get_pkgconfig_variable('pkgdatadir')
15
16    protocol_defs = [
17        ['/stable/viewporter/viewporter.xml', 'viewporter-protocol.c', 'viewporter-client-protocol.h'],
18        ['/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
19         'linux-dmabuf-unstable-v1-protocol.c', 'linux-dmabuf-unstable-v1-client-protocol.h'],
20        ['/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml',
21         'fullscreen-shell-unstable-v1-protocol.c', 'fullscreen-shell-unstable-v1-client-protocol.h'],
22        ['/stable/xdg-shell/xdg-shell.xml', 'xdg-shell-protocol.c', 'xdg-shell-client-protocol.h'],
23    ]
24    protocols_files = []
25
26    foreach protodef: protocol_defs
27        xmlfile = protocols_datadir + protodef.get(0)
28
29        protocols_files += [custom_target(protodef.get(1),
30          output : protodef.get(1),
31          input : xmlfile,
32          command : [wl_scanner, 'code', '@INPUT@', '@OUTPUT@'])]
33
34        protocols_files += [custom_target(protodef.get(2),
35          output : protodef.get(2),
36          input : xmlfile,
37          command : [wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'])]
38    endforeach
39
40    gstwaylandsink = library('gstwaylandsink',
41        wl_sources + protocols_files,
42        c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
43        include_directories : [configinc],
44        dependencies : [gst_dep, gstvideo_dep, gstwayland_dep, gstallocators_dep,
45                        wl_client_dep, wl_protocol_dep, libdrm_dep],
46        install : true,
47        install_dir : plugins_install_dir,
48    )
49    pkgconfig.generate(gstwaylandsink, install_dir : plugins_pkgconfig_install_dir)
50endif
51