* [igt-dev] [PATCH i-g-t 1/1] meson: Add options to control optional parts
@ 2018-06-20 14:10 Petri Latvala
2018-06-20 16:04 ` Daniel Vetter
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Petri Latvala @ 2018-06-20 14:10 UTC (permalink / raw)
To: igt-dev; +Cc: Matt Turner, Daniel Vetter
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.
Note, the old hack for not building docs when cross-compiling is
gone, as doc building can be explicitly controlled now.
As a drive-by fix, building without glib actually works again.
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>
---
Matt, does this match your expectations?
Eric, forewarning about the cross-compiling and documentation.
benchmarks/meson.build | 4 +-
lib/meson.build | 5 +-
man/meson.build | 10 +++-
meson.build | 156 +++++++++++++++++++++++++++++++++++++++++--------
meson_options.txt | 60 +++++++++++++++++++
overlay/meson.build | 46 +++++++++++----
tests/meson.build | 18 +++---
tools/meson.build | 2 +-
8 files changed, 254 insertions(+), 47 deletions(-)
diff --git a/benchmarks/meson.build b/benchmarks/meson.build
index 27836c1d..baf1243d 100644
--- a/benchmarks/meson.build
+++ b/benchmarks/meson.build
@@ -35,10 +35,10 @@ foreach prog : benchmark_progs
executable(prog + '_bench', prog + '.c',
install : true,
install_dir : benchmarksdir,
- dependencies : test_deps)
+ dependencies : igt_deps)
endforeach
executable('gem_wsim_bench', 'gem_wsim.c',
install : true,
install_dir : benchmarksdir,
- dependencies : test_deps + [ lib_igt_perf ])
+ dependencies : igt_deps + [ lib_igt_perf ])
diff --git a/lib/meson.build b/lib/meson.build
index 1a355414..5ef9b1a8 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -52,7 +52,6 @@ lib_sources = [
lib_deps = [
cairo,
- glib,
libdrm,
libkmod,
libprocps,
@@ -64,6 +63,10 @@ lib_deps = [
realtime,
]
+if glib.found()
+ lib_deps += glib
+endif
+
if libdrm_intel.found()
lib_deps += libdrm_intel
else
diff --git a/man/meson.build b/man/meson.build
index 49b0686a..fa01f9dd 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -22,10 +22,10 @@ defs_rst = configure_file(input : 'defs.rst.in',
output : 'defs.rst',
configuration : config)
-rst2man = find_program('rst2man', required : false)
+rst2man = find_program('rst2man', required : _man_required)
rst2man_script = find_program('rst2man.sh')
-if rst2man.found()
+if _build_man and rst2man.found()
foreach manpage : manpages
custom_target(manpage + '.1',
build_by_default : true,
@@ -36,4 +36,10 @@ if rst2man.found()
install : true,
install_dir : join_paths(mandir, 'man1'))
endforeach
+ build_info += 'Build man pages: Yes'
+else
+ if _man_required
+ error('Cannot build man pages due to missing dependencies')
+ endif
+ build_info += 'Build man pages: No'
endif
diff --git a/meson.build b/meson.build
index cd736d8e..c2c29b85 100644
--- a/meson.build
+++ b/meson.build
@@ -26,39 +26,129 @@ foreach cc_arg : cc_args
endif
endforeach
+_build_overlay = false
+_overlay_required = false
+_build_man = false
+_man_required = false
+_build_audio = false
+_audio_required = false
+_build_chamelium = false
+_chamelium_required = false
+_build_docs = false
+_docs_required = false
+_build_tests = false
+_tests_required = false
+
+build_overlay = get_option('build_overlay')
+overlay_backends = get_option('overlay_backends')
+build_man = get_option('build_man')
+with_valgrind = get_option('with_valgrind')
+with_glib = get_option('with_glib')
+build_audio = get_option('build_audio')
+build_chamelium = get_option('build_chamelium')
+build_docs = get_option('build_docs')
+build_tests = get_option('build_tests')
+with_libdrm = get_option('with_libdrm')
+
+_build_overlay = build_overlay != 'false'
+_overlay_required = build_overlay == 'true'
+_build_man = build_man != 'false'
+_man_required = build_man == 'true'
+_build_audio = build_audio != 'false'
+_audio_required = build_audio == 'true'
+_build_chamelium = build_chamelium != 'false'
+_chamelium_required = build_chamelium == 'true'
+_build_docs = build_docs != 'false'
+_docs_required = build_docs == 'true'
+_build_tests = build_tests != 'false'
+_tests_required = build_tests == 'true'
+
+build_info = []
+
inc = include_directories('include/drm-uapi', 'lib', '.')
inc_for_gtkdoc = include_directories('lib')
config = configuration_data()
+null_dep = dependency('', required : false)
+
+libdrm_info = []
+libdrm_intel = null_dep
+libdrm_nouveau = null_dep
+libdrm_amdgpu = null_dep
+
libdrm_version = '>=2.4.82'
libdrm = dependency('libdrm', version : libdrm_version)
-libdrm_intel = dependency('libdrm_intel', version : libdrm_version, required : false)
-libdrm_nouveau = dependency('libdrm_nouveau', version : libdrm_version, required : false)
-libdrm_amdgpu = dependency('libdrm_amdgpu', version : libdrm_version, required : false)
+if with_libdrm.contains('auto') or with_libdrm.contains('intel')
+ libdrm_intel = dependency('libdrm_intel', version : libdrm_version, required : with_libdrm.contains('intel'))
+ libdrm_info += 'intel'
+endif
+if with_libdrm.contains('auto') or with_libdrm.contains('nouveau')
+ libdrm_nouveau = dependency('libdrm_nouveau', version : libdrm_version, required : with_libdrm.contains('nouveau'))
+ libdrm_info += 'nouveau'
+endif
+if with_libdrm.contains('auto') or with_libdrm.contains('amdgpu')
+ libdrm_amdgpu = dependency('libdrm_amdgpu', version : libdrm_version, required : with_libdrm.contains('amdgpu'))
+ libdrm_info += 'amdgpu'
+endif
+
+build_info += 'With libdrm: ' + ','.join(libdrm_info)
pciaccess = dependency('pciaccess', version : '>=0.10')
libkmod = dependency('libkmod')
libprocps = dependency('libprocps', required : true)
libunwind = dependency('libunwind', required : true)
-valgrind = dependency('valgrind', required : false)
-if valgrind.found()
- config.set('HAVE_VALGRIND', 1)
+valgrind = null_dep
+valgrindinfo = 'No'
+if with_valgrind != 'false'
+ valgrind = dependency('valgrind', required : with_valgrind == 'true')
+ if valgrind.found()
+ config.set('HAVE_VALGRIND', 1)
+ valgrindinfo = 'Yes'
+ endif
endif
+build_info += 'Valgrind annotations: ' + valgrindinfo
cairo = dependency('cairo', version : '>1.12.0', required : true)
libudev = dependency('libudev', required : true)
-glib = dependency('glib-2.0', required : false)
-if glib.found()
- config.set('HAVE_GLIB', 1)
+
+glib = null_dep
+glibinfo = 'No'
+if with_glib != 'false'
+ glib = dependency('glib-2.0', required : with_glib == 'true')
+ if glib.found()
+ config.set('HAVE_GLIB', 1)
+ glibinfo = 'Yes'
+ endif
+endif
+build_info += 'Use GLib: ' + glibinfo
+
+gsl = null_dep
+alsa = null_dep
+pixman = null_dep
+if _build_audio or _build_chamelium
+ gsl = dependency('gsl', required : _audio_required or _chamelium_required)
+endif
+if _build_audio
+ alsa = dependency('alsa', required : _audio_required)
+endif
+if _build_chamelium
+ pixman = dependency('pixman-1', required : _chamelium_required)
endif
-gsl = dependency('gsl', required : false)
-alsa = dependency('alsa', required : false)
+audioinfo = 'No'
+if _build_audio and alsa.found() and gsl.found()
+ audioinfo = 'Yes'
+else
+ if _audio_required
+ error('Cannot build audio test due to missing dependencies')
+ endif
+ _build_audio = false
+endif
+build_info += 'Build audio test: ' + audioinfo
-pixman = dependency('pixman-1', required : false)
xmlrpc = dependency('xmlrpc', required : false)
xmlrpc_util = dependency('xmlrpc_util', required : false)
xmlrpc_client = dependency('xmlrpc_client', required : false)
@@ -76,13 +166,17 @@ if not xmlrpc.found() and xmlrpc_cmd.found()
endif
endif
-if pixman.found() and gsl.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()
+chamelium = null_dep
+chameliuminfo = 'No'
+if _build_chamelium and pixman.found() and gsl.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found() and glib.found()
chamelium = declare_dependency(dependencies : [ pixman, xmlrpc,
- xmlrpc_util, xmlrpc_client])
+ xmlrpc_util, xmlrpc_client])
config.set('HAVE_CHAMELIUM', 1)
-else
- chamelium = dependency('', required: false)
+ chameliuminfo = 'Yes'
+elif _chamelium_required
+ error('Cannot build chamelium test due to missing dependencies')
endif
+build_info += 'Build Chamelium test: ' + chameliuminfo
pthreads = dependency('threads')
math = cc.find_library('m')
@@ -133,17 +227,33 @@ mandir = get_option('mandir')
pkgconfigdir = join_paths(libdir, 'pkgconfig')
subdir('lib')
-subdir('tests')
+if _build_tests
+ subdir('tests')
+ build_info += 'Build tests: Yes'
+else
+ build_info += 'Build tests: No'
+endif
subdir('benchmarks')
subdir('tools')
if libdrm_intel.found()
subdir('assembler')
- if ['x86', 'x86_64'].contains(host_machine.cpu_family())
- subdir('overlay')
- endif
endif
+subdir('overlay')
subdir('man')
-# has_exe_wrapper() is undefined if building natively
-if not meson.is_cross_build() or not meson.has_exe_wrapper()
- subdir('docs')
+
+docs_info = 'No'
+if _build_docs
+ if _build_tests
+ subdir('docs')
+ docs_info = 'Yes'
+ elif _docs_required
+ error('Documentation requires building tests')
+ endif
endif
+build_info += 'Build documentation: ' + docs_info
+
+message('Build options')
+message('=============')
+foreach str : build_info
+ message(str)
+endforeach
diff --git a/meson_options.txt b/meson_options.txt
index 41be35e0..9ff2fd96 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,63 @@
+option('build_overlay',
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
+ description : 'Build overlay')
+
+option('overlay_backends',
+ type : 'array',
+ value : ['auto'],
+ choices : [ 'auto', 'x', 'xv' ],
+ description : 'Overlay backends to enable')
+
+option('build_audio',
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
+ description : 'Build audio test')
+
+option('build_chamelium',
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
+ description : 'Build chamelium test')
+
+option('with_valgrind',
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
+ description : 'Build with support for valgrind annotations')
+
+option('with_glib',
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
+ description : 'Link with GLib')
+
+option('build_man',
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
+ description : 'Build man pages')
+
+option('build_docs',
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
+ description : 'Build documentation')
+
+option('build_tests',
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
+ description : 'Build tests')
+
+option('with_libdrm',
+ type : 'array',
+ value : ['auto'],
+ choices : ['', 'auto', 'intel', 'nouveau', 'amdgpu'],
+ description : 'libdrm libraries to be used')
+
option('use_rpath',
type : 'boolean',
value : false,
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
diff --git a/tests/meson.build b/tests/meson.build
index cedb4ff1..ec36bafa 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -232,14 +232,14 @@ if libdrm_nouveau.found()
test_deps += libdrm_nouveau
endif
-if chamelium.found()
+if _build_chamelium and chamelium.found()
test_progs += [
'kms_chamelium',
]
test_deps += chamelium
endif
-if alsa.found() and gsl.found()
+if _build_audio and alsa.found() and gsl.found()
test_progs += [
'audio',
]
@@ -292,12 +292,14 @@ test_executables += executable('perf_pmu', 'perf_pmu.c',
install : true)
test_progs += 'perf_pmu'
-executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
- dependencies : test_deps,
- install_dir : libexecdir,
- install_rpath : rpathdir,
- install : true)
-test_progs += 'testdisplay'
+if glib.found()
+ executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
+ dependencies : test_deps,
+ install_dir : libexecdir,
+ install_rpath : rpathdir,
+ install : true)
+ test_progs += 'testdisplay'
+endif
subdir('amdgpu')
diff --git a/tools/meson.build b/tools/meson.build
index 8ed1ccf4..1c8f44fd 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -78,7 +78,7 @@ foreach prog : tools_progs
install : true)
endforeach
-if libudev.found()
+if libudev.found() and glib.found()
intel_dp_compliance_src = [
'intel_dp_compliance.c',
'intel_dp_compliance_hotplug.c'
--
2.14.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/1] meson: Add options to control optional parts
2018-06-20 14:10 [igt-dev] [PATCH i-g-t 1/1] meson: Add options to control optional parts Petri Latvala
@ 2018-06-20 16:04 ` Daniel Vetter
2018-06-20 16:39 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2018-06-20 16:04 UTC (permalink / raw)
To: Petri Latvala; +Cc: igt-dev, Matt Turner, Daniel Vetter
On Wed, Jun 20, 2018 at 05:10:38PM +0300, Petri Latvala wrote:
> 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.
>
> Note, the old hack for not building docs when cross-compiling is
> gone, as doc building can be explicitly controlled now.
>
> As a drive-by fix, building without glib actually works again.
>
> 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>
> ---
>
> Matt, does this match your expectations?
>
> Eric, forewarning about the cross-compiling and documentation.
Just a quick comment on this: The cross-compiling was due to the
build_by_default hack, and the need to run the cross-compiled binaries in
qemu using emulation. Which is dead slow. With the build_by_default hack
gone, this shouldn't be an issue anymore.
-Daniel
>
>
> benchmarks/meson.build | 4 +-
> lib/meson.build | 5 +-
> man/meson.build | 10 +++-
> meson.build | 156 +++++++++++++++++++++++++++++++++++++++++--------
> meson_options.txt | 60 +++++++++++++++++++
> overlay/meson.build | 46 +++++++++++----
> tests/meson.build | 18 +++---
> tools/meson.build | 2 +-
> 8 files changed, 254 insertions(+), 47 deletions(-)
>
> diff --git a/benchmarks/meson.build b/benchmarks/meson.build
> index 27836c1d..baf1243d 100644
> --- a/benchmarks/meson.build
> +++ b/benchmarks/meson.build
> @@ -35,10 +35,10 @@ foreach prog : benchmark_progs
> executable(prog + '_bench', prog + '.c',
> install : true,
> install_dir : benchmarksdir,
> - dependencies : test_deps)
> + dependencies : igt_deps)
> endforeach
>
> executable('gem_wsim_bench', 'gem_wsim.c',
> install : true,
> install_dir : benchmarksdir,
> - dependencies : test_deps + [ lib_igt_perf ])
> + dependencies : igt_deps + [ lib_igt_perf ])
> diff --git a/lib/meson.build b/lib/meson.build
> index 1a355414..5ef9b1a8 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -52,7 +52,6 @@ lib_sources = [
>
> lib_deps = [
> cairo,
> - glib,
> libdrm,
> libkmod,
> libprocps,
> @@ -64,6 +63,10 @@ lib_deps = [
> realtime,
> ]
>
> +if glib.found()
> + lib_deps += glib
> +endif
> +
> if libdrm_intel.found()
> lib_deps += libdrm_intel
> else
> diff --git a/man/meson.build b/man/meson.build
> index 49b0686a..fa01f9dd 100644
> --- a/man/meson.build
> +++ b/man/meson.build
> @@ -22,10 +22,10 @@ defs_rst = configure_file(input : 'defs.rst.in',
> output : 'defs.rst',
> configuration : config)
>
> -rst2man = find_program('rst2man', required : false)
> +rst2man = find_program('rst2man', required : _man_required)
> rst2man_script = find_program('rst2man.sh')
>
> -if rst2man.found()
> +if _build_man and rst2man.found()
> foreach manpage : manpages
> custom_target(manpage + '.1',
> build_by_default : true,
> @@ -36,4 +36,10 @@ if rst2man.found()
> install : true,
> install_dir : join_paths(mandir, 'man1'))
> endforeach
> + build_info += 'Build man pages: Yes'
> +else
> + if _man_required
> + error('Cannot build man pages due to missing dependencies')
> + endif
> + build_info += 'Build man pages: No'
> endif
> diff --git a/meson.build b/meson.build
> index cd736d8e..c2c29b85 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -26,39 +26,129 @@ foreach cc_arg : cc_args
> endif
> endforeach
>
> +_build_overlay = false
> +_overlay_required = false
> +_build_man = false
> +_man_required = false
> +_build_audio = false
> +_audio_required = false
> +_build_chamelium = false
> +_chamelium_required = false
> +_build_docs = false
> +_docs_required = false
> +_build_tests = false
> +_tests_required = false
> +
> +build_overlay = get_option('build_overlay')
> +overlay_backends = get_option('overlay_backends')
> +build_man = get_option('build_man')
> +with_valgrind = get_option('with_valgrind')
> +with_glib = get_option('with_glib')
> +build_audio = get_option('build_audio')
> +build_chamelium = get_option('build_chamelium')
> +build_docs = get_option('build_docs')
> +build_tests = get_option('build_tests')
> +with_libdrm = get_option('with_libdrm')
> +
> +_build_overlay = build_overlay != 'false'
> +_overlay_required = build_overlay == 'true'
> +_build_man = build_man != 'false'
> +_man_required = build_man == 'true'
> +_build_audio = build_audio != 'false'
> +_audio_required = build_audio == 'true'
> +_build_chamelium = build_chamelium != 'false'
> +_chamelium_required = build_chamelium == 'true'
> +_build_docs = build_docs != 'false'
> +_docs_required = build_docs == 'true'
> +_build_tests = build_tests != 'false'
> +_tests_required = build_tests == 'true'
> +
> +build_info = []
> +
> inc = include_directories('include/drm-uapi', 'lib', '.')
>
> inc_for_gtkdoc = include_directories('lib')
>
> config = configuration_data()
>
> +null_dep = dependency('', required : false)
> +
> +libdrm_info = []
> +libdrm_intel = null_dep
> +libdrm_nouveau = null_dep
> +libdrm_amdgpu = null_dep
> +
> libdrm_version = '>=2.4.82'
> libdrm = dependency('libdrm', version : libdrm_version)
> -libdrm_intel = dependency('libdrm_intel', version : libdrm_version, required : false)
> -libdrm_nouveau = dependency('libdrm_nouveau', version : libdrm_version, required : false)
> -libdrm_amdgpu = dependency('libdrm_amdgpu', version : libdrm_version, required : false)
> +if with_libdrm.contains('auto') or with_libdrm.contains('intel')
> + libdrm_intel = dependency('libdrm_intel', version : libdrm_version, required : with_libdrm.contains('intel'))
> + libdrm_info += 'intel'
> +endif
> +if with_libdrm.contains('auto') or with_libdrm.contains('nouveau')
> + libdrm_nouveau = dependency('libdrm_nouveau', version : libdrm_version, required : with_libdrm.contains('nouveau'))
> + libdrm_info += 'nouveau'
> +endif
> +if with_libdrm.contains('auto') or with_libdrm.contains('amdgpu')
> + libdrm_amdgpu = dependency('libdrm_amdgpu', version : libdrm_version, required : with_libdrm.contains('amdgpu'))
> + libdrm_info += 'amdgpu'
> +endif
> +
> +build_info += 'With libdrm: ' + ','.join(libdrm_info)
>
> pciaccess = dependency('pciaccess', version : '>=0.10')
> libkmod = dependency('libkmod')
> libprocps = dependency('libprocps', required : true)
> libunwind = dependency('libunwind', required : true)
>
> -valgrind = dependency('valgrind', required : false)
> -if valgrind.found()
> - config.set('HAVE_VALGRIND', 1)
> +valgrind = null_dep
> +valgrindinfo = 'No'
> +if with_valgrind != 'false'
> + valgrind = dependency('valgrind', required : with_valgrind == 'true')
> + if valgrind.found()
> + config.set('HAVE_VALGRIND', 1)
> + valgrindinfo = 'Yes'
> + endif
> endif
> +build_info += 'Valgrind annotations: ' + valgrindinfo
>
> cairo = dependency('cairo', version : '>1.12.0', required : true)
> libudev = dependency('libudev', required : true)
> -glib = dependency('glib-2.0', required : false)
> -if glib.found()
> - config.set('HAVE_GLIB', 1)
> +
> +glib = null_dep
> +glibinfo = 'No'
> +if with_glib != 'false'
> + glib = dependency('glib-2.0', required : with_glib == 'true')
> + if glib.found()
> + config.set('HAVE_GLIB', 1)
> + glibinfo = 'Yes'
> + endif
> +endif
> +build_info += 'Use GLib: ' + glibinfo
> +
> +gsl = null_dep
> +alsa = null_dep
> +pixman = null_dep
> +if _build_audio or _build_chamelium
> + gsl = dependency('gsl', required : _audio_required or _chamelium_required)
> +endif
> +if _build_audio
> + alsa = dependency('alsa', required : _audio_required)
> +endif
> +if _build_chamelium
> + pixman = dependency('pixman-1', required : _chamelium_required)
> endif
>
> -gsl = dependency('gsl', required : false)
> -alsa = dependency('alsa', required : false)
> +audioinfo = 'No'
> +if _build_audio and alsa.found() and gsl.found()
> + audioinfo = 'Yes'
> +else
> + if _audio_required
> + error('Cannot build audio test due to missing dependencies')
> + endif
> + _build_audio = false
> +endif
> +build_info += 'Build audio test: ' + audioinfo
>
> -pixman = dependency('pixman-1', required : false)
> xmlrpc = dependency('xmlrpc', required : false)
> xmlrpc_util = dependency('xmlrpc_util', required : false)
> xmlrpc_client = dependency('xmlrpc_client', required : false)
> @@ -76,13 +166,17 @@ if not xmlrpc.found() and xmlrpc_cmd.found()
> endif
> endif
>
> -if pixman.found() and gsl.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()
> +chamelium = null_dep
> +chameliuminfo = 'No'
> +if _build_chamelium and pixman.found() and gsl.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found() and glib.found()
> chamelium = declare_dependency(dependencies : [ pixman, xmlrpc,
> - xmlrpc_util, xmlrpc_client])
> + xmlrpc_util, xmlrpc_client])
> config.set('HAVE_CHAMELIUM', 1)
> -else
> - chamelium = dependency('', required: false)
> + chameliuminfo = 'Yes'
> +elif _chamelium_required
> + error('Cannot build chamelium test due to missing dependencies')
> endif
> +build_info += 'Build Chamelium test: ' + chameliuminfo
>
> pthreads = dependency('threads')
> math = cc.find_library('m')
> @@ -133,17 +227,33 @@ mandir = get_option('mandir')
> pkgconfigdir = join_paths(libdir, 'pkgconfig')
>
> subdir('lib')
> -subdir('tests')
> +if _build_tests
> + subdir('tests')
> + build_info += 'Build tests: Yes'
> +else
> + build_info += 'Build tests: No'
> +endif
> subdir('benchmarks')
> subdir('tools')
> if libdrm_intel.found()
> subdir('assembler')
> - if ['x86', 'x86_64'].contains(host_machine.cpu_family())
> - subdir('overlay')
> - endif
> endif
> +subdir('overlay')
> subdir('man')
> -# has_exe_wrapper() is undefined if building natively
> -if not meson.is_cross_build() or not meson.has_exe_wrapper()
> - subdir('docs')
> +
> +docs_info = 'No'
> +if _build_docs
> + if _build_tests
> + subdir('docs')
> + docs_info = 'Yes'
> + elif _docs_required
> + error('Documentation requires building tests')
> + endif
> endif
> +build_info += 'Build documentation: ' + docs_info
> +
> +message('Build options')
> +message('=============')
> +foreach str : build_info
> + message(str)
> +endforeach
> diff --git a/meson_options.txt b/meson_options.txt
> index 41be35e0..9ff2fd96 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -1,3 +1,63 @@
> +option('build_overlay',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build overlay')
> +
> +option('overlay_backends',
> + type : 'array',
> + value : ['auto'],
> + choices : [ 'auto', 'x', 'xv' ],
> + description : 'Overlay backends to enable')
> +
> +option('build_audio',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build audio test')
> +
> +option('build_chamelium',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build chamelium test')
> +
> +option('with_valgrind',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build with support for valgrind annotations')
> +
> +option('with_glib',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Link with GLib')
> +
> +option('build_man',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build man pages')
> +
> +option('build_docs',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build documentation')
> +
> +option('build_tests',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build tests')
> +
> +option('with_libdrm',
> + type : 'array',
> + value : ['auto'],
> + choices : ['', 'auto', 'intel', 'nouveau', 'amdgpu'],
> + description : 'libdrm libraries to be used')
> +
> option('use_rpath',
> type : 'boolean',
> value : false,
> 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
> diff --git a/tests/meson.build b/tests/meson.build
> index cedb4ff1..ec36bafa 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -232,14 +232,14 @@ if libdrm_nouveau.found()
> test_deps += libdrm_nouveau
> endif
>
> -if chamelium.found()
> +if _build_chamelium and chamelium.found()
> test_progs += [
> 'kms_chamelium',
> ]
> test_deps += chamelium
> endif
>
> -if alsa.found() and gsl.found()
> +if _build_audio and alsa.found() and gsl.found()
> test_progs += [
> 'audio',
> ]
> @@ -292,12 +292,14 @@ test_executables += executable('perf_pmu', 'perf_pmu.c',
> install : true)
> test_progs += 'perf_pmu'
>
> -executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
> - dependencies : test_deps,
> - install_dir : libexecdir,
> - install_rpath : rpathdir,
> - install : true)
> -test_progs += 'testdisplay'
> +if glib.found()
> + executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
> + dependencies : test_deps,
> + install_dir : libexecdir,
> + install_rpath : rpathdir,
> + install : true)
> + test_progs += 'testdisplay'
> +endif
>
> subdir('amdgpu')
>
> diff --git a/tools/meson.build b/tools/meson.build
> index 8ed1ccf4..1c8f44fd 100644
> --- a/tools/meson.build
> +++ b/tools/meson.build
> @@ -78,7 +78,7 @@ foreach prog : tools_progs
> install : true)
> endforeach
>
> -if libudev.found()
> +if libudev.found() and glib.found()
> intel_dp_compliance_src = [
> 'intel_dp_compliance.c',
> 'intel_dp_compliance_hotplug.c'
> --
> 2.14.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] meson: Add options to control optional parts
2018-06-20 14:10 [igt-dev] [PATCH i-g-t 1/1] meson: Add options to control optional parts Petri Latvala
2018-06-20 16:04 ` Daniel Vetter
@ 2018-06-20 16:39 ` Patchwork
2018-06-20 22:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-06-21 7:34 ` [igt-dev] [PATCH i-g-t 1/1] " Daniel Vetter
3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-06-20 16:39 UTC (permalink / raw)
To: Petri Latvala; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,1/1] meson: Add options to control optional parts
URL : https://patchwork.freedesktop.org/series/45092/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4348 -> IGTPW_1491 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/45092/revisions/1/mbox/
== Known issues ==
Here are the changes found in IGTPW_1491 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
fi-bxt-dsi: PASS -> INCOMPLETE (fdo#103927)
==== Possible fixes ====
igt@drv_module_reload@basic-reload:
fi-glk-j4005: DMESG-WARN (fdo#106725, fdo#106248) -> PASS
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#106248 https://bugs.freedesktop.org/show_bug.cgi?id=106248
fdo#106725 https://bugs.freedesktop.org/show_bug.cgi?id=106725
== Participating hosts (44 -> 38) ==
Additional (1): fi-hsw-peppy
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-glk-dsi fi-bsw-cyan fi-ctg-p8600 fi-kbl-x1275
== Build changes ==
* IGT: IGT_4526 -> IGTPW_1491
CI_DRM_4348: 3a2fbf8fe32d909c5d44e61e7d212ae694e9e473 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1491: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1491/
IGT_4526: 4bbfb4fb14b3deab9bc4db9911280b35c22b718c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1491/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] meson: Add options to control optional parts
2018-06-20 14:10 [igt-dev] [PATCH i-g-t 1/1] meson: Add options to control optional parts Petri Latvala
2018-06-20 16:04 ` Daniel Vetter
2018-06-20 16:39 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
@ 2018-06-20 22:28 ` Patchwork
2018-06-21 7:34 ` [igt-dev] [PATCH i-g-t 1/1] " Daniel Vetter
3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-06-20 22:28 UTC (permalink / raw)
To: Petri Latvala; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,1/1] meson: Add options to control optional parts
URL : https://patchwork.freedesktop.org/series/45092/
State : success
== Summary ==
= CI Bug Log - changes from IGT_4526_full -> IGTPW_1491_full =
== Summary - WARNING ==
Minor unknown changes coming with IGTPW_1491_full need to be verified
manually.
If you think the reported changes have nothing to do with the changes
introduced in IGTPW_1491_full, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/45092/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_1491_full:
=== IGT changes ===
==== Warnings ====
igt@pm_rc6_residency@rc6-accuracy:
shard-kbl: SKIP -> PASS
== Known issues ==
Here are the changes found in IGTPW_1491_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_selftest@live_hangcheck:
shard-apl: PASS -> DMESG-FAIL (fdo#106560, fdo#106947)
igt@gem_exec_schedule@deep-vebox:
shard-snb: SKIP -> INCOMPLETE (fdo#105411)
igt@gem_exec_schedule@pi-ringfull-vebox:
shard-kbl: NOTRUN -> FAIL (fdo#103158)
igt@gem_ppgtt@blt-vs-render-ctxn:
shard-kbl: PASS -> INCOMPLETE (fdo#103665, fdo#106023)
igt@kms_flip@2x-modeset-vs-vblank-race:
shard-glk: PASS -> FAIL (fdo#103060)
igt@kms_flip@2x-plain-flip-ts-check:
shard-glk: PASS -> FAIL (fdo#100368)
igt@kms_flip_tiling@flip-x-tiled:
shard-glk: PASS -> FAIL (fdo#103822, fdo#104724)
igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-wc:
shard-glk: PASS -> FAIL (fdo#103167, fdo#104724)
igt@kms_rotation_crc@sprite-rotation-180:
shard-snb: PASS -> FAIL (fdo#103925, fdo#104724)
igt@kms_setmode@basic:
shard-apl: PASS -> FAIL (fdo#99912)
==== Possible fixes ====
igt@drv_selftest@live_hangcheck:
shard-glk: DMESG-FAIL (fdo#106560, fdo#106947) -> PASS
igt@kms_flip@2x-flip-vs-expired-vblank:
shard-glk: FAIL (fdo#102887) -> PASS
igt@kms_flip@plain-flip-ts-check:
shard-glk: FAIL (fdo#100368) -> PASS
igt@kms_flip_tiling@flip-to-y-tiled:
shard-glk: FAIL (fdo#103822, fdo#104724) -> PASS
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-msflip-blt:
shard-snb: INCOMPLETE (fdo#105411) -> PASS
igt@pm_rpm@system-suspend-execbuf:
shard-kbl: INCOMPLETE (fdo#103665) -> PASS
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
fdo#106947 https://bugs.freedesktop.org/show_bug.cgi?id=106947
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
== Participating hosts (5 -> 5) ==
No changes in participating hosts
== Build changes ==
* IGT: IGT_4526 -> IGTPW_1491
* Linux: CI_DRM_4347 -> CI_DRM_4348
CI_DRM_4347: 5b7806eb03ba0ce0c1bfe75b2e303506c076965d @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4348: 3a2fbf8fe32d909c5d44e61e7d212ae694e9e473 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1491: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1491/
IGT_4526: 4bbfb4fb14b3deab9bc4db9911280b35c22b718c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1491/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/1] meson: Add options to control optional parts
2018-06-20 14:10 [igt-dev] [PATCH i-g-t 1/1] meson: Add options to control optional parts Petri Latvala
` (2 preceding siblings ...)
2018-06-20 22:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2018-06-21 7:34 ` Daniel Vetter
3 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2018-06-21 7:34 UTC (permalink / raw)
To: Petri Latvala; +Cc: igt-dev, Matt Turner, Daniel Vetter
On Wed, Jun 20, 2018 at 05:10:38PM +0300, Petri Latvala wrote:
> 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.
>
> Note, the old hack for not building docs when cross-compiling is
> gone, as doc building can be explicitly controlled now.
>
> As a drive-by fix, building without glib actually works again.
Do we have real demand for that even? I'd lean the other way, and do a
prep patch that removes all the glib.found() checks. Making glib optional
was for the Android folks iirc, and we've dropped that support on the
floor a while ago I think.
But I'm also ok with fixing this, but then it should also be a prep patch.
> 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>
> ---
>
> Matt, does this match your expectations?
>
> Eric, forewarning about the cross-compiling and documentation.
>
>
> benchmarks/meson.build | 4 +-
> lib/meson.build | 5 +-
> man/meson.build | 10 +++-
> meson.build | 156 +++++++++++++++++++++++++++++++++++++++++--------
> meson_options.txt | 60 +++++++++++++++++++
> overlay/meson.build | 46 +++++++++++----
> tests/meson.build | 18 +++---
> tools/meson.build | 2 +-
> 8 files changed, 254 insertions(+), 47 deletions(-)
>
> diff --git a/benchmarks/meson.build b/benchmarks/meson.build
> index 27836c1d..baf1243d 100644
> --- a/benchmarks/meson.build
> +++ b/benchmarks/meson.build
> @@ -35,10 +35,10 @@ foreach prog : benchmark_progs
> executable(prog + '_bench', prog + '.c',
> install : true,
> install_dir : benchmarksdir,
> - dependencies : test_deps)
> + dependencies : igt_deps)
> endforeach
>
> executable('gem_wsim_bench', 'gem_wsim.c',
> install : true,
> install_dir : benchmarksdir,
> - dependencies : test_deps + [ lib_igt_perf ])
> + dependencies : igt_deps + [ lib_igt_perf ])
> diff --git a/lib/meson.build b/lib/meson.build
> index 1a355414..5ef9b1a8 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -52,7 +52,6 @@ lib_sources = [
>
> lib_deps = [
> cairo,
> - glib,
> libdrm,
> libkmod,
> libprocps,
> @@ -64,6 +63,10 @@ lib_deps = [
> realtime,
> ]
>
> +if glib.found()
> + lib_deps += glib
> +endif
> +
> if libdrm_intel.found()
> lib_deps += libdrm_intel
> else
> diff --git a/man/meson.build b/man/meson.build
> index 49b0686a..fa01f9dd 100644
> --- a/man/meson.build
> +++ b/man/meson.build
> @@ -22,10 +22,10 @@ defs_rst = configure_file(input : 'defs.rst.in',
> output : 'defs.rst',
> configuration : config)
>
> -rst2man = find_program('rst2man', required : false)
> +rst2man = find_program('rst2man', required : _man_required)
> rst2man_script = find_program('rst2man.sh')
>
gg -if rst2man.found()
> +if _build_man and rst2man.found()
> foreach manpage : manpages
> custom_target(manpage + '.1',
> build_by_default : true,
> @@ -36,4 +36,10 @@ if rst2man.found()
> install : true,
> install_dir : join_paths(mandir, 'man1'))
> endforeach
> + build_info += 'Build man pages: Yes'
> +else
> + if _man_required
> + error('Cannot build man pages due to missing dependencies')
> + endif
> + build_info += 'Build man pages: No'
> endif
> diff --git a/meson.build b/meson.build
> index cd736d8e..c2c29b85 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -26,39 +26,129 @@ foreach cc_arg : cc_args
> endif
> endforeach
>
> +_build_overlay = false
> +_overlay_required = false
> +_build_man = false
> +_man_required = false
> +_build_audio = false
> +_audio_required = false
> +_build_chamelium = false
> +_chamelium_required = false
> +_build_docs = false
> +_docs_required = false
> +_build_tests = false
> +_tests_required = false
> +
> +build_overlay = get_option('build_overlay')
> +overlay_backends = get_option('overlay_backends')
> +build_man = get_option('build_man')
> +with_valgrind = get_option('with_valgrind')
> +with_glib = get_option('with_glib')
> +build_audio = get_option('build_audio')
> +build_chamelium = get_option('build_chamelium')
> +build_docs = get_option('build_docs')
> +build_tests = get_option('build_tests')
> +with_libdrm = get_option('with_libdrm')
> +
> +_build_overlay = build_overlay != 'false'
> +_overlay_required = build_overlay == 'true'
> +_build_man = build_man != 'false'
> +_man_required = build_man == 'true'
> +_build_audio = build_audio != 'false'
> +_audio_required = build_audio == 'true'
> +_build_chamelium = build_chamelium != 'false'
> +_chamelium_required = build_chamelium == 'true'
> +_build_docs = build_docs != 'false'
> +_docs_required = build_docs == 'true'
> +_build_tests = build_tests != 'false'
> +_tests_required = build_tests == 'true'
> +
> +build_info = []
> +
> inc = include_directories('include/drm-uapi', 'lib', '.')
>
> inc_for_gtkdoc = include_directories('lib')
>
> config = configuration_data()
>
> +null_dep = dependency('', required : false)
> +
> +libdrm_info = []
> +libdrm_intel = null_dep
> +libdrm_nouveau = null_dep
> +libdrm_amdgpu = null_dep
> +
> libdrm_version = '>=2.4.82'
> libdrm = dependency('libdrm', version : libdrm_version)
> -libdrm_intel = dependency('libdrm_intel', version : libdrm_version, required : false)
> -libdrm_nouveau = dependency('libdrm_nouveau', version : libdrm_version, required : false)
> -libdrm_amdgpu = dependency('libdrm_amdgpu', version : libdrm_version, required : false)
> +if with_libdrm.contains('auto') or with_libdrm.contains('intel')
> + libdrm_intel = dependency('libdrm_intel', version : libdrm_version, required : with_libdrm.contains('intel'))
> + libdrm_info += 'intel'
> +endif
> +if with_libdrm.contains('auto') or with_libdrm.contains('nouveau')
> + libdrm_nouveau = dependency('libdrm_nouveau', version : libdrm_version, required : with_libdrm.contains('nouveau'))
> + libdrm_info += 'nouveau'
> +endif
> +if with_libdrm.contains('auto') or with_libdrm.contains('amdgpu')
> + libdrm_amdgpu = dependency('libdrm_amdgpu', version : libdrm_version, required : with_libdrm.contains('amdgpu'))
> + libdrm_info += 'amdgpu'
> +endif
> +
> +build_info += 'With libdrm: ' + ','.join(libdrm_info)
>
> pciaccess = dependency('pciaccess', version : '>=0.10')
> libkmod = dependency('libkmod')
> libprocps = dependency('libprocps', required : true)
> libunwind = dependency('libunwind', required : true)
>
> -valgrind = dependency('valgrind', required : false)
> -if valgrind.found()
> - config.set('HAVE_VALGRIND', 1)
> +valgrind = null_dep
> +valgrindinfo = 'No'
> +if with_valgrind != 'false'
> + valgrind = dependency('valgrind', required : with_valgrind == 'true')
> + if valgrind.found()
> + config.set('HAVE_VALGRIND', 1)
> + valgrindinfo = 'Yes'
> + endif
> endif
> +build_info += 'Valgrind annotations: ' + valgrindinfo
>
> cairo = dependency('cairo', version : '>1.12.0', required : true)
> libudev = dependency('libudev', required : true)
> -glib = dependency('glib-2.0', required : false)
> -if glib.found()
> - config.set('HAVE_GLIB', 1)
> +
> +glib = null_dep
> +glibinfo = 'No'
> +if with_glib != 'false'
> + glib = dependency('glib-2.0', required : with_glib == 'true')
> + if glib.found()
> + config.set('HAVE_GLIB', 1)
> + glibinfo = 'Yes'
> + endif
> +endif
> +build_info += 'Use GLib: ' + glibinfo
> +
> +gsl = null_dep
> +alsa = null_dep
> +pixman = null_dep
> +if _build_audio or _build_chamelium
> + gsl = dependency('gsl', required : _audio_required or _chamelium_required)
> +endif
> +if _build_audio
> + alsa = dependency('alsa', required : _audio_required)
> +endif
> +if _build_chamelium
> + pixman = dependency('pixman-1', required : _chamelium_required)
> endif
>
> -gsl = dependency('gsl', required : false)
> -alsa = dependency('alsa', required : false)
> +audioinfo = 'No'
> +if _build_audio and alsa.found() and gsl.found()
> + audioinfo = 'Yes'
> +else
> + if _audio_required
> + error('Cannot build audio test due to missing dependencies')
> + endif
> + _build_audio = false
> +endif
> +build_info += 'Build audio test: ' + audioinfo
>
> -pixman = dependency('pixman-1', required : false)
> xmlrpc = dependency('xmlrpc', required : false)
> xmlrpc_util = dependency('xmlrpc_util', required : false)
> xmlrpc_client = dependency('xmlrpc_client', required : false)
> @@ -76,13 +166,17 @@ if not xmlrpc.found() and xmlrpc_cmd.found()
> endif
> endif
>
> -if pixman.found() and gsl.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()
> +chamelium = null_dep
> +chameliuminfo = 'No'
> +if _build_chamelium and pixman.found() and gsl.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found() and glib.found()
> chamelium = declare_dependency(dependencies : [ pixman, xmlrpc,
> - xmlrpc_util, xmlrpc_client])
> + xmlrpc_util, xmlrpc_client])
> config.set('HAVE_CHAMELIUM', 1)
> -else
> - chamelium = dependency('', required: false)
> + chameliuminfo = 'Yes'
> +elif _chamelium_required
> + error('Cannot build chamelium test due to missing dependencies')
> endif
> +build_info += 'Build Chamelium test: ' + chameliuminfo
>
> pthreads = dependency('threads')
> math = cc.find_library('m')
> @@ -133,17 +227,33 @@ mandir = get_option('mandir')
> pkgconfigdir = join_paths(libdir, 'pkgconfig')
>
> subdir('lib')
> -subdir('tests')
> +if _build_tests
> + subdir('tests')
> + build_info += 'Build tests: Yes'
> +else
> + build_info += 'Build tests: No'
> +endif
> subdir('benchmarks')
> subdir('tools')
> if libdrm_intel.found()
> subdir('assembler')
> - if ['x86', 'x86_64'].contains(host_machine.cpu_family())
> - subdir('overlay')
> - endif
> endif
> +subdir('overlay')
> subdir('man')
> -# has_exe_wrapper() is undefined if building natively
> -if not meson.is_cross_build() or not meson.has_exe_wrapper()
> - subdir('docs')
> +
> +docs_info = 'No'
> +if _build_docs
> + if _build_tests
> + subdir('docs')
> + docs_info = 'Yes'
> + elif _docs_required
> + error('Documentation requires building tests')
> + endif
> endif
> +build_info += 'Build documentation: ' + docs_info
> +
> +message('Build options')
> +message('=============')
> +foreach str : build_info
> + message(str)
> +endforeach
> diff --git a/meson_options.txt b/meson_options.txt
> index 41be35e0..9ff2fd96 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -1,3 +1,63 @@
> +option('build_overlay',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build overlay')
> +
> +option('overlay_backends',
> + type : 'array',
This bumbs our requirements to meson 0.44. Previous versions don't work.
Meson 0.44 is from Dec 2017, I think that's too aggressive with forcing an
upgrade.
Otoh mesa also requires 0.44.1 ...
-Daniel
> + value : ['auto'],
> + choices : [ 'auto', 'x', 'xv' ],
> + description : 'Overlay backends to enable')
> +
> +option('build_audio',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build audio test')
> +
> +option('build_chamelium',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build chamelium test')
> +
> +option('with_valgrind',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build with support for valgrind annotations')
> +
> +option('with_glib',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Link with GLib')
> +
> +option('build_man',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build man pages')
> +
> +option('build_docs',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build documentation')
> +
> +option('build_tests',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Build tests')
> +
> +option('with_libdrm',
> + type : 'array',
> + value : ['auto'],
> + choices : ['', 'auto', 'intel', 'nouveau', 'amdgpu'],
> + description : 'libdrm libraries to be used')
> +
> option('use_rpath',
> type : 'boolean',
> value : false,
> 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
> diff --git a/tests/meson.build b/tests/meson.build
> index cedb4ff1..ec36bafa 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -232,14 +232,14 @@ if libdrm_nouveau.found()
> test_deps += libdrm_nouveau
> endif
>
> -if chamelium.found()
> +if _build_chamelium and chamelium.found()
> test_progs += [
> 'kms_chamelium',
> ]
> test_deps += chamelium
> endif
>
> -if alsa.found() and gsl.found()
> +if _build_audio and alsa.found() and gsl.found()
> test_progs += [
> 'audio',
> ]
> @@ -292,12 +292,14 @@ test_executables += executable('perf_pmu', 'perf_pmu.c',
> install : true)
> test_progs += 'perf_pmu'
>
> -executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
> - dependencies : test_deps,
> - install_dir : libexecdir,
> - install_rpath : rpathdir,
> - install : true)
> -test_progs += 'testdisplay'
> +if glib.found()
> + executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
> + dependencies : test_deps,
> + install_dir : libexecdir,
> + install_rpath : rpathdir,
> + install : true)
> + test_progs += 'testdisplay'
> +endif
>
> subdir('amdgpu')
>
> diff --git a/tools/meson.build b/tools/meson.build
> index 8ed1ccf4..1c8f44fd 100644
> --- a/tools/meson.build
> +++ b/tools/meson.build
> @@ -78,7 +78,7 @@ foreach prog : tools_progs
> install : true)
> endforeach
>
> -if libudev.found()
> +if libudev.found() and glib.found()
> intel_dp_compliance_src = [
> 'intel_dp_compliance.c',
> 'intel_dp_compliance_hotplug.c'
> --
> 2.14.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-21 7:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 14:10 [igt-dev] [PATCH i-g-t 1/1] meson: Add options to control optional parts Petri Latvala
2018-06-20 16:04 ` Daniel Vetter
2018-06-20 16:39 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
2018-06-20 22:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-06-21 7:34 ` [igt-dev] [PATCH i-g-t 1/1] " Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox