diff options
author | Manuel Stoeckl <code@mstoeckl.com> | 2019-06-22 23:02:24 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-06-24 09:38:41 +0300 |
commit | 5becce8005e3c617afbdddda8f0da95f84540b27 (patch) | |
tree | 4f49cb1dff54c27e2160fd53705e834dcf5d936e /protocols/meson.build | |
parent | ws-output-priority: fix logic issue in find_output (diff) | |
download | sway-5becce8005e3c617afbdddda8f0da95f84540b27.tar.gz sway-5becce8005e3c617afbdddda8f0da95f84540b27.tar.zst sway-5becce8005e3c617afbdddda8f0da95f84540b27.zip |
Replace meson generator with custom_target
This change mimics the wlroots protocol meson.build. It replaces
meson generators with custom_targets, which will only run wayland-scanner
once per output file.
The idle protocol is not used by any clients, so its client protocol
header is not generated.
The check for the availability of the private-code scanner options has
been removed, since the wlroots dependency requires wayland >= 1.16.
Diffstat (limited to 'protocols/meson.build')
-rw-r--r-- | protocols/meson.build | 88 |
1 files changed, 41 insertions, 47 deletions
diff --git a/protocols/meson.build b/protocols/meson.build index c438b078..2a6cea09 100644 --- a/protocols/meson.build +++ b/protocols/meson.build | |||
@@ -1,85 +1,79 @@ | |||
1 | wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') | 1 | wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') |
2 | 2 | ||
3 | wayland_scanner = find_program('wayland-scanner') | 3 | wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true) |
4 | 4 | if wayland_scanner_dep.found() | |
5 | # should check wayland_scanner's version, but it is hard to get | 5 | wayland_scanner = find_program( |
6 | if wayland_server.version().version_compare('>=1.14.91') | 6 | wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'), |
7 | code_type = 'private-code' | 7 | native: true, |
8 | ) | ||
8 | else | 9 | else |
9 | code_type = 'code' | 10 | wayland_scanner = find_program('wayland-scanner', native: true) |
10 | endif | 11 | endif |
11 | 12 | ||
12 | wayland_scanner_code = generator( | 13 | protocols = [ |
13 | wayland_scanner, | ||
14 | output: '@BASENAME@-protocol.c', | ||
15 | arguments: [code_type, '@INPUT@', '@OUTPUT@'], | ||
16 | ) | ||
17 | |||
18 | wayland_scanner_client = generator( | ||
19 | wayland_scanner, | ||
20 | output: '@BASENAME@-client-protocol.h', | ||
21 | arguments: ['client-header', '@INPUT@', '@OUTPUT@'], | ||
22 | ) | ||
23 | |||
24 | wayland_scanner_server = generator( | ||
25 | wayland_scanner, | ||
26 | output: '@BASENAME@-protocol.h', | ||
27 | arguments: ['server-header', '@INPUT@', '@OUTPUT@'], | ||
28 | ) | ||
29 | |||
30 | client_protocols = [ | ||
31 | [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], | 14 | [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], |
15 | [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], | ||
32 | [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], | 16 | [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], |
17 | [wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'], | ||
33 | ['wlr-layer-shell-unstable-v1.xml'], | 18 | ['wlr-layer-shell-unstable-v1.xml'], |
34 | ['idle.xml'], | 19 | ['idle.xml'], |
35 | ['wlr-input-inhibitor-unstable-v1.xml'], | 20 | ['wlr-input-inhibitor-unstable-v1.xml'], |
36 | ] | 21 | ] |
37 | 22 | ||
38 | server_protocols = [ | 23 | client_protocols = [ |
39 | [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], | 24 | [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], |
40 | [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], | ||
41 | [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], | 25 | [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], |
42 | [wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'], | ||
43 | ['wlr-layer-shell-unstable-v1.xml'], | 26 | ['wlr-layer-shell-unstable-v1.xml'], |
44 | ['wlr-input-inhibitor-unstable-v1.xml'], | 27 | ['wlr-input-inhibitor-unstable-v1.xml'], |
45 | ] | 28 | ] |
46 | 29 | ||
47 | client_protos_src = [] | 30 | wl_protos_src = [] |
48 | client_protos_headers = [] | 31 | wl_protos_headers = [] |
49 | |||
50 | server_protos_src = [] | ||
51 | server_protos_headers = [] | ||
52 | 32 | ||
53 | foreach p : client_protocols | 33 | foreach p : protocols |
54 | xml = join_paths(p) | 34 | xml = join_paths(p) |
55 | client_protos_src += wayland_scanner_code.process(xml) | 35 | wl_protos_src += custom_target( |
56 | client_protos_headers += wayland_scanner_client.process(xml) | 36 | xml.underscorify() + '_server_c', |
37 | input: xml, | ||
38 | output: '@BASENAME@-protocol.c', | ||
39 | command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], | ||
40 | ) | ||
41 | wl_protos_headers += custom_target( | ||
42 | xml.underscorify() + '_server_h', | ||
43 | input: xml, | ||
44 | output: '@BASENAME@-protocol.h', | ||
45 | command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'], | ||
46 | ) | ||
57 | endforeach | 47 | endforeach |
58 | 48 | ||
59 | foreach p : server_protocols | 49 | foreach p : client_protocols |
60 | xml = join_paths(p) | 50 | xml = join_paths(p) |
61 | server_protos_src += wayland_scanner_code.process(xml) | 51 | wl_protos_headers += custom_target( |
62 | server_protos_headers += wayland_scanner_server.process(xml) | 52 | xml.underscorify() + '_client_h', |
53 | input: xml, | ||
54 | output: '@BASENAME@-client-protocol.h', | ||
55 | command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'], | ||
56 | ) | ||
63 | endforeach | 57 | endforeach |
64 | 58 | ||
65 | lib_client_protos = static_library( | 59 | lib_client_protos = static_library( |
66 | 'client_protos', | 60 | 'client_protos', |
67 | client_protos_src + client_protos_headers, | 61 | wl_protos_src + wl_protos_headers, |
68 | dependencies: [wayland_client] | 62 | dependencies: wayland_client.partial_dependency(compile_args: true), |
69 | ) # for the include directory | 63 | ) |
70 | 64 | ||
71 | client_protos = declare_dependency( | 65 | client_protos = declare_dependency( |
72 | link_with: lib_client_protos, | 66 | link_with: lib_client_protos, |
73 | sources: client_protos_headers, | 67 | sources: wl_protos_headers, |
74 | ) | 68 | ) |
75 | 69 | ||
76 | lib_server_protos = static_library( | 70 | lib_server_protos = static_library( |
77 | 'server_protos', | 71 | 'server_protos', |
78 | server_protos_src + server_protos_headers, | 72 | wl_protos_src + wl_protos_headers, |
79 | dependencies: [wayland_client] | 73 | dependencies: wayland_server.partial_dependency(compile_args: true), |
80 | ) # for the include directory | 74 | ) |
81 | 75 | ||
82 | server_protos = declare_dependency( | 76 | server_protos = declare_dependency( |
83 | link_with: lib_server_protos, | 77 | link_with: lib_server_protos, |
84 | sources: server_protos_headers, | 78 | sources: wl_protos_headers, |
85 | ) | 79 | ) |