meson: generators() are sub-optimal. Replace with custom targets

This commit is contained in:
Daniel Eklöf 2019-06-05 21:10:10 +02:00
parent 58a6dc52fc
commit 450caba415
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -14,28 +14,29 @@ if backend_wayland
wscanner_prog = find_program( wscanner_prog = find_program(
wscanner.get_pkgconfig_variable('wayland_scanner'), native: true) wscanner.get_pkgconfig_variable('wayland_scanner'), native: true)
wayland_protocol_header = generator( wl_proto_headers = []
wscanner_prog, wl_proto_src = []
output: '@BASENAME@.h',
arguments: ['client-header', '@INPUT@', '@OUTPUT@'])
wayland_protocol_source = generator(
wscanner_prog,
output: '@BASENAME@.c',
arguments: ['private-code', '@INPUT@', '@OUTPUT@'])
generated_wayland_protocols = [] generated_wayland_protocols = []
foreach prot : [ foreach prot : [
'../external/wlr-layer-shell-unstable-v1.xml', '../external/wlr-layer-shell-unstable-v1.xml',
wayland_protocols_datadir + '/stable/xdg-shell/xdg-shell.xml', wayland_protocols_datadir + '/stable/xdg-shell/xdg-shell.xml',
wayland_protocols_datadir + '/unstable/xdg-output/xdg-output-unstable-v1.xml'] wayland_protocols_datadir + '/unstable/xdg-output/xdg-output-unstable-v1.xml']
generated_wayland_protocols += [ wl_proto_headers += custom_target(
wayland_protocol_header.process(prot), prot.underscorify() + '-client-header',
wayland_protocol_source.process(prot)] output : '@BASENAME@.h',
input : prot,
command : [wscanner_prog, 'client-header', '@INPUT@', '@OUTPUT@'])
wl_proto_src += custom_target(
prot.underscorify() + '-private-code',
output : '@BASENAME@.c',
input : prot,
command : [wscanner_prog, 'private-code', '@INPUT@', '@OUTPUT@'])
endforeach endforeach
bar_wayland = declare_dependency( bar_wayland = declare_dependency(
sources: ['wayland.c', 'wayland.h'] + generated_wayland_protocols, sources: ['wayland.c', 'wayland.h'] + wl_proto_src + wl_proto_headers,
dependencies: [wayland_client, wayland_cursor, cairo, cairo_ft]) dependencies: [wayland_client, wayland_cursor, cairo, cairo_ft])
bar_backends += [bar_wayland] bar_backends += [bar_wayland]