David Marchand f01ca13fca examples: skip build when missing dependencies
Trying to disable the vhost library, meson will complain it can't build
the vhost* and vdpa examples when passing -Dexamples=all.

-Dexamples=all skips examples if the example itself announces it can't
be built (for external dependencies, internal dependencies and other
reasons).
Since examples/meson.build will evaluate the internal dependencies
in any case, let's move the check there and resolve the issue for
optional internal libraries.

Fixes: 0bf583222297 ("lib: allow disabling optional libraries")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-11-10 11:42:34 +01:00

49 lines
1.1 KiB
Meson

# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation
# meson file, for building this example as part of a main DPDK build.
#
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
deps += ['power']
if dpdk_conf.has('RTE_NET_BNXT')
deps += ['net_bnxt']
endif
if dpdk_conf.has('RTE_NET_I40E')
deps += ['net_i40e']
endif
if dpdk_conf.has('RTE_NET_IXGBE')
deps += ['net_ixgbe']
endif
allow_experimental_apis = true
sources = files(
'channel_manager.c',
'channel_monitor.c',
'main.c',
'parse.c',
'power_manager.c',
'vm_power_cli.c',
)
# If we're on X86, pull in the x86 code for the branch monitor algo.
if dpdk_conf.has('RTE_ARCH_X86_64')
sources += files('oob_monitor_x86.c')
else
sources += files('oob_monitor_nop.c')
endif
opt_dep = cc.find_library('virt', required : false)
build = opt_dep.found()
ext_deps += opt_dep
opt_dep = dependency('jansson', required : false, method: 'pkg-config')
if opt_dep.found()
ext_deps += opt_dep
cflags += '-DUSE_JANSSON'
endif