Compare commits

...

1 Commits

Author SHA1 Message Date
Dylan Baker
85d95009f5 meson: use the wayland module
This module has existed, unchanged, since Meson 0.64, and is now marked
as API stable in 1.8. It provides a number of helpers that reduce the
amount of code we need (including fiddly code about finding
wayland-scanner) by a bit, as well as some nice helpers for finding
external XML files.
2025-07-02 15:32:17 -07:00
3 changed files with 14 additions and 48 deletions

View File

@@ -1979,13 +1979,6 @@ endif
# TODO: symbol mangling
if with_platform_wayland
dep_wl_scanner = dependency('wayland-scanner', native: true)
prog_wl_scanner = find_program(dep_wl_scanner.get_variable(pkgconfig : 'wayland_scanner'))
if dep_wl_scanner.version().version_compare('>= 1.15')
wl_scanner_arg = 'private-code'
else
wl_scanner_arg = 'code'
endif
dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.41', default_options: [ 'tests=false' ])
dep_wayland_client = dependency('wayland-client', version : '>=1.18')
dep_wayland_server = dependency('wayland-server', version : '>=1.18')
@@ -2006,6 +1999,8 @@ if with_platform_wayland
dependencies: dep_wayland_client)
pre_args += ['-DHAVE_WL_CREATE_QUEUE_WITH_NAME']
endif
# This can be renamed just `wayland` when we require at least 1.8
mod_wl = import('unstable-wayland')
endif
# Even if we find OpenMP, Gitlab CI fails to link with gcc/i386 and clang/anyarch.

View File

@@ -3,26 +3,10 @@
inc_wayland_drm = include_directories('.')
wayland_drm_protocol_c = custom_target(
'wayland-drm-protocol.c',
input : 'wayland-drm.xml',
output : 'wayland-drm-protocol.c',
command : [prog_wl_scanner, wl_scanner_arg, '@INPUT@', '@OUTPUT@'],
)
wayland_drm_client_protocol_h = custom_target(
'wayland-drm-client-protocol.h',
input : 'wayland-drm.xml',
output : 'wayland-drm-client-protocol.h',
command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
)
wayland_drm_server_protocol_h = custom_target(
'wayland-drm-server-protocol.h',
input : 'wayland-drm.xml',
output : 'wayland-drm-server-protocol.h',
command : [prog_wl_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
)
_wl_drm = mod_wl.scan_xml('wayland-drm.xml', server : true, include_core_only : false)
wayland_drm_protocol_c = _wl_drm[0]
wayland_drm_client_protocol_h = _wl_drm[1]
wayland_drm_server_protocol_h = _wl_drm[2]
libwayland_drm = static_library(
'wayland_drm',

View File

@@ -4,31 +4,18 @@
inc_loader = include_directories('.')
if with_platform_wayland
wp_dir = dep_wl_protocols.get_variable(pkgconfig : 'pkgdatadir', internal : 'pkgdatadir')
wp_protos = {
'fifo-v1': 'staging/fifo/fifo-v1.xml',
'commit-timing-v1': 'staging/commit-timing/commit-timing-v1.xml',
'linux-dmabuf-unstable-v1': 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
'presentation-time': 'stable/presentation-time/presentation-time.xml',
'tearing-control-v1': 'staging/tearing-control/tearing-control-v1.xml',
'linux-drm-syncobj-v1': 'staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml',
'color-management-v1': 'staging/color-management/color-management-v1.xml',
'fifo-v1': mod_wl.find_protocol('fifo', state : 'staging', version : 1),
'commit-timing-v1': mod_wl.find_protocol('commit-timing', state : 'staging', version : 1),
'linux-dmabuf-unstable-v1': mod_wl.find_protocol('linux-dmabuf', state : 'unstable', version : 1),
'presentation-time': mod_wl.find_protocol('presentation-time'),
'tearing-control-v1': mod_wl.find_protocol('tearing-control', state : 'staging', version : 1),
'linux-drm-syncobj-v1': mod_wl.find_protocol('linux-drm-syncobj', state : 'staging', version : 1),
'color-management-v1': mod_wl.find_protocol('color-management', state : 'staging', version : 1)
}
wp_files = {}
foreach name, xml : wp_protos
code = custom_target(
name + '-protocol.c',
input : files(join_paths(wp_dir, xml)),
output : name + '-protocol.c',
command : [prog_wl_scanner, wl_scanner_arg, '@INPUT@', '@OUTPUT@'],
)
header = custom_target(
name + '-client-protocol.h',
input : files(join_paths(wp_dir, xml)),
output : name + '-client-protocol.h',
command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
)
wp_files += { name: [code, header] }
wp_files += {name : mod_wl.scan_xml(xml, include_core_only : false)}
endforeach
libloader_wayland_helper = static_library(