diff --git a/protocols/meson.build b/protocols/meson.build index 2547daf..3910e24 100644 --- a/protocols/meson.build +++ b/protocols/meson.build @@ -11,15 +11,12 @@ hyprland_protos = dependency('hyprland-protocols', wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') hl_protocol_dir = hyprland_protos.get_variable('pkgdatadir') -wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true) -if wayland_scanner_dep.found() - wayland_scanner = find_program( - wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'), - native: true, - ) -else - wayland_scanner = find_program('wayland-scanner', native: true) -endif +hyprwayland_scanner_dep = dependency('hyprwayland-scanner', required: true, native: true, version: '>=0.4.2') +hyprwayland_scanner = find_program( + hyprwayland_scanner_dep.get_variable(pkgconfig: 'hyprwayland_scanner'), + native: true, +) + client_protocols = [ 'wlr-screencopy-unstable-v1.xml', 'wlr-foreign-toplevel-management-unstable-v1.xml', @@ -31,19 +28,31 @@ client_protocols = [ wl_proto_files = [] foreach xml: client_protocols - code = custom_target( + wl_proto_files += custom_target( xml.underscorify() + '_c', input: xml, - output: '@BASENAME@-protocol.c', - command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], + output: ['@BASENAME@.cpp', '@BASENAME@.hpp'], + command: [hyprwayland_scanner, '--client', '@INPUT@', '@OUTDIR@'], ) - - client_header = custom_target( - xml.underscorify() + '_client_h', - input: xml, - output: '@BASENAME@-protocol.h', - command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'], - ) - - wl_proto_files += [code, client_header] endforeach + +wayland_scanner = dependency('wayland-scanner') +wayland_scanner_dir = wayland_scanner.get_variable('pkgdatadir') + +wayland_xml = wayland_scanner_dir / 'wayland.xml' +wayland_protocol = custom_target( + wayland_xml.underscorify(), + input: wayland_xml, + output: ['@BASENAME@.cpp', '@BASENAME@.hpp'], + command: [hyprwayland_scanner, '--wayland-enums', '--client', '@INPUT@', '@OUTDIR@'], +) + +lib_client_protos = static_library( + 'client_protos', + wl_proto_files + wayland_protocol, +) + +client_protos = declare_dependency( + link_with: lib_client_protos, + sources: wl_proto_files + wayland_protocol +) diff --git a/src/meson.build b/src/meson.build index f816508..b76a85f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -2,10 +2,12 @@ globber = run_command('find', '.', '-name', '*.cpp', check: true) src = globber.stdout().strip().split('\n') executable('xdg-desktop-portal-hyprland', - [src, wl_proto_files], + [src], dependencies: [ + client_protos, dependency('gbm'), dependency('hyprlang'), + dependency('hyprutils'), dependency('libdrm'), dependency('libpipewire-0.3'), dependency('sdbus-c++'),