[v4,1/2] build: allow to conditionally build apps

Message ID 20221014075118.10083-1-markus.theil@tu-ilmenau.de (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v4,1/2] build: allow to conditionally build apps |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Markus Theil Oct. 14, 2022, 7:51 a.m. UTC
Makes apps configurable from meson, like already
possible for drivers.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
 app/meson.build   | 13 ++++++++++++-
 meson_options.txt |  4 ++++
 2 files changed, 16 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson Oct. 14, 2022, 8:44 a.m. UTC | #1
On Fri, Oct 14, 2022 at 09:51:17AM +0200, Markus Theil wrote:
> Makes apps configurable from meson, like already
> possible for drivers.
> 
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> ---

Seems reasonable enough.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
David Marchand Oct. 27, 2022, 1:13 p.m. UTC | #2
On Fri, Oct 14, 2022 at 9:51 AM Markus Theil <markus.theil@tu-ilmenau.de> wrote:
>
> Makes apps configurable from meson, like already
> possible for drivers.
>
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>

With these new options, it's hard to tell which and why some
application is built (or not).
Can we have an output similar to libraries and drivers (see toplevel
meson.build) ?
  
David Marchand Oct. 27, 2022, 2:22 p.m. UTC | #3
On Thu, Oct 27, 2022 at 3:13 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Fri, Oct 14, 2022 at 9:51 AM Markus Theil <markus.theil@tu-ilmenau.de> wrote:
> >
> > Makes apps configurable from meson, like already
> > possible for drivers.
> >
> > Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
>
> With these new options, it's hard to tell which and why some
> application is built (or not).
> Can we have an output similar to libraries and drivers (see toplevel
> meson.build) ?

WDYT of followup patch: https://github.com/david-marchand/dpdk/commit/apps
  
Markus Theil Oct. 28, 2022, 6:43 a.m. UTC | #4
On 10/27/22 16:22, David Marchand wrote:
> On Thu, Oct 27, 2022 at 3:13 PM David Marchand
> <david.marchand@redhat.com> wrote:
>> On Fri, Oct 14, 2022 at 9:51 AM Markus Theil <markus.theil@tu-ilmenau.de> wrote:
>>> Makes apps configurable from meson, like already
>>> possible for drivers.
>>>
>>> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
>> With these new options, it's hard to tell which and why some
>> application is built (or not).
>> Can we have an output similar to libraries and drivers (see toplevel
>> meson.build) ?
> WDYT of followup patch: https://github.com/david-marchand/dpdk/commit/apps
>
>
LGTM
  
David Marchand Oct. 28, 2022, 12:31 p.m. UTC | #5
On Fri, Oct 14, 2022 at 10:45 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Fri, Oct 14, 2022 at 09:51:17AM +0200, Markus Theil wrote:
> > Makes apps configurable from meson, like already
> > possible for drivers.
> >
> > Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Series applied, thanks.
I'll send the followup patch I suggested, please (formally) review it.
  

Patch

diff --git a/app/meson.build b/app/meson.build
index 93d8c15032..96b9a78d3a 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -1,6 +1,9 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2019 Intel Corporation
 
+enabled_apps = get_option('enable_apps')
+disabled_apps = get_option('disable_apps')
+
 apps = [
         'dumpcap',
         'pdump',
@@ -27,7 +30,11 @@  if get_option('default_library') == 'static' and not is_windows
 endif
 
 foreach app:apps
-    build = true
+    build = enabled_apps == '' or enabled_apps.contains(app)
+    # let disabled_apps override enabled_apps
+    if disabled_apps != ''
+        build = build and not disabled_apps.contains(app)
+    endif
     name = app
     sources = []
     includes = []
@@ -41,6 +48,10 @@  foreach app:apps
     ext_deps = []
     deps = []
 
+    if not build
+        continue
+    endif
+
     subdir(name)
 
     if build
diff --git a/meson_options.txt b/meson_options.txt
index 0574dd0fff..9f032d454d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,6 +6,8 @@  option('cpu_instruction_set', type: 'string', value: 'auto',
 	description: 'Set the target machine ISA (instruction set architecture). Will be set according to the platform option by default.')
 option('developer_mode', type: 'feature', description:
        'turn on additional build checks relevant for DPDK developers')
+option('disable_apps', type: 'string', value: '', description:
+       'Comma-separated list of apps to explicitly disable.')
 option('disable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to explicitly disable.')
 option('disable_libs', type: 'string', value: 'kni', description:
@@ -14,6 +16,8 @@  option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-<VERSION>', d
        'Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.')
 option('enable_docs', type: 'boolean', value: false, description:
        'build documentation')
+option('enable_apps', type: 'string', value: '', description:
+       'Comma-separated list of apps to build. If unspecified, build all apps.')
 option('enable_drivers', type: 'string', value: '', description:
        'Comma-separated list of drivers to build. If unspecified, build all drivers.')
 option('enable_driver_sdk', type: 'boolean', value: false, description: