diff options
-rw-r--r-- | docs/markdown/Wayland-module.md | 3 | ||||
-rw-r--r-- | docs/markdown/snippets/wayland_scan_xml_core_only_arg.md | 5 | ||||
-rw-r--r-- | mesonbuild/modules/wayland.py | 8 | ||||
-rw-r--r-- | test cases/wayland/2 core only/core.c | 9 | ||||
-rw-r--r-- | test cases/wayland/2 core only/meson.build | 14 |
5 files changed, 38 insertions, 1 deletions
diff --git a/docs/markdown/Wayland-module.md b/docs/markdown/Wayland-module.md index 345c4e3..353bb6b 100644 --- a/docs/markdown/Wayland-module.md +++ b/docs/markdown/Wayland-module.md @@ -50,6 +50,7 @@ generated = wl_mod.scan_xml( client : true, server : true, public : false, + core_only : false, ) ``` This function accepts one or more arguments of either string or file type. @@ -61,6 +62,8 @@ It takes the following keyword arguments: generated. The default is true. - `server` Optional arg that specifies if server side header file is generated. The default is false. +- `core_only` Optional arg that specifies that generated headers only include + wayland-client-core.h instead of wayland-client.h. Since *0.64.0* **Returns**: a list of [[@custom_tgt]] in the order source, client side header, server side header. Generated header files have the name diff --git a/docs/markdown/snippets/wayland_scan_xml_core_only_arg.md b/docs/markdown/snippets/wayland_scan_xml_core_only_arg.md new file mode 100644 index 0000000..59f4e1b --- /dev/null +++ b/docs/markdown/snippets/wayland_scan_xml_core_only_arg.md @@ -0,0 +1,5 @@ +## Added core_only arg to wayland.scan_xml. + +The `scan_xml` function from the wayland module now has an optional bool +argument `core_only`, so that headers generated by wayland-scanner now +only include `wayland-client-core.h` instead of `wayland-client.h`. diff --git a/mesonbuild/modules/wayland.py b/mesonbuild/modules/wayland.py index bcb5b95..1b2b333 100644 --- a/mesonbuild/modules/wayland.py +++ b/mesonbuild/modules/wayland.py @@ -37,6 +37,7 @@ if T.TYPE_CHECKING: public: bool client: bool server: bool + core_only: bool class FindProtocol(TypedDict): @@ -65,6 +66,7 @@ class WaylandModule(ExtensionModule): KwargInfo('public', bool, default=False), KwargInfo('client', bool, default=True), KwargInfo('server', bool, default=False), + KwargInfo('core_only', bool, default=False, since='0.64.0'), ) def scan_xml(self, state: ModuleState, args: T.Tuple[T.List[FileOrString]], kwargs: ScanXML) -> ModuleReturnValue: if self.scanner_bin is None: @@ -98,12 +100,16 @@ class WaylandModule(ExtensionModule): targets.append(code) for side in sides: + command = [self.scanner_bin, f'{side}-header', '@INPUT@', '@OUTPUT@'] + if kwargs['core_only']: + command.append('--include-core-only') + header = CustomTarget( f'{name}-{side}-protocol', state.subdir, state.subproject, state.environment, - [self.scanner_bin, f'{side}-header', '@INPUT@', '@OUTPUT@'], + command, [xml_file], [f'{name}-{side}-protocol.h'], backend=state.backend, diff --git a/test cases/wayland/2 core only/core.c b/test cases/wayland/2 core only/core.c new file mode 100644 index 0000000..5bb55e5 --- /dev/null +++ b/test cases/wayland/2 core only/core.c @@ -0,0 +1,9 @@ +#include <xdg-shell-client-protocol.h> + +int main() { +#if defined(XDG_SHELL_CLIENT_PROTOCOL_H) && !defined(WAYLAND_CLIENT_H) && !defined(WAYLAND_CLIENT_PROTOCOL_H) + return 0; +#else + return 1; +#endif +} diff --git a/test cases/wayland/2 core only/meson.build b/test cases/wayland/2 core only/meson.build new file mode 100644 index 0000000..bb98992 --- /dev/null +++ b/test cases/wayland/2 core only/meson.build @@ -0,0 +1,14 @@ +project('wayland-test-core-only', 'c') + +wl_protocols_dep = dependency('wayland-protocols', required : false) +if not wl_protocols_dep.found() + error('MESON_SKIP_TEST: wayland-protocols not installed') +endif + +wl_mod = import('unstable-wayland') +wl_client_dep = dependency('wayland-client') + +xdg_shell_xml = wl_mod.find_protocol('xdg-shell') +xdg_shell = wl_mod.scan_xml(xdg_shell_xml, core_only : true) +exe = executable('core', 'core.c', xdg_shell, dependencies : wl_client_dep) +test('core', exe) |