* [dpdk-dev] [PATCH] install: fix flattening of examples directory
@ 2020-11-10 17:08 Bruce Richardson
2020-11-10 17:09 ` Bruce Richardson
` (4 more replies)
0 siblings, 5 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-10 17:08 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson, stable
By installing the examples one-by-one in a loop in the examples
meson.build file we effectively flatted out the structure of the examples
folder and omitted some common and shared subfolders that were never
directly built. Instead, we can remove the loop and just have the whole
"examples" folder installed as-is in a single statement, preserving its
directory structure, and thereby fixing the build of a number of the
examples.
Fixes: 2daf565f91b5 ("examples: install as part of ninja install")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/meson.build | 7 -------
meson.build | 3 +++
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/examples/meson.build b/examples/meson.build
index f17995532..46ec80919 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -47,13 +47,6 @@ all_examples = [
'vm_power_manager/guest_cli',
'vmdq', 'vmdq_dcb',
]
-# install all example code on install - irrespective of whether the example in
-# question is to be built as part of this build or not.
-foreach ex:all_examples
- install_subdir(ex,
- install_dir: get_option('datadir') + '/dpdk/examples',
- exclude_files: 'meson.build')
-endforeach
if get_option('examples') == ''
subdir_done()
diff --git a/meson.build b/meson.build
index 61d9a4f5f..45d974cd2 100644
--- a/meson.build
+++ b/meson.build
@@ -59,6 +59,9 @@ subdir('doc')
# build any examples explicitly requested - useful for developers - and
# install any example code into the appropriate install path
subdir('examples')
+install_subdir('examples',
+ install_dir: get_option('datadir') + '/dpdk',
+ exclude_files: 'meson.build')
# build kernel modules if enabled
if get_option('enable_kmods')
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH] install: fix flattening of examples directory
2020-11-10 17:08 [dpdk-dev] [PATCH] install: fix flattening of examples directory Bruce Richardson
@ 2020-11-10 17:09 ` Bruce Richardson
2020-11-10 17:14 ` David Marchand
2020-11-10 17:33 ` [dpdk-dev] [dpdk-stable] " David Marchand
` (3 subsequent siblings)
4 siblings, 1 reply; 27+ messages in thread
From: Bruce Richardson @ 2020-11-10 17:09 UTC (permalink / raw)
To: dev; +Cc: david.marchand, stable
Using correct address for David. :-(
On Tue, Nov 10, 2020 at 05:08:09PM +0000, Bruce Richardson wrote:
> By installing the examples one-by-one in a loop in the examples
> meson.build file we effectively flatted out the structure of the examples
> folder and omitted some common and shared subfolders that were never
> directly built. Instead, we can remove the loop and just have the whole
> "examples" folder installed as-is in a single statement, preserving its
> directory structure, and thereby fixing the build of a number of the
> examples.
>
> Fixes: 2daf565f91b5 ("examples: install as part of ninja install")
> Cc: stable@dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> examples/meson.build | 7 -------
> meson.build | 3 +++
> 2 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/examples/meson.build b/examples/meson.build
> index f17995532..46ec80919 100644
> --- a/examples/meson.build
> +++ b/examples/meson.build
> @@ -47,13 +47,6 @@ all_examples = [
> 'vm_power_manager/guest_cli',
> 'vmdq', 'vmdq_dcb',
> ]
> -# install all example code on install - irrespective of whether the example in
> -# question is to be built as part of this build or not.
> -foreach ex:all_examples
> - install_subdir(ex,
> - install_dir: get_option('datadir') + '/dpdk/examples',
> - exclude_files: 'meson.build')
> -endforeach
>
> if get_option('examples') == ''
> subdir_done()
> diff --git a/meson.build b/meson.build
> index 61d9a4f5f..45d974cd2 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -59,6 +59,9 @@ subdir('doc')
> # build any examples explicitly requested - useful for developers - and
> # install any example code into the appropriate install path
> subdir('examples')
> +install_subdir('examples',
> + install_dir: get_option('datadir') + '/dpdk',
> + exclude_files: 'meson.build')
>
> # build kernel modules if enabled
> if get_option('enable_kmods')
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH] install: fix flattening of examples directory
2020-11-10 17:09 ` Bruce Richardson
@ 2020-11-10 17:14 ` David Marchand
0 siblings, 0 replies; 27+ messages in thread
From: David Marchand @ 2020-11-10 17:14 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, dpdk stable
On Tue, Nov 10, 2020 at 6:09 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> Using correct address for David. :-(
A clone @intel.com would sure be helpful :-).
--
David Marchand
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] install: fix flattening of examples directory
2020-11-10 17:08 [dpdk-dev] [PATCH] install: fix flattening of examples directory Bruce Richardson
2020-11-10 17:09 ` Bruce Richardson
@ 2020-11-10 17:33 ` David Marchand
2020-11-10 17:42 ` Bruce Richardson
2020-11-11 15:56 ` [dpdk-dev] [PATCH v2 1/2] examples: fix flattening directory layout on install Bruce Richardson
` (2 subsequent siblings)
4 siblings, 1 reply; 27+ messages in thread
From: David Marchand @ 2020-11-10 17:33 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, dpdk stable, Thomas Monjalon
On Tue, Nov 10, 2020 at 6:08 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> By installing the examples one-by-one in a loop in the examples
> meson.build file we effectively flatted out the structure of the examples
flattened*
> folder and omitted some common and shared subfolders that were never
> directly built. Instead, we can remove the loop and just have the whole
> "examples" folder installed as-is in a single statement, preserving its
> directory structure, and thereby fixing the build of a number of the
> examples.
It seems wrong to provide all examples without looking at all_examples.
We would provide examples that can't link against the available dpdk libraries.
--
David Marchand
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] install: fix flattening of examples directory
2020-11-10 17:33 ` [dpdk-dev] [dpdk-stable] " David Marchand
@ 2020-11-10 17:42 ` Bruce Richardson
0 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-10 17:42 UTC (permalink / raw)
To: David Marchand; +Cc: dev, dpdk stable, Thomas Monjalon
On Tue, Nov 10, 2020 at 06:33:03PM +0100, David Marchand wrote:
> On Tue, Nov 10, 2020 at 6:08 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > By installing the examples one-by-one in a loop in the examples
> > meson.build file we effectively flatted out the structure of the examples
>
> flattened*
>
> > folder and omitted some common and shared subfolders that were never
> > directly built. Instead, we can remove the loop and just have the whole
> > "examples" folder installed as-is in a single statement, preserving its
> > directory structure, and thereby fixing the build of a number of the
> > examples.
>
> It seems wrong to provide all examples without looking at all_examples.
> We would provide examples that can't link against the available dpdk libraries.
>
Yes, let me think on this a bit about what is best to do, or how to manage
it. I'll try and get a v2 tomorrow.
For older releases with "make" buildsystem, did we provide an installation
method for examples, because I can't think of how we handled this fact
there?
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] examples: fix flattening directory layout on install
2020-11-10 17:08 [dpdk-dev] [PATCH] install: fix flattening of examples directory Bruce Richardson
2020-11-10 17:09 ` Bruce Richardson
2020-11-10 17:33 ` [dpdk-dev] [dpdk-stable] " David Marchand
@ 2020-11-11 15:56 ` Bruce Richardson
2020-11-11 15:56 ` [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 1/4] examples: fix flattening directory layout on install Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
4 siblings, 1 reply; 27+ messages in thread
From: Bruce Richardson @ 2020-11-11 15:56 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson, stable
By installing the examples one-by-one in a loop in the examples
meson.build file we effectively flattened out the structure of the examples
folder and omitted some common and shared subfolders that were never
directly built. Instead, we can remove the loop and just have the whole
"examples" folder installed as-is in a single statement, preserving its
directory structure, and thereby fixing the build of a number of the
examples.
Fixes: 2daf565f91b5 ("examples: install as part of ninja install")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/meson.build | 7 -------
meson.build | 3 +++
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/examples/meson.build b/examples/meson.build
index f179955325..46ec80919e 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -47,13 +47,6 @@ all_examples = [
'vm_power_manager/guest_cli',
'vmdq', 'vmdq_dcb',
]
-# install all example code on install - irrespective of whether the example in
-# question is to be built as part of this build or not.
-foreach ex:all_examples
- install_subdir(ex,
- install_dir: get_option('datadir') + '/dpdk/examples',
- exclude_files: 'meson.build')
-endforeach
if get_option('examples') == ''
subdir_done()
diff --git a/meson.build b/meson.build
index 61d9a4f5fa..45d974cd2c 100644
--- a/meson.build
+++ b/meson.build
@@ -59,6 +59,9 @@ subdir('doc')
# build any examples explicitly requested - useful for developers - and
# install any example code into the appropriate install path
subdir('examples')
+install_subdir('examples',
+ install_dir: get_option('datadir') + '/dpdk',
+ exclude_files: 'meson.build')
# build kernel modules if enabled
if get_option('enable_kmods')
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples
2020-11-11 15:56 ` [dpdk-dev] [PATCH v2 1/2] examples: fix flattening directory layout on install Bruce Richardson
@ 2020-11-11 15:56 ` Bruce Richardson
2020-11-11 17:33 ` Bruce Richardson
0 siblings, 1 reply; 27+ messages in thread
From: Bruce Richardson @ 2020-11-11 15:56 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson
Rather than just installing all examples, we can use the build checks to
filter out any examples that are missing dependencies or are otherwise
unbuildable on the current system.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
meson.build | 2 ++
2 files changed, 35 insertions(+), 21 deletions(-)
diff --git a/examples/meson.build b/examples/meson.build
index 46ec80919e..9d268c9786 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -48,15 +48,11 @@ all_examples = [
'vmdq', 'vmdq_dcb',
]
-if get_option('examples') == ''
- subdir_done()
-endif
-
if get_option('examples').to_lower() == 'all'
- examples = all_examples
+ requested_examples = all_examples
allow_skips = true # don't flag an error if we can't build an app
else
- examples = get_option('examples').split(',')
+ requested_examples = get_option('examples').split(',')
allow_skips = false # error out if we can't build a requested app
endif
default_cflags = machine_args
@@ -64,7 +60,9 @@ if cc.has_argument('-Wno-format-truncation')
default_cflags += '-Wno-format-truncation'
endif
-foreach example: examples
+# iterate through all examples to see what we need to install
+# only actually build requested ones
+foreach example: all_examples
name = example.split('/')[-1]
build = true
sources = []
@@ -81,22 +79,36 @@ foreach example: examples
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))
+ message('Missing dependency "@0@" for example "@1@"'.format(d, name))
+ build = false
+ else
+ dep_objs += [get_variable(var_name)]
endif
- dep_objs += [get_variable(var_name)]
endforeach
- if allow_experimental_apis
- cflags += '-DALLOW_EXPERIMENTAL_API'
+ endif # build
+
+ if not build
+ # exclude based on top-level directory only
+ dir = example.split('/')[0]
+ dpdk_examples_exclude += dir
+ message('Excluding example directory "@0@" from install'.format(dir))
+ endif
+
+ if requested_examples.contains(example)
+ if build
+ if allow_experimental_apis
+ cflags += '-DALLOW_EXPERIMENTAL_API'
+ endif
+ executable('dpdk-' + name, sources,
+ include_directories: includes,
+ link_whole: link_whole_libs,
+ link_args: dpdk_extra_ldflags,
+ c_args: cflags,
+ dependencies: dep_objs)
+ elif not allow_skips
+ error('Cannot build requested example "' + name + '"')
+ else
+ message('Skipping example "' + name + '"')
endif
- executable('dpdk-' + name, sources,
- include_directories: includes,
- link_whole: link_whole_libs,
- link_args: dpdk_extra_ldflags,
- c_args: cflags,
- dependencies: dep_objs)
- elif not allow_skips
- error('Cannot build requested example "' + name + '"')
- else
- message('Skipping example "' + name + '"')
endif
endforeach
diff --git a/meson.build b/meson.build
index 45d974cd2c..559a9d2f1b 100644
--- a/meson.build
+++ b/meson.build
@@ -58,9 +58,11 @@ subdir('doc')
# build any examples explicitly requested - useful for developers - and
# install any example code into the appropriate install path
+dpdk_examples_exclude = []
subdir('examples')
install_subdir('examples',
install_dir: get_option('datadir') + '/dpdk',
+ exclude_directories: dpdk_examples_exclude,
exclude_files: 'meson.build')
# build kernel modules if enabled
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples
2020-11-11 15:56 ` [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples Bruce Richardson
@ 2020-11-11 17:33 ` Bruce Richardson
2020-11-12 9:14 ` David Marchand
0 siblings, 1 reply; 27+ messages in thread
From: Bruce Richardson @ 2020-11-11 17:33 UTC (permalink / raw)
To: dev; +Cc: david.marchand
On Wed, Nov 11, 2020 at 03:56:47PM +0000, Bruce Richardson wrote:
> Rather than just installing all examples, we can use the build checks to
> filter out any examples that are missing dependencies or are otherwise
> unbuildable on the current system.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
> meson.build | 2 ++
> 2 files changed, 35 insertions(+), 21 deletions(-)
>
This seems to have broken the windows builds because we now process all the
examples meson.build file, even if not asked to build them. l2fwd-keepalive
has a mandatory, unconditional dependency on librt, which needs to be made
optional.
Based on that, V3 pending...
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v3 1/4] examples: fix flattening directory layout on install
2020-11-10 17:08 [dpdk-dev] [PATCH] install: fix flattening of examples directory Bruce Richardson
` (2 preceding siblings ...)
2020-11-11 15:56 ` [dpdk-dev] [PATCH v2 1/2] examples: fix flattening directory layout on install Bruce Richardson
@ 2020-11-11 17:48 ` Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 2/4] examples/l2fwd-keepalive: skip build when no librt Bruce Richardson
` (2 more replies)
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
4 siblings, 3 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-11 17:48 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson, stable
By installing the examples one-by-one in a loop in the examples
meson.build file we effectively flattened out the structure of the examples
folder and omitted some common and shared subfolders that were never
directly built. Instead, we can remove the loop and just have the whole
"examples" folder installed as-is in a single statement, preserving its
directory structure, and thereby fixing the build of a number of the
examples.
Fixes: 2daf565f91b5 ("examples: install as part of ninja install")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/meson.build | 7 -------
meson.build | 3 +++
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/examples/meson.build b/examples/meson.build
index f17995532..46ec80919 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -47,13 +47,6 @@ all_examples = [
'vm_power_manager/guest_cli',
'vmdq', 'vmdq_dcb',
]
-# install all example code on install - irrespective of whether the example in
-# question is to be built as part of this build or not.
-foreach ex:all_examples
- install_subdir(ex,
- install_dir: get_option('datadir') + '/dpdk/examples',
- exclude_files: 'meson.build')
-endforeach
if get_option('examples') == ''
subdir_done()
diff --git a/meson.build b/meson.build
index 61d9a4f5f..45d974cd2 100644
--- a/meson.build
+++ b/meson.build
@@ -59,6 +59,9 @@ subdir('doc')
# build any examples explicitly requested - useful for developers - and
# install any example code into the appropriate install path
subdir('examples')
+install_subdir('examples',
+ install_dir: get_option('datadir') + '/dpdk',
+ exclude_files: 'meson.build')
# build kernel modules if enabled
if get_option('enable_kmods')
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v3 2/4] examples/l2fwd-keepalive: skip build when no librt
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 1/4] examples: fix flattening directory layout on install Bruce Richardson
@ 2020-11-11 17:48 ` Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 3/4] examples: stop processing build file if build is impossible Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 4/4] examples: skip installing unbuildable examples Bruce Richardson
2 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-11 17:48 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson, stable
When librt is not present on a system, processing the meson.build file
for this example application causes an error. Make the library
non-mandatory and just mark the example as unbuildable if it is
not present.
Fixes: 89f0711f9ddf ("examples: build some samples with meson")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/l2fwd-keepalive/meson.build | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/examples/l2fwd-keepalive/meson.build b/examples/l2fwd-keepalive/meson.build
index d678a8ddd..a56d67967 100644
--- a/examples/l2fwd-keepalive/meson.build
+++ b/examples/l2fwd-keepalive/meson.build
@@ -7,7 +7,13 @@
# DPDK instance, use 'make'
allow_experimental_apis = true
-ext_deps += cc.find_library('rt')
+librt = cc.find_library('rt', required: false)
+if not librt.found()
+ build = false
+ subdir_done()
+endif
+
+ext_deps += librt
deps += 'timer'
sources = files(
'main.c', 'shm.c'
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v3 3/4] examples: stop processing build file if build is impossible
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 1/4] examples: fix flattening directory layout on install Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 2/4] examples/l2fwd-keepalive: skip build when no librt Bruce Richardson
@ 2020-11-11 17:48 ` Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 4/4] examples: skip installing unbuildable examples Bruce Richardson
2 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-11 17:48 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson
Once it has been determined that an example cannot be built, there is
little point in continuing to process the meson.build file for that
example, so we can use subdir_done() to return to the calling file.
This can potentially prevent problems where later statement in the file
may cause an error on systems where the app cannot be built, e.g. on
Windows or FreeBSD.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/distributor/meson.build | 3 +++
examples/ethtool/meson.build | 4 ++++
examples/ioat/meson.build | 3 +++
examples/ip_pipeline/meson.build | 4 ++++
examples/kni/meson.build | 4 ++++
examples/l2fwd-cat/meson.build | 4 ++++
examples/ntb/meson.build | 2 ++
examples/performance-thread/l3fwd-thread/meson.build | 4 ++++
examples/performance-thread/pthread_shim/meson.build | 4 ++++
examples/pipeline/meson.build | 4 ++++
examples/vdpa/meson.build | 2 ++
examples/vhost/meson.build | 2 ++
examples/vhost_blk/meson.build | 2 ++
examples/vhost_crypto/meson.build | 4 ++++
14 files changed, 46 insertions(+)
diff --git a/examples/distributor/meson.build b/examples/distributor/meson.build
index 5244cd4ff..d8dbc235f 100644
--- a/examples/distributor/meson.build
+++ b/examples/distributor/meson.build
@@ -8,6 +8,9 @@
# require the power library
build = dpdk_conf.has('RTE_LIB_POWER')
+if not build
+ subdir_done()
+endif
allow_experimental_apis = true
deps += ['distributor', 'power']
diff --git a/examples/ethtool/meson.build b/examples/ethtool/meson.build
index cc8edac3d..4d08bc4c5 100644
--- a/examples/ethtool/meson.build
+++ b/examples/ethtool/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = is_linux
+if not build
+ subdir_done()
+endif
+
sources = files('lib/rte_ethtool.c',
'ethtool-app/ethapp.c',
'ethtool-app/main.c')
diff --git a/examples/ioat/meson.build b/examples/ioat/meson.build
index 6afbaa680..e348196ba 100644
--- a/examples/ioat/meson.build
+++ b/examples/ioat/meson.build
@@ -8,6 +8,9 @@
allow_experimental_apis = true
build = dpdk_conf.has('RTE_RAW_IOAT')
+if not build
+ subdir_done()
+endif
deps += ['raw_ioat']
diff --git a/examples/ip_pipeline/meson.build b/examples/ip_pipeline/meson.build
index 664223c97..945e28b58 100644
--- a/examples/ip_pipeline/meson.build
+++ b/examples/ip_pipeline/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = cc.has_header('sys/epoll.h')
+if not build
+ subdir_done()
+endif
+
deps += ['pipeline', 'bus_pci']
allow_experimental_apis = true
sources = files(
diff --git a/examples/kni/meson.build b/examples/kni/meson.build
index 58639b139..e119eebab 100644
--- a/examples/kni/meson.build
+++ b/examples/kni/meson.build
@@ -8,6 +8,10 @@
# 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/l2fwd-cat/meson.build b/examples/l2fwd-cat/meson.build
index 2bed18e74..60169bcbd 100644
--- a/examples/l2fwd-cat/meson.build
+++ b/examples/l2fwd-cat/meson.build
@@ -8,6 +8,10 @@
pqos = cc.find_library('pqos', required: false)
build = pqos.found()
+if not build
+ subdir_done()
+endif
+
ext_deps += pqos
allow_experimental_apis = true
cflags += '-I/usr/local/include' # assume pqos lib installed in /usr/local
diff --git a/examples/ntb/meson.build b/examples/ntb/meson.build
index b0201f68b..02be9fc80 100644
--- a/examples/ntb/meson.build
+++ b/examples/ntb/meson.build
@@ -9,7 +9,9 @@
allow_experimental_apis = true
if not is_linux
build = false
+ subdir_done()
endif
+
deps += 'rawdev'
cflags += ['-D_FILE_OFFSET_BITS=64']
sources = files(
diff --git a/examples/performance-thread/l3fwd-thread/meson.build b/examples/performance-thread/l3fwd-thread/meson.build
index 99de24be7..4858b201e 100644
--- a/examples/performance-thread/l3fwd-thread/meson.build
+++ b/examples/performance-thread/l3fwd-thread/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = dpdk_conf.has('RTE_ARCH_X86_64')
+if not build
+ subdir_done()
+endif
+
deps += ['timer', 'lpm']
allow_experimental_apis = true
diff --git a/examples/performance-thread/pthread_shim/meson.build b/examples/performance-thread/pthread_shim/meson.build
index 26ef78635..d49979930 100644
--- a/examples/performance-thread/pthread_shim/meson.build
+++ b/examples/performance-thread/pthread_shim/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
+if not build
+ subdir_done()
+endif
+
deps += ['timer']
allow_experimental_apis = true
diff --git a/examples/pipeline/meson.build b/examples/pipeline/meson.build
index e47d483de..4f5925d7c 100644
--- a/examples/pipeline/meson.build
+++ b/examples/pipeline/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = cc.has_header('sys/epoll.h')
+if not build
+ subdir_done()
+endif
+
deps += ['pipeline', 'bus_pci']
allow_experimental_apis = true
sources = files(
diff --git a/examples/vdpa/meson.build b/examples/vdpa/meson.build
index 73f129cd9..26f6089c9 100644
--- a/examples/vdpa/meson.build
+++ b/examples/vdpa/meson.build
@@ -8,7 +8,9 @@
if not is_linux
build = false
+ subdir_done()
endif
+
deps += 'vhost'
allow_experimental_apis = true
sources = files(
diff --git a/examples/vhost/meson.build b/examples/vhost/meson.build
index 24f1f7131..7e5b9d938 100644
--- a/examples/vhost/meson.build
+++ b/examples/vhost/meson.build
@@ -8,7 +8,9 @@
if not is_linux
build = false
+ subdir_done()
endif
+
deps += 'vhost'
allow_experimental_apis = true
sources = files(
diff --git a/examples/vhost_blk/meson.build b/examples/vhost_blk/meson.build
index 857367192..354ba0584 100644
--- a/examples/vhost_blk/meson.build
+++ b/examples/vhost_blk/meson.build
@@ -8,10 +8,12 @@
if not is_linux
build = false
+ subdir_done()
endif
if not cc.has_header('linux/virtio_blk.h')
build = false
+ subdir_done()
endif
deps += 'vhost'
diff --git a/examples/vhost_crypto/meson.build b/examples/vhost_crypto/meson.build
index b2c125e2f..403f21098 100644
--- a/examples/vhost_crypto/meson.build
+++ b/examples/vhost_crypto/meson.build
@@ -7,6 +7,10 @@
# 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(
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v3 4/4] examples: skip installing unbuildable examples
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 1/4] examples: fix flattening directory layout on install Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 2/4] examples/l2fwd-keepalive: skip build when no librt Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 3/4] examples: stop processing build file if build is impossible Bruce Richardson
@ 2020-11-11 17:48 ` Bruce Richardson
2 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-11 17:48 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson
Rather than just installing all examples, we can use the build checks to
filter out any examples that are missing dependencies or are otherwise
unbuildable on the current system.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
meson.build | 2 ++
2 files changed, 35 insertions(+), 21 deletions(-)
diff --git a/examples/meson.build b/examples/meson.build
index 46ec80919..9d268c978 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -48,15 +48,11 @@ all_examples = [
'vmdq', 'vmdq_dcb',
]
-if get_option('examples') == ''
- subdir_done()
-endif
-
if get_option('examples').to_lower() == 'all'
- examples = all_examples
+ requested_examples = all_examples
allow_skips = true # don't flag an error if we can't build an app
else
- examples = get_option('examples').split(',')
+ requested_examples = get_option('examples').split(',')
allow_skips = false # error out if we can't build a requested app
endif
default_cflags = machine_args
@@ -64,7 +60,9 @@ if cc.has_argument('-Wno-format-truncation')
default_cflags += '-Wno-format-truncation'
endif
-foreach example: examples
+# iterate through all examples to see what we need to install
+# only actually build requested ones
+foreach example: all_examples
name = example.split('/')[-1]
build = true
sources = []
@@ -81,22 +79,36 @@ foreach example: examples
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))
+ message('Missing dependency "@0@" for example "@1@"'.format(d, name))
+ build = false
+ else
+ dep_objs += [get_variable(var_name)]
endif
- dep_objs += [get_variable(var_name)]
endforeach
- if allow_experimental_apis
- cflags += '-DALLOW_EXPERIMENTAL_API'
+ endif # build
+
+ if not build
+ # exclude based on top-level directory only
+ dir = example.split('/')[0]
+ dpdk_examples_exclude += dir
+ message('Excluding example directory "@0@" from install'.format(dir))
+ endif
+
+ if requested_examples.contains(example)
+ if build
+ if allow_experimental_apis
+ cflags += '-DALLOW_EXPERIMENTAL_API'
+ endif
+ executable('dpdk-' + name, sources,
+ include_directories: includes,
+ link_whole: link_whole_libs,
+ link_args: dpdk_extra_ldflags,
+ c_args: cflags,
+ dependencies: dep_objs)
+ elif not allow_skips
+ error('Cannot build requested example "' + name + '"')
+ else
+ message('Skipping example "' + name + '"')
endif
- executable('dpdk-' + name, sources,
- include_directories: includes,
- link_whole: link_whole_libs,
- link_args: dpdk_extra_ldflags,
- c_args: cflags,
- dependencies: dep_objs)
- elif not allow_skips
- error('Cannot build requested example "' + name + '"')
- else
- message('Skipping example "' + name + '"')
endif
endforeach
diff --git a/meson.build b/meson.build
index 45d974cd2..559a9d2f1 100644
--- a/meson.build
+++ b/meson.build
@@ -58,9 +58,11 @@ subdir('doc')
# build any examples explicitly requested - useful for developers - and
# install any example code into the appropriate install path
+dpdk_examples_exclude = []
subdir('examples')
install_subdir('examples',
install_dir: get_option('datadir') + '/dpdk',
+ exclude_directories: dpdk_examples_exclude,
exclude_files: 'meson.build')
# build kernel modules if enabled
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples
2020-11-11 17:33 ` Bruce Richardson
@ 2020-11-12 9:14 ` David Marchand
2020-11-12 9:24 ` Bruce Richardson
0 siblings, 1 reply; 27+ messages in thread
From: David Marchand @ 2020-11-12 9:14 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev
On Wed, Nov 11, 2020 at 6:33 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Wed, Nov 11, 2020 at 03:56:47PM +0000, Bruce Richardson wrote:
> > Rather than just installing all examples, we can use the build checks to
> > filter out any examples that are missing dependencies or are otherwise
> > unbuildable on the current system.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> > examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
> > meson.build | 2 ++
> > 2 files changed, 35 insertions(+), 21 deletions(-)
> >
> This seems to have broken the windows builds because we now process all the
> examples meson.build file, even if not asked to build them. l2fwd-keepalive
> has a mandatory, unconditional dependency on librt, which needs to be made
> optional.
>
> Based on that, V3 pending...
Strange, the v3 patches 2 and 3 linked to the v2 series.
As far as I can see, the lab only tested the v3 series with patches
84029 and 30, so the error on Windows is still reported.
--
David Marchand
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples
2020-11-12 9:14 ` David Marchand
@ 2020-11-12 9:24 ` Bruce Richardson
2020-11-12 9:27 ` David Marchand
0 siblings, 1 reply; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 9:24 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Thu, Nov 12, 2020 at 10:14:23AM +0100, David Marchand wrote:
> On Wed, Nov 11, 2020 at 6:33 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > On Wed, Nov 11, 2020 at 03:56:47PM +0000, Bruce Richardson wrote:
> > > Rather than just installing all examples, we can use the build checks to
> > > filter out any examples that are missing dependencies or are otherwise
> > > unbuildable on the current system.
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > ---
> > > examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
> > > meson.build | 2 ++
> > > 2 files changed, 35 insertions(+), 21 deletions(-)
> > >
> > This seems to have broken the windows builds because we now process all the
> > examples meson.build file, even if not asked to build them. l2fwd-keepalive
> > has a mandatory, unconditional dependency on librt, which needs to be made
> > optional.
> >
> > Based on that, V3 pending...
>
> Strange, the v3 patches 2 and 3 linked to the v2 series.
> As far as I can see, the lab only tested the v3 series with patches
> 84029 and 30, so the error on Windows is still reported.
>
> --
> David Marchand
>
Yes, I see that in patchwork, and it's a bit strange. The emails seem
correctly threaded to me in my mail client though.
I'll resubmit as v4 with a cover letter to see if that allows the CI to run
properly.
/Bruce
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples
2020-11-12 9:24 ` Bruce Richardson
@ 2020-11-12 9:27 ` David Marchand
2020-11-12 9:35 ` Bruce Richardson
0 siblings, 1 reply; 27+ messages in thread
From: David Marchand @ 2020-11-12 9:27 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev
On Thu, Nov 12, 2020 at 10:25 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> > Strange, the v3 patches 2 and 3 linked to the v2 series.
> > As far as I can see, the lab only tested the v3 series with patches
> > 84029 and 30, so the error on Windows is still reported.
> >
> > --
> > David Marchand
> >
> Yes, I see that in patchwork, and it's a bit strange. The emails seem
> correctly threaded to me in my mail client though.
Yes, it looks correct to me too..
> I'll resubmit as v4 with a cover letter to see if that allows the CI to run
> properly.
I don't think the cover letter matters.. but let's see how it behaves.
Thanks Bruce.
--
David Marchand
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples
2020-11-12 9:27 ` David Marchand
@ 2020-11-12 9:35 ` Bruce Richardson
0 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 9:35 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Thu, Nov 12, 2020 at 10:27:09AM +0100, David Marchand wrote:
> On Thu, Nov 12, 2020 at 10:25 AM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> > > Strange, the v3 patches 2 and 3 linked to the v2 series.
> > > As far as I can see, the lab only tested the v3 series with patches
> > > 84029 and 30, so the error on Windows is still reported.
> > >
> > > --
> > > David Marchand
> > >
> > Yes, I see that in patchwork, and it's a bit strange. The emails seem
> > correctly threaded to me in my mail client though.
>
> Yes, it looks correct to me too..
>
> > I'll resubmit as v4 with a cover letter to see if that allows the CI to run
> > properly.
>
> I don't think the cover letter matters.. but let's see how it behaves.
>
It shouldn't matter, I agree, but I'm leaving nothing to chance on this :-)
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v4 0/4] improve examples installation
2020-11-10 17:08 [dpdk-dev] [PATCH] install: fix flattening of examples directory Bruce Richardson
` (3 preceding siblings ...)
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 1/4] examples: fix flattening directory layout on install Bruce Richardson
@ 2020-11-12 9:41 ` Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 1/4] examples: fix flattening directory layout on install Bruce Richardson
` (5 more replies)
4 siblings, 6 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 9:41 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson
This patch improves the installation of the examples when "ninja install" is
run. It removes issues with the directory structure being flattened out, and
removes from the install list any examples that are not buildable with built
DPDK code.
V4: resubmit v3 to retest in CI hopefully with proper patch tracking
V3: fix issues with building on Windows
V2: add support for filtering examples that won't build
Bruce Richardson (4):
examples: fix flattening directory layout on install
examples/l2fwd-keepalive: skip build when no librt
examples: stop processing build file if build is impossible
examples: skip installing unbuildable examples
examples/distributor/meson.build | 3 +
examples/ethtool/meson.build | 4 ++
examples/ioat/meson.build | 3 +
examples/ip_pipeline/meson.build | 4 ++
examples/kni/meson.build | 4 ++
examples/l2fwd-cat/meson.build | 4 ++
examples/l2fwd-keepalive/meson.build | 8 ++-
examples/meson.build | 61 ++++++++++---------
examples/ntb/meson.build | 2 +
.../l3fwd-thread/meson.build | 4 ++
.../pthread_shim/meson.build | 4 ++
examples/pipeline/meson.build | 4 ++
examples/vdpa/meson.build | 2 +
examples/vhost/meson.build | 2 +
examples/vhost_blk/meson.build | 2 +
examples/vhost_crypto/meson.build | 4 ++
meson.build | 5 ++
17 files changed, 91 insertions(+), 29 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v4 1/4] examples: fix flattening directory layout on install
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
@ 2020-11-12 9:41 ` Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 2/4] examples/l2fwd-keepalive: skip build when no librt Bruce Richardson
` (4 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 9:41 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson, stable
By installing the examples one-by-one in a loop in the examples
meson.build file we effectively flattened out the structure of the examples
folder and omitted some common and shared subfolders that were never
directly built. Instead, we can remove the loop and just have the whole
"examples" folder installed as-is in a single statement, preserving its
directory structure, and thereby fixing the build of a number of the
examples.
Fixes: 2daf565f91b5 ("examples: install as part of ninja install")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/meson.build | 7 -------
meson.build | 3 +++
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/examples/meson.build b/examples/meson.build
index f17995532..46ec80919 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -47,13 +47,6 @@ all_examples = [
'vm_power_manager/guest_cli',
'vmdq', 'vmdq_dcb',
]
-# install all example code on install - irrespective of whether the example in
-# question is to be built as part of this build or not.
-foreach ex:all_examples
- install_subdir(ex,
- install_dir: get_option('datadir') + '/dpdk/examples',
- exclude_files: 'meson.build')
-endforeach
if get_option('examples') == ''
subdir_done()
diff --git a/meson.build b/meson.build
index 61d9a4f5f..45d974cd2 100644
--- a/meson.build
+++ b/meson.build
@@ -59,6 +59,9 @@ subdir('doc')
# build any examples explicitly requested - useful for developers - and
# install any example code into the appropriate install path
subdir('examples')
+install_subdir('examples',
+ install_dir: get_option('datadir') + '/dpdk',
+ exclude_files: 'meson.build')
# build kernel modules if enabled
if get_option('enable_kmods')
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v4 2/4] examples/l2fwd-keepalive: skip build when no librt
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 1/4] examples: fix flattening directory layout on install Bruce Richardson
@ 2020-11-12 9:41 ` Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 3/4] examples: stop processing build file if build is impossible Bruce Richardson
` (3 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 9:41 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson, stable
When librt is not present on a system, processing the meson.build file
for this example application causes an error. Make the library
non-mandatory and just mark the example as unbuildable if it is
not present.
Fixes: 89f0711f9ddf ("examples: build some samples with meson")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/l2fwd-keepalive/meson.build | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/examples/l2fwd-keepalive/meson.build b/examples/l2fwd-keepalive/meson.build
index d678a8ddd..a56d67967 100644
--- a/examples/l2fwd-keepalive/meson.build
+++ b/examples/l2fwd-keepalive/meson.build
@@ -7,7 +7,13 @@
# DPDK instance, use 'make'
allow_experimental_apis = true
-ext_deps += cc.find_library('rt')
+librt = cc.find_library('rt', required: false)
+if not librt.found()
+ build = false
+ subdir_done()
+endif
+
+ext_deps += librt
deps += 'timer'
sources = files(
'main.c', 'shm.c'
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v4 3/4] examples: stop processing build file if build is impossible
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 1/4] examples: fix flattening directory layout on install Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 2/4] examples/l2fwd-keepalive: skip build when no librt Bruce Richardson
@ 2020-11-12 9:41 ` Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 4/4] examples: skip installing unbuildable examples Bruce Richardson
` (2 subsequent siblings)
5 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 9:41 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson
Once it has been determined that an example cannot be built, there is
little point in continuing to process the meson.build file for that
example, so we can use subdir_done() to return to the calling file.
This can potentially prevent problems where later statement in the file
may cause an error on systems where the app cannot be built, e.g. on
Windows or FreeBSD.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/distributor/meson.build | 3 +++
examples/ethtool/meson.build | 4 ++++
examples/ioat/meson.build | 3 +++
examples/ip_pipeline/meson.build | 4 ++++
examples/kni/meson.build | 4 ++++
examples/l2fwd-cat/meson.build | 4 ++++
examples/ntb/meson.build | 2 ++
examples/performance-thread/l3fwd-thread/meson.build | 4 ++++
examples/performance-thread/pthread_shim/meson.build | 4 ++++
examples/pipeline/meson.build | 4 ++++
examples/vdpa/meson.build | 2 ++
examples/vhost/meson.build | 2 ++
examples/vhost_blk/meson.build | 2 ++
examples/vhost_crypto/meson.build | 4 ++++
14 files changed, 46 insertions(+)
diff --git a/examples/distributor/meson.build b/examples/distributor/meson.build
index 5244cd4ff..d8dbc235f 100644
--- a/examples/distributor/meson.build
+++ b/examples/distributor/meson.build
@@ -8,6 +8,9 @@
# require the power library
build = dpdk_conf.has('RTE_LIB_POWER')
+if not build
+ subdir_done()
+endif
allow_experimental_apis = true
deps += ['distributor', 'power']
diff --git a/examples/ethtool/meson.build b/examples/ethtool/meson.build
index cc8edac3d..4d08bc4c5 100644
--- a/examples/ethtool/meson.build
+++ b/examples/ethtool/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = is_linux
+if not build
+ subdir_done()
+endif
+
sources = files('lib/rte_ethtool.c',
'ethtool-app/ethapp.c',
'ethtool-app/main.c')
diff --git a/examples/ioat/meson.build b/examples/ioat/meson.build
index 6afbaa680..e348196ba 100644
--- a/examples/ioat/meson.build
+++ b/examples/ioat/meson.build
@@ -8,6 +8,9 @@
allow_experimental_apis = true
build = dpdk_conf.has('RTE_RAW_IOAT')
+if not build
+ subdir_done()
+endif
deps += ['raw_ioat']
diff --git a/examples/ip_pipeline/meson.build b/examples/ip_pipeline/meson.build
index 664223c97..945e28b58 100644
--- a/examples/ip_pipeline/meson.build
+++ b/examples/ip_pipeline/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = cc.has_header('sys/epoll.h')
+if not build
+ subdir_done()
+endif
+
deps += ['pipeline', 'bus_pci']
allow_experimental_apis = true
sources = files(
diff --git a/examples/kni/meson.build b/examples/kni/meson.build
index 58639b139..e119eebab 100644
--- a/examples/kni/meson.build
+++ b/examples/kni/meson.build
@@ -8,6 +8,10 @@
# 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/l2fwd-cat/meson.build b/examples/l2fwd-cat/meson.build
index 2bed18e74..60169bcbd 100644
--- a/examples/l2fwd-cat/meson.build
+++ b/examples/l2fwd-cat/meson.build
@@ -8,6 +8,10 @@
pqos = cc.find_library('pqos', required: false)
build = pqos.found()
+if not build
+ subdir_done()
+endif
+
ext_deps += pqos
allow_experimental_apis = true
cflags += '-I/usr/local/include' # assume pqos lib installed in /usr/local
diff --git a/examples/ntb/meson.build b/examples/ntb/meson.build
index b0201f68b..02be9fc80 100644
--- a/examples/ntb/meson.build
+++ b/examples/ntb/meson.build
@@ -9,7 +9,9 @@
allow_experimental_apis = true
if not is_linux
build = false
+ subdir_done()
endif
+
deps += 'rawdev'
cflags += ['-D_FILE_OFFSET_BITS=64']
sources = files(
diff --git a/examples/performance-thread/l3fwd-thread/meson.build b/examples/performance-thread/l3fwd-thread/meson.build
index 99de24be7..4858b201e 100644
--- a/examples/performance-thread/l3fwd-thread/meson.build
+++ b/examples/performance-thread/l3fwd-thread/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = dpdk_conf.has('RTE_ARCH_X86_64')
+if not build
+ subdir_done()
+endif
+
deps += ['timer', 'lpm']
allow_experimental_apis = true
diff --git a/examples/performance-thread/pthread_shim/meson.build b/examples/performance-thread/pthread_shim/meson.build
index 26ef78635..d49979930 100644
--- a/examples/performance-thread/pthread_shim/meson.build
+++ b/examples/performance-thread/pthread_shim/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
+if not build
+ subdir_done()
+endif
+
deps += ['timer']
allow_experimental_apis = true
diff --git a/examples/pipeline/meson.build b/examples/pipeline/meson.build
index e47d483de..4f5925d7c 100644
--- a/examples/pipeline/meson.build
+++ b/examples/pipeline/meson.build
@@ -7,6 +7,10 @@
# DPDK instance, use 'make'
build = cc.has_header('sys/epoll.h')
+if not build
+ subdir_done()
+endif
+
deps += ['pipeline', 'bus_pci']
allow_experimental_apis = true
sources = files(
diff --git a/examples/vdpa/meson.build b/examples/vdpa/meson.build
index 73f129cd9..26f6089c9 100644
--- a/examples/vdpa/meson.build
+++ b/examples/vdpa/meson.build
@@ -8,7 +8,9 @@
if not is_linux
build = false
+ subdir_done()
endif
+
deps += 'vhost'
allow_experimental_apis = true
sources = files(
diff --git a/examples/vhost/meson.build b/examples/vhost/meson.build
index 24f1f7131..7e5b9d938 100644
--- a/examples/vhost/meson.build
+++ b/examples/vhost/meson.build
@@ -8,7 +8,9 @@
if not is_linux
build = false
+ subdir_done()
endif
+
deps += 'vhost'
allow_experimental_apis = true
sources = files(
diff --git a/examples/vhost_blk/meson.build b/examples/vhost_blk/meson.build
index 857367192..354ba0584 100644
--- a/examples/vhost_blk/meson.build
+++ b/examples/vhost_blk/meson.build
@@ -8,10 +8,12 @@
if not is_linux
build = false
+ subdir_done()
endif
if not cc.has_header('linux/virtio_blk.h')
build = false
+ subdir_done()
endif
deps += 'vhost'
diff --git a/examples/vhost_crypto/meson.build b/examples/vhost_crypto/meson.build
index b2c125e2f..403f21098 100644
--- a/examples/vhost_crypto/meson.build
+++ b/examples/vhost_crypto/meson.build
@@ -7,6 +7,10 @@
# 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(
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [dpdk-dev] [PATCH v4 4/4] examples: skip installing unbuildable examples
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
` (2 preceding siblings ...)
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 3/4] examples: stop processing build file if build is impossible Bruce Richardson
@ 2020-11-12 9:41 ` Bruce Richardson
2020-11-12 17:06 ` Thomas Monjalon
2020-11-12 11:14 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation David Marchand
2020-11-12 18:36 ` Thomas Monjalon
5 siblings, 1 reply; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 9:41 UTC (permalink / raw)
To: dev; +Cc: david.marchand, Bruce Richardson
Rather than just installing all examples, we can use the build checks to
filter out any examples that are missing dependencies or are otherwise
unbuildable on the current system.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
meson.build | 2 ++
2 files changed, 35 insertions(+), 21 deletions(-)
diff --git a/examples/meson.build b/examples/meson.build
index 46ec80919..9d268c978 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -48,15 +48,11 @@ all_examples = [
'vmdq', 'vmdq_dcb',
]
-if get_option('examples') == ''
- subdir_done()
-endif
-
if get_option('examples').to_lower() == 'all'
- examples = all_examples
+ requested_examples = all_examples
allow_skips = true # don't flag an error if we can't build an app
else
- examples = get_option('examples').split(',')
+ requested_examples = get_option('examples').split(',')
allow_skips = false # error out if we can't build a requested app
endif
default_cflags = machine_args
@@ -64,7 +60,9 @@ if cc.has_argument('-Wno-format-truncation')
default_cflags += '-Wno-format-truncation'
endif
-foreach example: examples
+# iterate through all examples to see what we need to install
+# only actually build requested ones
+foreach example: all_examples
name = example.split('/')[-1]
build = true
sources = []
@@ -81,22 +79,36 @@ foreach example: examples
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))
+ message('Missing dependency "@0@" for example "@1@"'.format(d, name))
+ build = false
+ else
+ dep_objs += [get_variable(var_name)]
endif
- dep_objs += [get_variable(var_name)]
endforeach
- if allow_experimental_apis
- cflags += '-DALLOW_EXPERIMENTAL_API'
+ endif # build
+
+ if not build
+ # exclude based on top-level directory only
+ dir = example.split('/')[0]
+ dpdk_examples_exclude += dir
+ message('Excluding example directory "@0@" from install'.format(dir))
+ endif
+
+ if requested_examples.contains(example)
+ if build
+ if allow_experimental_apis
+ cflags += '-DALLOW_EXPERIMENTAL_API'
+ endif
+ executable('dpdk-' + name, sources,
+ include_directories: includes,
+ link_whole: link_whole_libs,
+ link_args: dpdk_extra_ldflags,
+ c_args: cflags,
+ dependencies: dep_objs)
+ elif not allow_skips
+ error('Cannot build requested example "' + name + '"')
+ else
+ message('Skipping example "' + name + '"')
endif
- executable('dpdk-' + name, sources,
- include_directories: includes,
- link_whole: link_whole_libs,
- link_args: dpdk_extra_ldflags,
- c_args: cflags,
- dependencies: dep_objs)
- elif not allow_skips
- error('Cannot build requested example "' + name + '"')
- else
- message('Skipping example "' + name + '"')
endif
endforeach
diff --git a/meson.build b/meson.build
index 45d974cd2..559a9d2f1 100644
--- a/meson.build
+++ b/meson.build
@@ -58,9 +58,11 @@ subdir('doc')
# build any examples explicitly requested - useful for developers - and
# install any example code into the appropriate install path
+dpdk_examples_exclude = []
subdir('examples')
install_subdir('examples',
install_dir: get_option('datadir') + '/dpdk',
+ exclude_directories: dpdk_examples_exclude,
exclude_files: 'meson.build')
# build kernel modules if enabled
--
2.25.1
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/4] improve examples installation
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
` (3 preceding siblings ...)
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 4/4] examples: skip installing unbuildable examples Bruce Richardson
@ 2020-11-12 11:14 ` David Marchand
2020-11-12 11:38 ` Bruce Richardson
2020-11-12 18:36 ` Thomas Monjalon
5 siblings, 1 reply; 27+ messages in thread
From: David Marchand @ 2020-11-12 11:14 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, Thomas Monjalon
On Thu, Nov 12, 2020 at 10:42 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> This patch improves the installation of the examples when "ninja install" is
> run. It removes issues with the directory structure being flattened out, and
> removes from the install list any examples that are not buildable with built
> DPDK code.
>
> V4: resubmit v3 to retest in CI hopefully with proper patch tracking
>
> V3: fix issues with building on Windows
>
> V2: add support for filtering examples that won't build
>
> Bruce Richardson (4):
> examples: fix flattening directory layout on install
> examples/l2fwd-keepalive: skip build when no librt
> examples: stop processing build file if build is impossible
> examples: skip installing unbuildable examples
Thanks Bruce.
This series looks good to me.
My only comment is about vm_power_manager which won't build without
the internal librte_power header.
It builds fine with meson, because I guess meson pulls this library
directory into the include flags of the example, but it won't build
outside.
We can skip it in devtools/test-meson-builds.sh but, on the other
hand, I would exclude it from installing until it is fixed (in a
future release).
--
David Marchand
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/4] improve examples installation
2020-11-12 11:14 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation David Marchand
@ 2020-11-12 11:38 ` Bruce Richardson
2020-11-12 13:48 ` David Marchand
0 siblings, 1 reply; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 11:38 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Thomas Monjalon
On Thu, Nov 12, 2020 at 12:14:27PM +0100, David Marchand wrote:
> On Thu, Nov 12, 2020 at 10:42 AM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > This patch improves the installation of the examples when "ninja install" is
> > run. It removes issues with the directory structure being flattened out, and
> > removes from the install list any examples that are not buildable with built
> > DPDK code.
> >
> > V4: resubmit v3 to retest in CI hopefully with proper patch tracking
> >
> > V3: fix issues with building on Windows
> >
> > V2: add support for filtering examples that won't build
> >
> > Bruce Richardson (4):
> > examples: fix flattening directory layout on install
> > examples/l2fwd-keepalive: skip build when no librt
> > examples: stop processing build file if build is impossible
> > examples: skip installing unbuildable examples
>
> Thanks Bruce.
> This series looks good to me.
>
> My only comment is about vm_power_manager which won't build without
> the internal librte_power header.
> It builds fine with meson, because I guess meson pulls this library
> directory into the include flags of the example, but it won't build
> outside.
>
> We can skip it in devtools/test-meson-builds.sh but, on the other
> hand, I would exclude it from installing until it is fixed (in a
> future release).
>
Yes, good point.
Rather than adding special logic for it, I think we just add it in the
initialization of the exclusion array in patch 4, i.e.
-dpdk_examples_exclude = []$
+dpdk_examples_exclude = ['vm_power_manager']
Can this be done on apply, or do you want a v5 for it?
/Bruce
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/4] improve examples installation
2020-11-12 11:38 ` Bruce Richardson
@ 2020-11-12 13:48 ` David Marchand
2020-11-12 14:57 ` Bruce Richardson
0 siblings, 1 reply; 27+ messages in thread
From: David Marchand @ 2020-11-12 13:48 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, Thomas Monjalon
On Thu, Nov 12, 2020 at 12:38 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> > My only comment is about vm_power_manager which won't build without
> > the internal librte_power header.
> > It builds fine with meson, because I guess meson pulls this library
> > directory into the include flags of the example, but it won't build
> > outside.
> >
> > We can skip it in devtools/test-meson-builds.sh but, on the other
> > hand, I would exclude it from installing until it is fixed (in a
> > future release).
> >
> Yes, good point.
> Rather than adding special logic for it, I think we just add it in the
> initialization of the exclusion array in patch 4, i.e.
>
> -dpdk_examples_exclude = []$
> +dpdk_examples_exclude = ['vm_power_manager']
>
> Can this be done on apply, or do you want a v5 for it?
CI is happy with v4.
I tested this additional change, lgtm too.
I would add something in the commitlog to give some context:
"""
vm_power_manager relies on an internal header and can't build outside
the dpdk tree.
Hence, it is still built with meson but it is excluded from install
examples until it has been fixed.
"""
WDYT?
--
David Marchand
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/4] improve examples installation
2020-11-12 13:48 ` David Marchand
@ 2020-11-12 14:57 ` Bruce Richardson
0 siblings, 0 replies; 27+ messages in thread
From: Bruce Richardson @ 2020-11-12 14:57 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Thomas Monjalon
On Thu, Nov 12, 2020 at 02:48:52PM +0100, David Marchand wrote:
> On Thu, Nov 12, 2020 at 12:38 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> > > My only comment is about vm_power_manager which won't build without
> > > the internal librte_power header.
> > > It builds fine with meson, because I guess meson pulls this library
> > > directory into the include flags of the example, but it won't build
> > > outside.
> > >
> > > We can skip it in devtools/test-meson-builds.sh but, on the other
> > > hand, I would exclude it from installing until it is fixed (in a
> > > future release).
> > >
> > Yes, good point.
> > Rather than adding special logic for it, I think we just add it in the
> > initialization of the exclusion array in patch 4, i.e.
> >
> > -dpdk_examples_exclude = []$
> > +dpdk_examples_exclude = ['vm_power_manager']
> >
> > Can this be done on apply, or do you want a v5 for it?
>
> CI is happy with v4.
>
> I tested this additional change, lgtm too.
> I would add something in the commitlog to give some context:
>
> """
> vm_power_manager relies on an internal header and can't build outside
> the dpdk tree.
> Hence, it is still built with meson but it is excluded from install
> examples until it has been fixed.
> """
>
> WDYT?
>
LGTM
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v4 4/4] examples: skip installing unbuildable examples
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 4/4] examples: skip installing unbuildable examples Bruce Richardson
@ 2020-11-12 17:06 ` Thomas Monjalon
0 siblings, 0 replies; 27+ messages in thread
From: Thomas Monjalon @ 2020-11-12 17:06 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, david.marchand
12/11/2020 10:41, Bruce Richardson:
> Rather than just installing all examples, we can use the build checks to
> filter out any examples that are missing dependencies or are otherwise
> unbuildable on the current system.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
This patch does not say why unbuildable examples should not be installed?
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/4] improve examples installation
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
` (4 preceding siblings ...)
2020-11-12 11:14 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation David Marchand
@ 2020-11-12 18:36 ` Thomas Monjalon
5 siblings, 0 replies; 27+ messages in thread
From: Thomas Monjalon @ 2020-11-12 18:36 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, david.marchand
12/11/2020 10:41, Bruce Richardson:
> This patch improves the installation of the examples when "ninja install" is
> run. It removes issues with the directory structure being flattened out, and
> removes from the install list any examples that are not buildable with built
> DPDK code.
>
> V4: resubmit v3 to retest in CI hopefully with proper patch tracking
>
> V3: fix issues with building on Windows
>
> V2: add support for filtering examples that won't build
>
> Bruce Richardson (4):
> examples: fix flattening directory layout on install
> examples/l2fwd-keepalive: skip build when no librt
> examples: stop processing build file if build is impossible
> examples: skip installing unbuildable examples
Applied without last patch, thanks.
After offline discussions with Bruce and David,
the decision is to rework the patch 4 as part of another series
that David is preparing.
In short: we keep the option to install all examples
and add a new option to install only buildable examples.
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2020-11-12 18:36 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 17:08 [dpdk-dev] [PATCH] install: fix flattening of examples directory Bruce Richardson
2020-11-10 17:09 ` Bruce Richardson
2020-11-10 17:14 ` David Marchand
2020-11-10 17:33 ` [dpdk-dev] [dpdk-stable] " David Marchand
2020-11-10 17:42 ` Bruce Richardson
2020-11-11 15:56 ` [dpdk-dev] [PATCH v2 1/2] examples: fix flattening directory layout on install Bruce Richardson
2020-11-11 15:56 ` [dpdk-dev] [PATCH v2 2/2] examples: skip installing unbuildable examples Bruce Richardson
2020-11-11 17:33 ` Bruce Richardson
2020-11-12 9:14 ` David Marchand
2020-11-12 9:24 ` Bruce Richardson
2020-11-12 9:27 ` David Marchand
2020-11-12 9:35 ` Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 1/4] examples: fix flattening directory layout on install Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 2/4] examples/l2fwd-keepalive: skip build when no librt Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 3/4] examples: stop processing build file if build is impossible Bruce Richardson
2020-11-11 17:48 ` [dpdk-dev] [PATCH v3 4/4] examples: skip installing unbuildable examples Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 1/4] examples: fix flattening directory layout on install Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 2/4] examples/l2fwd-keepalive: skip build when no librt Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 3/4] examples: stop processing build file if build is impossible Bruce Richardson
2020-11-12 9:41 ` [dpdk-dev] [PATCH v4 4/4] examples: skip installing unbuildable examples Bruce Richardson
2020-11-12 17:06 ` Thomas Monjalon
2020-11-12 11:14 ` [dpdk-dev] [PATCH v4 0/4] improve examples installation David Marchand
2020-11-12 11:38 ` Bruce Richardson
2020-11-12 13:48 ` David Marchand
2020-11-12 14:57 ` Bruce Richardson
2020-11-12 18:36 ` Thomas Monjalon
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).