summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-08-26 11:01:29 +0200
committerMarge Bot <emma+marge@anholt.net>2023-05-03 16:09:09 +0000
commit47cd010931a48fcdf259ffcd455ca065f180adc3 (patch)
tree475f69ec26ffef9d62c402585c2b682531b52c90
parent0b251d43622391cbffad4a4e748e41223b2344fe (diff)
downloadmesa-47cd010931a48fcdf259ffcd455ca065f180adc3.tar.gz
wayland: generalize wayland-protocols code generation
Make it easy to add a new protocol to the list without duplicating logic. Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22682>
-rw-r--r--meson.build4
-rw-r--r--src/egl/meson.build7
-rw-r--r--src/egl/wayland/wayland-drm/meson.build33
-rw-r--r--src/vulkan/wsi/meson.build5
4 files changed, 23 insertions, 26 deletions
diff --git a/meson.build b/meson.build
index 37c323200a8..3351d4e4d37 100644
--- a/meson.build
+++ b/meson.build
@@ -1913,10 +1913,6 @@ if with_platform_wayland
dep_wayland_egl = dependency('wayland-egl-backend', version : '>= 3')
dep_wayland_egl_headers = dep_wayland_egl.partial_dependency(compile_args : true)
endif
- wayland_dmabuf_xml = join_paths(
- dep_wl_protocols.get_variable(pkgconfig : 'pkgdatadir'), 'unstable',
- 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
- )
pre_args += '-DWL_HIDE_DEPRECATED'
endif
diff --git a/src/egl/meson.build b/src/egl/meson.build
index ac9a48e0990..013a93367d6 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -129,11 +129,8 @@ if with_dri2
deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
link_for_egl += libwayland_drm
files_egl += files('drivers/dri2/platform_wayland.c')
- files_egl += [
- linux_dmabuf_unstable_v1_protocol_c,
- linux_dmabuf_unstable_v1_client_protocol_h,
- wayland_drm_client_protocol_h,
- ]
+ files_egl += wp_files['linux-dmabuf-unstable-v1']
+ files_egl += [wayland_drm_client_protocol_h]
incs_for_egl += include_directories('wayland/wayland-drm')
endif
if with_platform_android
diff --git a/src/egl/wayland/wayland-drm/meson.build b/src/egl/wayland/wayland-drm/meson.build
index b4782a013c9..7bb9237e06e 100644
--- a/src/egl/wayland/wayland-drm/meson.build
+++ b/src/egl/wayland/wayland-drm/meson.build
@@ -57,16 +57,23 @@ libwayland_drm = static_library(
#
# Moving these to a src/wsi/ was suggested but shot down, so put these
# here for now as the maybe-least-bad solution.
-linux_dmabuf_unstable_v1_protocol_c = custom_target(
- 'linux-dmabuf-unstable-v1-protocol.c',
- input : wayland_dmabuf_xml,
- output : 'linux-dmabuf-unstable-v1-protocol.c',
- command : [prog_wl_scanner, wl_scanner_arg, '@INPUT@', '@OUTPUT@'],
-)
-
-linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
- 'linux-dmabuf-unstable-v1-client-protocol.h',
- input : wayland_dmabuf_xml,
- output : 'linux-dmabuf-unstable-v1-client-protocol.h',
- command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
-)
+wp_dir = dep_wl_protocols.get_variable(pkgconfig : 'pkgdatadir')
+wp_protos = {
+ 'linux-dmabuf-unstable-v1': 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
+}
+wp_files = {}
+foreach name, xml : wp_protos
+ code = custom_target(
+ name + '-protocol.c',
+ input : 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 : join_paths(wp_dir, xml),
+ output : name + '-client-protocol.h',
+ command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+ )
+ wp_files += { name: [code, header] }
+endforeach
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
index 0a9ac8ef572..08414a386da 100644
--- a/src/vulkan/wsi/meson.build
+++ b/src/vulkan/wsi/meson.build
@@ -31,10 +31,7 @@ endif
if with_platform_wayland
files_vulkan_wsi += files('wsi_common_wayland.c')
- files_vulkan_wsi += [
- linux_dmabuf_unstable_v1_client_protocol_h,
- linux_dmabuf_unstable_v1_protocol_c,
- ]
+ files_vulkan_wsi += wp_files['linux-dmabuf-unstable-v1']
endif
if with_platform_windows