From 736b099862f61b115b3845309b860cb66915fe2a Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 21 May 2019 12:36:01 +0300 Subject: meson: Start using 'feature' options Meson 0.47 comes with a new type of option called 'feature' so instead of: type : 'combo', value : 'auto', choices : ['auto', 'true', 'false'], We can: type : 'feature', The main difference is that the feature takes auto, enabled and disabled instead of auto, true and false. get_option() on a feature returns opaque object that can be passed as a 'required' argument of a dependency. Auto is equivalent to 'required : false', enabled is equivalent to 'required : true' and disabled introduces new behavior forcing the dependency to be considered not found. This allows us to streamline a lot of logic regarding optional IGT features. This patch bumps required meson version to 0.47.0 Cc: Daniel Vetter Cc: Petri Latvala Cc: Simon Ser Signed-off-by: Arkadiusz Hiler Reviewed-by: Daniel Vetter --- overlay/meson.build | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'overlay') diff --git a/overlay/meson.build b/overlay/meson.build index 46d2d494..d133b6be 100644 --- a/overlay/meson.build +++ b/overlay/meson.build @@ -1,3 +1,6 @@ +build_overlay = get_option('build_overlay') +overlay_backends = get_option('overlay_backends') + gpu_overlay_src = [ 'chart.c', 'config.c', @@ -18,7 +21,7 @@ xv_backend_required = false xlib_backend_required = false build_xv_backend = overlay_backends.contains('xv') or overlay_backends.contains('auto') build_xlib_backend = overlay_backends.contains('x') or overlay_backends.contains('auto') -if _overlay_required +if build_overlay.enabled() xv_backend_required = overlay_backends.contains('xv') xlib_backend_required = overlay_backends.contains('x') endif @@ -30,7 +33,7 @@ dri2proto = dependency('dri2proto', version : '>= 2.6', required : xv_backend_required or xlib_backend_required) cairo_xlib = dependency('cairo-xlib', required : xlib_backend_required) -xrandr = dependency('xrandr', version : '>=1.3', required : _overlay_required) +xrandr = dependency('xrandr', version : '>=1.3', required : build_overlay) gpu_overlay_deps = [ realtime, math, cairo, pciaccess, libdrm, libdrm_intel, lib_igt_perf ] @@ -70,7 +73,7 @@ gpu_overlay_src += both_x11_src gpu_overlay_src += 'kms/kms-overlay.c' -leg = find_program('leg', required : _overlay_required) +leg = find_program('leg', required : build_overlay) if leg.found() leg_file = custom_target('tracepoint_format', output: 'tracepoint_format.h', @@ -81,17 +84,17 @@ else message('WARNING: leg command not found, disabling overlay; try : apt-get install peg') endif -if _build_overlay and ['x86', 'x86_64'].contains(host_machine.cpu_family()) and libdrm_intel.found() and leg.found() and xrandr.found() and cairo.found() and (with_xlib_backend or with_xv_backend) +if not build_overlay.disabled() and ['x86', 'x86_64'].contains(host_machine.cpu_family()) and libdrm_intel.found() and leg.found() and xrandr.found() and cairo.found() and (with_xlib_backend or with_xv_backend) executable('intel-gpu-overlay', gpu_overlay_src, include_directories : inc, c_args : gpu_overlay_cflags, dependencies : gpu_overlay_deps, install : true) - build_info += 'Build overlay: Yes' + build_info += 'Build overlay: true' build_info += 'Overlay backends: ' + ','.join(backends_strings) else - if _overlay_required + if build_overlay.enabled() error('Cannot build overlay due to missing dependencies') endif - build_info += 'Build overlay: No' + build_info += 'Build overlay: false' endif -- cgit v1.2.3