OSDN Git Service

meson: use .require() and .disable_auto_if() method for features
authorPaolo Bonzini <pbonzini@redhat.com>
Sat, 18 Dec 2021 15:39:43 +0000 (16:39 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 16 Feb 2022 14:01:33 +0000 (15:01 +0100)
commita436d6d4126d59e7373e6887c7bd02701ce1156c
tree1e7fc15c60c241f5872261f91b5091bf2e663fa7
parent43a363ae35f4a04bfb86e0ad033d33ef83514597
meson: use .require() and .disable_auto_if() method for features

The method is now in 0.59, using it simplifies some conditionals.

There is a small change, which is to build virtfs-proxy-helper in a
tools-only build.  This is done for consistency with other tools,
which are not culled by the absence of system emulator binaries.

.disable_auto_if() would also be useful to check for packages,
for example

-linux_io_uring = not_found
-if not get_option('linux_io_uring').auto() or have_block
-  linux_io_uring = dependency('liburing', required: get_option('linux_io_uring'),
-                              method: 'pkg-config', kwargs: static_kwargs)
-endif
+linux_io_uring = dependency('liburing',
+  required: get_option('linux_io_uring').disable_auto_if(not have_block),
+  method: 'pkg-config', kwargs: static_kwargs)

This change however is much larger and I am not sure about the improved
readability, so I am not performing it right now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
meson.build
tools/meson.build