Meson: use hw-s for protocols, add hyprutils

This commit is contained in:
Mihai Fufezan 2024-09-20 14:27:50 +00:00
parent 1813670c34
commit c5c87cf77a
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
2 changed files with 33 additions and 22 deletions

View file

@ -11,15 +11,12 @@ hyprland_protos = dependency('hyprland-protocols',
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
hl_protocol_dir = hyprland_protos.get_variable('pkgdatadir') hl_protocol_dir = hyprland_protos.get_variable('pkgdatadir')
wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true) hyprwayland_scanner_dep = dependency('hyprwayland-scanner', required: true, native: true, version: '>=0.4.2')
if wayland_scanner_dep.found() hyprwayland_scanner = find_program(
wayland_scanner = find_program( hyprwayland_scanner_dep.get_variable(pkgconfig: 'hyprwayland_scanner'),
wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'),
native: true, native: true,
) )
else
wayland_scanner = find_program('wayland-scanner', native: true)
endif
client_protocols = [ client_protocols = [
'wlr-screencopy-unstable-v1.xml', 'wlr-screencopy-unstable-v1.xml',
'wlr-foreign-toplevel-management-unstable-v1.xml', 'wlr-foreign-toplevel-management-unstable-v1.xml',
@ -31,19 +28,31 @@ client_protocols = [
wl_proto_files = [] wl_proto_files = []
foreach xml: client_protocols foreach xml: client_protocols
code = custom_target( wl_proto_files += custom_target(
xml.underscorify() + '_c', xml.underscorify() + '_c',
input: xml, input: xml,
output: '@BASENAME@-protocol.c', output: ['@BASENAME@.cpp', '@BASENAME@.hpp'],
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], 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 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
)

View file

@ -2,10 +2,12 @@ globber = run_command('find', '.', '-name', '*.cpp', check: true)
src = globber.stdout().strip().split('\n') src = globber.stdout().strip().split('\n')
executable('xdg-desktop-portal-hyprland', executable('xdg-desktop-portal-hyprland',
[src, wl_proto_files], [src],
dependencies: [ dependencies: [
client_protos,
dependency('gbm'), dependency('gbm'),
dependency('hyprlang'), dependency('hyprlang'),
dependency('hyprutils'),
dependency('libdrm'), dependency('libdrm'),
dependency('libpipewire-0.3'), dependency('libpipewire-0.3'),
dependency('sdbus-c++'), dependency('sdbus-c++'),