build: Store generated Wayland protocol files in table

This makes it possible for e.g. test cases to pick protocol extensions
to include.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
This commit is contained in:
Jonas Ådahl 2023-02-01 17:49:08 +01:00 committed by Marge Bot
parent 79e1fc63ad
commit 3c65b8d9e0

View File

@ -992,6 +992,8 @@ wayland_protocol_server_headers = []
wayland_protocol_client_headers = [] wayland_protocol_client_headers = []
wayland_protocol_sources = [] wayland_protocol_sources = []
wayland_protocol_files = {}
if have_wayland if have_wayland
# Format: # Format:
# - protocol name # - protocol name
@ -1063,7 +1065,7 @@ if have_wayland
output_base)) output_base))
endif endif
wayland_protocol_server_headers += custom_target('@0@ server header'.format(output_base), server_header = custom_target('@0@ server header'.format(output_base),
input: input, input: input,
output: '@0@-server-protocol.h'.format(output_base), output: '@0@-server-protocol.h'.format(output_base),
command: [ command: [
@ -1072,9 +1074,7 @@ if have_wayland
'@INPUT@', '@OUTPUT@', '@INPUT@', '@OUTPUT@',
] ]
) )
client_header = custom_target('@0@ client header'.format(output_base),
# used by tests
wayland_protocol_client_headers += custom_target('@0@ client header'.format(output_base),
input: input, input: input,
output: '@0@-client-protocol.h'.format(output_base), output: '@0@-client-protocol.h'.format(output_base),
command: [ command: [
@ -1083,8 +1083,7 @@ if have_wayland
'@INPUT@', '@OUTPUT@', '@INPUT@', '@OUTPUT@',
] ]
) )
protocol_code = custom_target('@0@ source'.format(output_base),
wayland_protocol_sources += custom_target('@0@ source'.format(output_base),
input: input, input: input,
output: '@0@-protocol.c'.format(output_base), output: '@0@-protocol.c'.format(output_base),
command: [ command: [
@ -1093,6 +1092,18 @@ if have_wayland
'@INPUT@', '@OUTPUT@', '@INPUT@', '@OUTPUT@',
] ]
) )
wayland_protocol_files += {
protocol_name: {
'server-header': server_header,
'client-header': client_header,
'protocol-code': protocol_code,
},
}
wayland_protocol_server_headers += server_header
wayland_protocol_client_headers += client_header
wayland_protocol_sources += protocol_code
endforeach endforeach
endif endif