summaryrefslogtreecommitdiff
path: root/overlay
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2018-06-21 14:06:25 +0300
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2018-06-25 10:09:49 +0300
commit0e98bf69f146eb72fe3a7c3b19a049b5786f0ca3 (patch)
tree2591f985145975a7da5f521ff077e0c69571ea8d /overlay
parent9bbfbb1ce314578f18efe73b2cd74e877eb999fb (diff)
meson: Add options to control optional parts
Distributions want explicit control over optional parts so they can state runtime dependencies before building. Let's restore the functionality autotools used to provide. Where possible, the selection is done by choosing whether to build a particular item and the option name is build_$item. Example: build_overlay. Where not possible, the option name is with_$item. Example: with_valgrind. Array options require a bump of required meson version to 0.44. Debian stable has meson 0.37 which is already too old, stable-backports has 0.45, CI uses 0.45. Mesa's meson requirement is 0.44.1, for a perspective. Note, the old hack for not building docs when cross-compiling is gone, as doc building can be explicitly controlled now. v2: glib not optional v3: bump meson version to 0.44 Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Matt Turner <mattst88@gmail.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Eric Anholt <eric@anholt.net> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'overlay')
-rw-r--r--overlay/meson.build46
1 files changed, 36 insertions, 10 deletions
diff --git a/overlay/meson.build b/overlay/meson.build
index 546c8377..46d2d494 100644
--- a/overlay/meson.build
+++ b/overlay/meson.build
@@ -14,20 +14,35 @@ gpu_overlay_src = [
'rc6.c',
]
-xv = dependency('xv', required : false)
-x11 = dependency('x11', required : false)
-xext = dependency('xext', required : false)
-dri2proto = dependency('dri2proto', version : '>= 2.6', required : false)
-cairo_xlib = dependency('cairo-xlib', required : false)
-xrandr = dependency('xrandr', version : '>=1.3', required : false)
+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
+ xv_backend_required = overlay_backends.contains('xv')
+ xlib_backend_required = overlay_backends.contains('x')
+endif
+
+xv = dependency('xv', required : xv_backend_required)
+x11 = dependency('x11', required : xv_backend_required)
+xext = dependency('xext', required : xv_backend_required)
+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)
gpu_overlay_deps = [ realtime, math, cairo, pciaccess, libdrm,
libdrm_intel, lib_igt_perf ]
both_x11_src = ''
+with_xv_backend = false
+with_xlib_backend = false
+backends_strings = []
+
gpu_overlay_cflags = []
-if xv.found() and x11.found() and xext.found() and dri2proto.found()
+if build_xv_backend and xv.found() and x11.found() and xext.found() and dri2proto.found()
both_x11_src = 'x11/position.c'
gpu_overlay_src += [
'x11/dri2.c',
@@ -38,20 +53,24 @@ if xv.found() and x11.found() and xext.found() and dri2proto.found()
]
gpu_overlay_deps += [ xv, x11, xext, dri2proto ]
gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XVLIB' ]
+ with_xv_backend = true
+ backends_strings += 'Xv'
endif
-if cairo_xlib.found() and xrandr.found() and dri2proto.found()
+if build_xlib_backend and cairo_xlib.found() and dri2proto.found()
both_x11_src = 'x11/position.c'
gpu_overlay_src += 'x11/x11-window.c'
gpu_overlay_deps += [ cairo_xlib, dri2proto ]
gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XLIB' ]
+ with_xlib_backend = true
+ backends_strings += 'X'
endif
gpu_overlay_src += both_x11_src
gpu_overlay_src += 'kms/kms-overlay.c'
-leg = find_program('leg', required : false)
+leg = find_program('leg', required : _overlay_required)
if leg.found()
leg_file = custom_target('tracepoint_format',
output: 'tracepoint_format.h',
@@ -62,10 +81,17 @@ else
message('WARNING: leg command not found, disabling overlay; try : apt-get install peg')
endif
-if leg.found() and xrandr.found() and cairo.found()
+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)
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 += 'Overlay backends: ' + ','.join(backends_strings)
+else
+ if _overlay_required
+ error('Cannot build overlay due to missing dependencies')
+ endif
+ build_info += 'Build overlay: No'
endif