Replace generator with custom_target
This stops the protocol header constantly being regenerated for every
target using them.
Scott Anderson
5 years ago
8 | 8 | else |
9 | 9 | wayland_scanner = find_program('wayland-scanner', native: true) |
10 | 10 | endif |
11 | ||
12 | wayland_scanner_server = generator( | |
13 | wayland_scanner, | |
14 | output: '@BASENAME@-protocol.h', | |
15 | arguments: ['server-header', '@INPUT@', '@OUTPUT@'], | |
16 | ) | |
17 | ||
18 | wayland_scanner_code = generator( | |
19 | wayland_scanner, | |
20 | output: '@BASENAME@-protocol.c', | |
21 | arguments: ['private-code', '@INPUT@', '@OUTPUT@'], | |
22 | ) | |
23 | ||
24 | wayland_scanner_client = generator( | |
25 | wayland_scanner, | |
26 | output: '@BASENAME@-client-protocol.h', | |
27 | arguments: ['client-header', '@INPUT@', '@OUTPUT@'], | |
28 | ) | |
29 | 11 | |
30 | 12 | protocols = [ |
31 | 13 | [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], |
67 | 49 | |
68 | 50 | foreach p : protocols |
69 | 51 | xml = join_paths(p) |
70 | wl_protos_src += wayland_scanner_code.process(xml) | |
71 | wl_protos_headers += wayland_scanner_server.process(xml) | |
52 | wl_protos_src += custom_target( | |
53 | xml.underscorify() + '_server_c', | |
54 | input: xml, | |
55 | output: '@BASENAME@-protocol.c', | |
56 | command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], | |
57 | ) | |
58 | wl_protos_headers += custom_target( | |
59 | xml.underscorify() + '_server_h', | |
60 | input: xml, | |
61 | output: '@BASENAME@-protocol.h', | |
62 | command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'], | |
63 | ) | |
72 | 64 | endforeach |
73 | 65 | |
74 | 66 | foreach p : client_protocols |
75 | 67 | xml = join_paths(p) |
76 | wl_protos_headers += wayland_scanner_client.process(xml) | |
68 | wl_protos_headers += custom_target( | |
69 | xml.underscorify() + '_client_h', | |
70 | input: xml, | |
71 | output: '@BASENAME@-client-protocol.h', | |
72 | command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'], | |
73 | ) | |
77 | 74 | endforeach |
78 | 75 | |
79 | 76 | lib_wl_protos = static_library( |