aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
authorLibravatar Manuel Stoeckl <code@mstoeckl.com>2019-06-22 23:02:24 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2019-06-24 09:38:41 +0300
commit5becce8005e3c617afbdddda8f0da95f84540b27 (patch)
tree4f49cb1dff54c27e2160fd53705e834dcf5d936e /protocols
parentws-output-priority: fix logic issue in find_output (diff)
downloadsway-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')
-rw-r--r--protocols/meson.build88
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 @@
1wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') 1wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
2 2
3wayland_scanner = find_program('wayland-scanner') 3wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
4 4if wayland_scanner_dep.found()
5# should check wayland_scanner's version, but it is hard to get 5 wayland_scanner = find_program(
6if 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 )
8else 9else
9 code_type = 'code' 10 wayland_scanner = find_program('wayland-scanner', native: true)
10endif 11endif
11 12
12wayland_scanner_code = generator( 13protocols = [
13 wayland_scanner,
14 output: '@BASENAME@-protocol.c',
15 arguments: [code_type, '@INPUT@', '@OUTPUT@'],
16)
17
18wayland_scanner_client = generator(
19 wayland_scanner,
20 output: '@BASENAME@-client-protocol.h',
21 arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
22)
23
24wayland_scanner_server = generator(
25 wayland_scanner,
26 output: '@BASENAME@-protocol.h',
27 arguments: ['server-header', '@INPUT@', '@OUTPUT@'],
28)
29
30client_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
38server_protocols = [ 23client_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
47client_protos_src = [] 30wl_protos_src = []
48client_protos_headers = [] 31wl_protos_headers = []
49
50server_protos_src = []
51server_protos_headers = []
52 32
53foreach p : client_protocols 33foreach 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 )
57endforeach 47endforeach
58 48
59foreach p : server_protocols 49foreach 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 )
63endforeach 57endforeach
64 58
65lib_client_protos = static_library( 59lib_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
71client_protos = declare_dependency( 65client_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
76lib_server_protos = static_library( 70lib_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
82server_protos = declare_dependency( 76server_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)