meson.build (1195B)
1 wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') 2 3 wayland_scanner = find_program('wayland-scanner') 4 5 # should check wayland_scanner's version, but it is hard to get 6 if wayland_server.version().version_compare('>=1.14.91') 7 code_type = 'private-code' 8 else 9 code_type = 'code' 10 endif 11 12 wayland_scanner_code = generator( 13 wayland_scanner, 14 output: '@BASENAME@-protocol.c', 15 arguments: [code_type, '@INPUT@', '@OUTPUT@'], 16 ) 17 18 wayland_scanner_server = generator( 19 wayland_scanner, 20 output: '@BASENAME@-protocol.h', 21 arguments: ['server-header', '@INPUT@', '@OUTPUT@'], 22 ) 23 24 server_protocols = [ 25 [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], 26 ['wlr-layer-shell-unstable-v1.xml'], 27 ] 28 29 server_protos_src = [] 30 server_protos_headers = [] 31 32 foreach p : server_protocols 33 xml = join_paths(p) 34 server_protos_src += wayland_scanner_code.process(xml) 35 server_protos_headers += wayland_scanner_server.process(xml) 36 endforeach 37 38 lib_server_protos = static_library( 39 'server_protos', 40 server_protos_src + server_protos_headers, 41 dependencies: [wayland_server] 42 ) # for the include directory 43 44 server_protos = declare_dependency( 45 link_with: lib_server_protos, 46 sources: server_protos_headers, 47 )