summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorDylan Baker <dylan.c.baker@intel.com>2022-12-20 14:59:48 -0800
committerMarge Bot <emma+marge@anholt.net>2023-01-19 16:29:03 +0000
commiteac76e433d7a75125afa16bce5adf3fcf7163839 (patch)
tree969928824292b2444863092e79a2caac7fb7705f /meson.build
parent8dcc1f83111da0fb7a09f24089bc7f98f00f5685 (diff)
downloadmesa-eac76e433d7a75125afa16bce5adf3fcf7163839.tar.gz
meson: use a feature option for gallium-vdpau
Which we can use with the require method, and use the feature itself as the require argument to dependency call. All of this results in less code Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build62
1 files changed, 18 insertions, 44 deletions
diff --git a/meson.build b/meson.build
index 19a95d37b00..7f5709d2284 100644
--- a/meson.build
+++ b/meson.build
@@ -640,53 +640,27 @@ if with_gallium_d3d12 and not _with_gallium_d3d12_video.disabled()
pre_args += '-DHAVE_GALLIUM_D3D12_VIDEO'
endif
-_vdpau = get_option('gallium-vdpau')
-if _vdpau == 'true'
- _vdpau = 'enabled'
- warning('gallium-vdpau option "true" deprecated, please use "enabled" instead.')
-elif _vdpau == 'false'
- _vdpau = 'disabled'
- warning('gallium-vdpau option "false" deprecated, please use "disabled" instead.')
-endif
-if not system_has_kms_drm
- if _vdpau == 'enabled'
- error('VDPAU state tracker can only be build on unix-like OSes.')
- else
- _vdpau = 'disabled'
- endif
-elif not with_platform_x11
- if _vdpau == 'enabled'
- error('VDPAU state tracker requires X11 support.')
- else
- _vdpau = 'disabled'
- endif
-elif not [
- with_gallium_d3d12_video,
- with_gallium_nouveau,
- with_gallium_r300,
- with_gallium_r600,
- with_gallium_radeonsi,
- with_gallium_virgl,
- ].contains(true)
- if _vdpau == 'enabled'
- error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video, virgl).')
- else
- _vdpau = 'disabled'
- endif
-endif
-dep_vdpau = null_dep
-with_gallium_vdpau = false
-if _vdpau != 'disabled'
- dep_vdpau = dependency('vdpau', version : '>= 1.1', required : _vdpau == 'enabled')
- if dep_vdpau.found()
- dep_vdpau = dep_vdpau.partial_dependency(compile_args : true)
- with_gallium_vdpau = true
- endif
-endif
+_vdpau_drivers = [
+ with_gallium_d3d12_video,
+ with_gallium_nouveau,
+ with_gallium_r300,
+ with_gallium_r600,
+ with_gallium_radeonsi,
+ with_gallium_virgl,
+]
+
+vdpau = get_option('gallium-vdpau') \
+ .require(system_has_kms_drm, error_message : 'VDPAU state tracker can only be build on unix-like OSes.') \
+ .require(with_platform_x11, error_message : 'VDPAU state tracker requires X11 support.') \
+ .require(_vdpau_drivers.contains(true), error_message : 'VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video, virgl).')
-if with_gallium_vdpau
+dep_vdpau = dependency('vdpau', version : '>= 1.1', required : vdpau)
+if dep_vdpau.found()
+ dep_vdpau = dep_vdpau.partial_dependency(compile_args : true)
pre_args += '-DHAVE_ST_VDPAU'
endif
+with_gallium_vdpau = dep_vdpau.found()
+
vdpau_drivers_path = get_option('vdpau-libs-path')
if vdpau_drivers_path == ''
vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')