From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH v4 4/4] examples: skip installing unbuildable examples
Date: Thu, 12 Nov 2020 09:41:42 +0000 [thread overview]
Message-ID: <20201112094142.1781861-5-bruce.richardson@intel.com> (raw)
In-Reply-To: <20201112094142.1781861-1-bruce.richardson@intel.com>
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
next prev parent reply other threads:[~2020-11-12 9:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Bruce Richardson [this message]
2020-11-12 17:06 ` [dpdk-dev] [PATCH v4 4/4] examples: skip installing unbuildable examples 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201112094142.1781861-5-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).