[1/2] build: allow to conditionally build apps
Checks
Commit Message
Makes apps configureable from meson, like already
possible for drivers.
Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
app/meson.build | 17 ++++++++++++-----
meson_options.txt | 4 ++++
2 files changed, 16 insertions(+), 5 deletions(-)
Comments
On Wed, Oct 12, 2022 at 04:47:03PM +0200, Markus Theil wrote:
> Makes apps configureable from meson, like already
> possible for drivers.
>
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> ---
> app/meson.build | 17 ++++++++++++-----
> meson_options.txt | 4 ++++
> 2 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/app/meson.build b/app/meson.build
> index 93d8c15032..4d9c8ee814 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
> @@ -56,10 +67,6 @@ foreach app:apps
> endforeach
> endif
>
> - if not build
> - continue
> - endif
> -
Does this block not still need to be kept? Is it possible that build could
be set to false in the subdir or other logic?
/Bruce
On 10/12/22 17:19, Bruce Richardson wrote:
> On Wed, Oct 12, 2022 at 04:47:03PM +0200, Markus Theil wrote:
>> Makes apps configureable from meson, like already
>> possible for drivers.
>>
>> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
>> ---
>> app/meson.build | 17 ++++++++++++-----
>> meson_options.txt | 4 ++++
>> 2 files changed, 16 insertions(+), 5 deletions(-)
>>
>> diff --git a/app/meson.build b/app/meson.build
>> index 93d8c15032..4d9c8ee814 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
>> @@ -56,10 +67,6 @@ foreach app:apps
>> endforeach
>> endif
>>
>> - if not build
>> - continue
>> - endif
>> -
> Does this block not still need to be kept? Is it possible that build could
> be set to false in the subdir or other logic?
I will move the block to its old position in the next revision. Thanks
for the hint.
> /Bruce
On Thu, Oct 13, 2022 at 05:11:38PM +0200, Markus Theil wrote:
> On 10/12/22 17:19, Bruce Richardson wrote:
> > On Wed, Oct 12, 2022 at 04:47:03PM +0200, Markus Theil wrote:
> > > Makes apps configureable from meson, like already
> > > possible for drivers.
> > >
> > > Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> > > ---
> > > app/meson.build | 17 ++++++++++++-----
> > > meson_options.txt | 4 ++++
> > > 2 files changed, 16 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/app/meson.build b/app/meson.build
> > > index 93d8c15032..4d9c8ee814 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
> > > @@ -56,10 +67,6 @@ foreach app:apps
> > > endforeach
> > > endif
> > > - if not build
> > > - continue
> > > - endif
> > > -
> > Does this block not still need to be kept? Is it possible that build could
> > be set to false in the subdir or other logic?
> I will move the block to its old position in the next revision. Thanks for
> the hint.
Not sure you need to undo the move, you might just need two copies of the
check. If an app is explicitly disabled, you may want to skip the
"subdir()" call, so having two "if not build" checks would make sense.
/Bruce
@@ -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
@@ -56,10 +67,6 @@ foreach app:apps
endforeach
endif
- if not build
- continue
- endif
-
link_libs = []
if get_option('default_library') == 'static'
link_libs = dpdk_static_libraries + dpdk_drivers
@@ -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: