* [dpdk-dev] [PATCH] examples: skip example when missing dependencies
@ 2021-11-05 13:30 David Marchand
2021-11-05 13:39 ` Bruce Richardson
2021-11-06 8:53 ` [dpdk-dev] [PATCH v2] " David Marchand
0 siblings, 2 replies; 5+ messages in thread
From: David Marchand @ 2021-11-05 13:30 UTC (permalink / raw)
To: dev
Cc: bruce.richardson, ferruh.yigit, thomas, David Hunt,
Maxime Coquelin, Chenbo Xia
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>
---
examples/distributor/meson.build | 6 -----
examples/kni/meson.build | 6 -----
examples/l3fwd-power/meson.build | 5 ----
examples/meson.build | 24 ++++++++++++-------
examples/vhost_crypto/meson.build | 5 ----
.../vm_power_manager/guest_cli/meson.build | 5 ----
examples/vm_power_manager/meson.build | 5 ----
7 files changed, 16 insertions(+), 40 deletions(-)
diff --git a/examples/distributor/meson.build b/examples/distributor/meson.build
index 9df59923ce..ca1eca952e 100644
--- a/examples/distributor/meson.build
+++ b/examples/distributor/meson.build
@@ -6,12 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-# require the power library
-build = dpdk_conf.has('RTE_LIB_POWER')
-if not build
- subdir_done()
-endif
-
allow_experimental_apis = true
deps += ['distributor', 'power']
sources = files(
diff --git a/examples/kni/meson.build b/examples/kni/meson.build
index 1c0bf99a49..6bd4eb50e6 100644
--- a/examples/kni/meson.build
+++ b/examples/kni/meson.build
@@ -6,12 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-# this app can be built if-and-only-if KNI library is buildable
-build = dpdk_conf.has('RTE_LIB_KNI')
-if not build
- subdir_done()
-endif
-
deps += ['kni', 'bus_pci']
sources = files(
'main.c',
diff --git a/examples/l3fwd-power/meson.build b/examples/l3fwd-power/meson.build
index 0f69bb782c..624ef5e947 100644
--- a/examples/l3fwd-power/meson.build
+++ b/examples/l3fwd-power/meson.build
@@ -6,11 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-if not dpdk_conf.has('RTE_LIB_POWER')
- build = false
- subdir_done()
-endif
-
allow_experimental_apis = true
deps += ['power', 'timer', 'lpm', 'hash', 'metrics', 'telemetry']
sources = files(
diff --git a/examples/meson.build b/examples/meson.build
index d50f09db12..35ec3471af 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -104,6 +104,22 @@ foreach example: examples
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
subdir(example)
+ if build
+ dep_objs = ext_deps
+ foreach d:deps
+ if not build
+ break
+ endif
+ var_name = get_option('default_library') + '_rte_' + d
+ if not is_variable(var_name)
+ build = false
+ message('Missing dependency "@0@" for example "@1@"'.format(d, name))
+ else
+ dep_objs += [get_variable(var_name)]
+ endif
+ endforeach
+ endif
+
if not build
if not allow_skips
error('Cannot build requested example "' + name + '"')
@@ -112,14 +128,6 @@ foreach example: examples
continue
endif
- dep_objs = ext_deps
- foreach d:deps
- var_name = get_option('default_library') + '_rte_' + d
- if not is_variable(var_name)
- error('Missing dependency "@0@" for example "@1@"'.format(d, name))
- endif
- dep_objs += [get_variable(var_name)]
- endforeach
if allow_experimental_apis
cflags += '-DALLOW_EXPERIMENTAL_API'
endif
diff --git a/examples/vhost_crypto/meson.build b/examples/vhost_crypto/meson.build
index 720f42dd70..1c294c286f 100644
--- a/examples/vhost_crypto/meson.build
+++ b/examples/vhost_crypto/meson.build
@@ -6,11 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-build = dpdk_conf.has('RTE_LIB_VHOST')
-if not build
- subdir_done()
-endif
-
allow_experimental_apis = true
deps += ['vhost', 'cryptodev']
sources = files(
diff --git a/examples/vm_power_manager/guest_cli/meson.build b/examples/vm_power_manager/guest_cli/meson.build
index 666eef94ae..a69f809e3b 100644
--- a/examples/vm_power_manager/guest_cli/meson.build
+++ b/examples/vm_power_manager/guest_cli/meson.build
@@ -6,11 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-if not dpdk_conf.has('RTE_LIB_POWER')
- build = false
- subdir_done()
-endif
-
deps += ['power']
sources = files(
diff --git a/examples/vm_power_manager/meson.build b/examples/vm_power_manager/meson.build
index c15bad6609..b866d8fd54 100644
--- a/examples/vm_power_manager/meson.build
+++ b/examples/vm_power_manager/meson.build
@@ -6,11 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-if not dpdk_conf.has('RTE_LIB_POWER')
- build = false
- subdir_done()
-endif
-
deps += ['power']
if dpdk_conf.has('RTE_NET_BNXT')
--
2.23.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] examples: skip example when missing dependencies
2021-11-05 13:30 [dpdk-dev] [PATCH] examples: skip example when missing dependencies David Marchand
@ 2021-11-05 13:39 ` Bruce Richardson
2021-11-06 8:49 ` David Marchand
2021-11-06 8:53 ` [dpdk-dev] [PATCH v2] " David Marchand
1 sibling, 1 reply; 5+ messages in thread
From: Bruce Richardson @ 2021-11-05 13:39 UTC (permalink / raw)
To: David Marchand
Cc: dev, ferruh.yigit, thomas, David Hunt, Maxime Coquelin, Chenbo Xia
On Fri, Nov 05, 2021 at 02:30:55PM +0100, David Marchand wrote:
> 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>
One comment inline below, otherwise looks a good change.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> examples/distributor/meson.build | 6 -----
> examples/kni/meson.build | 6 -----
> examples/l3fwd-power/meson.build | 5 ----
> examples/meson.build | 24 ++++++++++++-------
> examples/vhost_crypto/meson.build | 5 ----
> .../vm_power_manager/guest_cli/meson.build | 5 ----
> examples/vm_power_manager/meson.build | 5 ----
> 7 files changed, 16 insertions(+), 40 deletions(-)
>
> diff --git a/examples/distributor/meson.build b/examples/distributor/meson.build
> index 9df59923ce..ca1eca952e 100644
> --- a/examples/distributor/meson.build
> +++ b/examples/distributor/meson.build
> @@ -6,12 +6,6 @@
> # To build this example as a standalone application with an already-installed
> # DPDK instance, use 'make'
>
> -# require the power library
> -build = dpdk_conf.has('RTE_LIB_POWER')
> -if not build
> - subdir_done()
> -endif
> -
> allow_experimental_apis = true
> deps += ['distributor', 'power']
> sources = files(
> diff --git a/examples/kni/meson.build b/examples/kni/meson.build
> index 1c0bf99a49..6bd4eb50e6 100644
> --- a/examples/kni/meson.build
> +++ b/examples/kni/meson.build
> @@ -6,12 +6,6 @@
> # To build this example as a standalone application with an already-installed
> # DPDK instance, use 'make'
>
> -# this app can be built if-and-only-if KNI library is buildable
> -build = dpdk_conf.has('RTE_LIB_KNI')
> -if not build
> - subdir_done()
> -endif
> -
> deps += ['kni', 'bus_pci']
> sources = files(
> 'main.c',
> diff --git a/examples/l3fwd-power/meson.build b/examples/l3fwd-power/meson.build
> index 0f69bb782c..624ef5e947 100644
> --- a/examples/l3fwd-power/meson.build
> +++ b/examples/l3fwd-power/meson.build
> @@ -6,11 +6,6 @@
> # To build this example as a standalone application with an already-installed
> # DPDK instance, use 'make'
>
> -if not dpdk_conf.has('RTE_LIB_POWER')
> - build = false
> - subdir_done()
> -endif
> -
> allow_experimental_apis = true
> deps += ['power', 'timer', 'lpm', 'hash', 'metrics', 'telemetry']
> sources = files(
> diff --git a/examples/meson.build b/examples/meson.build
> index d50f09db12..35ec3471af 100644
> --- a/examples/meson.build
> +++ b/examples/meson.build
> @@ -104,6 +104,22 @@ foreach example: examples
> deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
> subdir(example)
>
> + if build
> + dep_objs = ext_deps
> + foreach d:deps
> + if not build
> + break
> + endif
I believe this check can be removed by just putting "break" after the
"message()" call below.
> + var_name = get_option('default_library') + '_rte_' + d
> + if not is_variable(var_name)
> + build = false
> + message('Missing dependency "@0@" for example "@1@"'.format(d, name))
> + else
> + dep_objs += [get_variable(var_name)]
> + endif
> + endforeach
> + endif
> +
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] examples: skip example when missing dependencies
2021-11-05 13:39 ` Bruce Richardson
@ 2021-11-06 8:49 ` David Marchand
0 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2021-11-06 8:49 UTC (permalink / raw)
To: Bruce Richardson
Cc: dev, Yigit, Ferruh, Thomas Monjalon, David Hunt, Maxime Coquelin,
Chenbo Xia
On Fri, Nov 5, 2021 at 2:39 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> > @@ -104,6 +104,22 @@ foreach example: examples
> > deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
> > subdir(example)
> >
> > + if build
> > + dep_objs = ext_deps
> > + foreach d:deps
> > + if not build
> > + break
> > + endif
>
> I believe this check can be removed by just putting "break" after the
> "message()" call below.
I took the inspiration from drivers/meson.build (where I suppose, the
if not build in the loop is to catch a build = false set by the subdir
meson.build).
It's more readable with a break where expected.
v2 incoming.
>
> > + var_name = get_option('default_library') + '_rte_' + d
> > + if not is_variable(var_name)
> > + build = false
> > + message('Missing dependency "@0@" for example "@1@"'.format(d, name))
> > + else
> > + dep_objs += [get_variable(var_name)]
> > + endif
> > + endforeach
> > + endif
> > +
>
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] examples: skip example when missing dependencies
2021-11-05 13:30 [dpdk-dev] [PATCH] examples: skip example when missing dependencies David Marchand
2021-11-05 13:39 ` Bruce Richardson
@ 2021-11-06 8:53 ` David Marchand
2021-11-10 10:57 ` David Marchand
1 sibling, 1 reply; 5+ messages in thread
From: David Marchand @ 2021-11-06 8:53 UTC (permalink / raw)
To: dev
Cc: bruce.richardson, ferruh.yigit, thomas, David Hunt,
Maxime Coquelin, Chenbo Xia
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>
---
Changes since v1:
- changed to a more explicit way to break from the foreach deps loop,
---
examples/distributor/meson.build | 6 ------
examples/kni/meson.build | 6 ------
examples/l3fwd-power/meson.build | 5 -----
examples/meson.build | 21 ++++++++++++-------
examples/vhost_crypto/meson.build | 5 -----
.../vm_power_manager/guest_cli/meson.build | 5 -----
examples/vm_power_manager/meson.build | 5 -----
7 files changed, 13 insertions(+), 40 deletions(-)
diff --git a/examples/distributor/meson.build b/examples/distributor/meson.build
index 9df59923ce..ca1eca952e 100644
--- a/examples/distributor/meson.build
+++ b/examples/distributor/meson.build
@@ -6,12 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-# require the power library
-build = dpdk_conf.has('RTE_LIB_POWER')
-if not build
- subdir_done()
-endif
-
allow_experimental_apis = true
deps += ['distributor', 'power']
sources = files(
diff --git a/examples/kni/meson.build b/examples/kni/meson.build
index 1c0bf99a49..6bd4eb50e6 100644
--- a/examples/kni/meson.build
+++ b/examples/kni/meson.build
@@ -6,12 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-# this app can be built if-and-only-if KNI library is buildable
-build = dpdk_conf.has('RTE_LIB_KNI')
-if not build
- subdir_done()
-endif
-
deps += ['kni', 'bus_pci']
sources = files(
'main.c',
diff --git a/examples/l3fwd-power/meson.build b/examples/l3fwd-power/meson.build
index 0f69bb782c..624ef5e947 100644
--- a/examples/l3fwd-power/meson.build
+++ b/examples/l3fwd-power/meson.build
@@ -6,11 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-if not dpdk_conf.has('RTE_LIB_POWER')
- build = false
- subdir_done()
-endif
-
allow_experimental_apis = true
deps += ['power', 'timer', 'lpm', 'hash', 'metrics', 'telemetry']
sources = files(
diff --git a/examples/meson.build b/examples/meson.build
index d50f09db12..bac9b76007 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -104,6 +104,19 @@ foreach example: examples
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
subdir(example)
+ if build
+ dep_objs = ext_deps
+ foreach d:deps
+ var_name = get_option('default_library') + '_rte_' + d
+ if not is_variable(var_name)
+ build = false
+ message('Missing dependency "@0@" for example "@1@"'.format(d, name))
+ break
+ endif
+ dep_objs += [get_variable(var_name)]
+ endforeach
+ endif
+
if not build
if not allow_skips
error('Cannot build requested example "' + name + '"')
@@ -112,14 +125,6 @@ foreach example: examples
continue
endif
- dep_objs = ext_deps
- foreach d:deps
- var_name = get_option('default_library') + '_rte_' + d
- if not is_variable(var_name)
- error('Missing dependency "@0@" for example "@1@"'.format(d, name))
- endif
- dep_objs += [get_variable(var_name)]
- endforeach
if allow_experimental_apis
cflags += '-DALLOW_EXPERIMENTAL_API'
endif
diff --git a/examples/vhost_crypto/meson.build b/examples/vhost_crypto/meson.build
index 720f42dd70..1c294c286f 100644
--- a/examples/vhost_crypto/meson.build
+++ b/examples/vhost_crypto/meson.build
@@ -6,11 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-build = dpdk_conf.has('RTE_LIB_VHOST')
-if not build
- subdir_done()
-endif
-
allow_experimental_apis = true
deps += ['vhost', 'cryptodev']
sources = files(
diff --git a/examples/vm_power_manager/guest_cli/meson.build b/examples/vm_power_manager/guest_cli/meson.build
index 666eef94ae..a69f809e3b 100644
--- a/examples/vm_power_manager/guest_cli/meson.build
+++ b/examples/vm_power_manager/guest_cli/meson.build
@@ -6,11 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-if not dpdk_conf.has('RTE_LIB_POWER')
- build = false
- subdir_done()
-endif
-
deps += ['power']
sources = files(
diff --git a/examples/vm_power_manager/meson.build b/examples/vm_power_manager/meson.build
index c15bad6609..b866d8fd54 100644
--- a/examples/vm_power_manager/meson.build
+++ b/examples/vm_power_manager/meson.build
@@ -6,11 +6,6 @@
# To build this example as a standalone application with an already-installed
# DPDK instance, use 'make'
-if not dpdk_conf.has('RTE_LIB_POWER')
- build = false
- subdir_done()
-endif
-
deps += ['power']
if dpdk_conf.has('RTE_NET_BNXT')
--
2.23.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] examples: skip example when missing dependencies
2021-11-06 8:53 ` [dpdk-dev] [PATCH v2] " David Marchand
@ 2021-11-10 10:57 ` David Marchand
0 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2021-11-10 10:57 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, Yigit, Ferruh, Thomas Monjalon, David Hunt,
Maxime Coquelin, Chenbo Xia
On Sat, Nov 6, 2021 at 6:54 PM David Marchand <david.marchand@redhat.com> wrote:
>
> 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>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-10 10:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 13:30 [dpdk-dev] [PATCH] examples: skip example when missing dependencies David Marchand
2021-11-05 13:39 ` Bruce Richardson
2021-11-06 8:49 ` David Marchand
2021-11-06 8:53 ` [dpdk-dev] [PATCH v2] " David Marchand
2021-11-10 10:57 ` David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).