From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [RFC PATCH 04/12] build: add direct support for optional dependencies
Date: Fri, 16 Oct 2026 11:59:42 +0100 [thread overview]
Message-ID: <20261016105950.273068-5-bruce.richardson@intel.com> (raw)
In-Reply-To: <20261016105950.273068-1-bruce.richardson@intel.com>
A number of DPDK components sometimes expose extra capabilities if other
drivers are present, without actually requiring that to be always
present. Standardize that design by way of an "optional_deps" variable
to be set in meson.build files.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
app/meson.build | 10 ++++++-
app/proc-info/meson.build | 4 +--
app/test-bbdev/meson.build | 18 ++++-------
app/test-crypto-perf/meson.build | 4 +--
app/test-pmd/meson.build | 50 ++++++++++---------------------
app/test/meson.build | 6 ----
drivers/meson.build | 9 ++++++
drivers/net/intel/ice/meson.build | 7 +++--
lib/meson.build | 10 ++++++-
9 files changed, 55 insertions(+), 63 deletions(-)
diff --git a/app/meson.build b/app/meson.build
index 7472d925b2..79a0672edc 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -63,9 +63,11 @@ foreach app:apps
# instruction-set optimized versions of code
# use "deps" for internal DPDK dependencies, and "ext_deps" for
- # external package/library requirements
+ # external package/library requirements. Use "optional_deps" for internal
+ # dependencies to link against only if they are already being built.
ext_deps = []
deps = []
+ optional_deps = []
if not enable_apps.contains(app)
build = false
@@ -99,6 +101,12 @@ foreach app:apps
endif
dep_objs += [get_variable(var_name)]
endforeach
+ foreach d:optional_deps
+ var_name = get_option('default_library') + '_rte_' + d
+ if is_variable(var_name) and not deps.contains(d)
+ dep_objs += [get_variable(var_name)]
+ endif
+ endforeach
endif
if not build
diff --git a/app/proc-info/meson.build b/app/proc-info/meson.build
index 316253cd5d..60c4eb2a90 100644
--- a/app/proc-info/meson.build
+++ b/app/proc-info/meson.build
@@ -9,8 +9,6 @@ endif
sources = files('main.c')
deps += ['ethdev', 'security', 'eventdev']
-if dpdk_conf.has('RTE_LIB_METRICS')
- deps += 'metrics'
-endif
+optional_deps = ['metrics']
cflags += no_wvla_cflag
diff --git a/app/test-bbdev/meson.build b/app/test-bbdev/meson.build
index f85a20c5b0..c3cdd4d7c5 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -8,17 +8,11 @@ sources = files(
'test_bbdev_vector.c',
)
deps += ['bbdev', 'bus_vdev']
-if dpdk_conf.has('RTE_BASEBAND_FPGA_LTE_FEC')
- deps += ['baseband_fpga_lte_fec']
-endif
-if dpdk_conf.has('RTE_BASEBAND_FPGA_5GNR_FEC')
- deps += ['baseband_fpga_5gnr_fec']
-endif
-if dpdk_conf.has('RTE_BASEBAND_ACC')
- deps += ['baseband_acc']
-endif
-if dpdk_conf.has('RTE_BASEBAND_LA12XX')
- deps += ['baseband_la12xx']
-endif
+optional_deps = [
+ 'baseband_acc',
+ 'baseband_fpga_5gnr_fec',
+ 'baseband_fpga_lte_fec',
+ 'baseband_la12xx',
+]
cflags += no_wvla_cflag
diff --git a/app/test-crypto-perf/meson.build b/app/test-crypto-perf/meson.build
index 87dd3bc5f1..76de68bfaf 100644
--- a/app/test-crypto-perf/meson.build
+++ b/app/test-crypto-perf/meson.build
@@ -20,8 +20,6 @@ sources = files(
'main.c',
)
deps += ['cryptodev', 'net', 'security']
-if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
- deps += 'crypto_scheduler'
-endif
+optional_deps = ['crypto_scheduler']
cflags += no_wvla_cflag
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 83163a5406..82ec6626f3 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -35,42 +35,24 @@ if dpdk_conf.has('RTE_HAS_JANSSON')
endif
deps += ['ethdev', 'cmdline', 'pci']
-if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
- deps += 'crypto_scheduler'
-endif
-if dpdk_conf.has('RTE_LIB_BITRATESTATS')
- deps += 'bitratestats'
-endif
+optional_deps = [
+ 'bitratestats',
+ 'bpf',
+ 'bus_dpaa',
+ 'crypto_scheduler',
+ 'gro',
+ 'gso',
+ 'latencystats',
+ 'mempool_dpaa',
+ 'metrics',
+ 'net_bnxt',
+ 'net_dpaa',
+ 'net_i40e',
+ 'net_ixgbe',
+ 'pdump',
+]
if dpdk_conf.has('RTE_LIB_BPF')
sources += files('bpf_cmd.c')
- deps += 'bpf'
-endif
-if dpdk_conf.has('RTE_LIB_GRO')
- deps += 'gro'
-endif
-if dpdk_conf.has('RTE_LIB_GSO')
- deps += 'gso'
-endif
-if dpdk_conf.has('RTE_LIB_LATENCYSTATS')
- deps += 'latencystats'
-endif
-if dpdk_conf.has('RTE_LIB_METRICS')
- deps += 'metrics'
-endif
-if dpdk_conf.has('RTE_LIB_PDUMP')
- deps += 'pdump'
-endif
-if dpdk_conf.has('RTE_NET_BNXT')
- deps += 'net_bnxt'
-endif
-if dpdk_conf.has('RTE_NET_I40E')
- deps += 'net_i40e'
-endif
-if dpdk_conf.has('RTE_NET_IXGBE')
- deps += 'net_ixgbe'
-endif
-if dpdk_conf.has('RTE_NET_DPAA')
- deps += ['bus_dpaa', 'mempool_dpaa', 'net_dpaa']
endif
# Driver-specific commands are located in driver directories.
diff --git a/app/test/meson.build b/app/test/meson.build
index 881b919b63..0b2f4fd708 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -259,12 +259,6 @@ foreach f, f_deps : source_file_deps
sources += files(f)
endif
endforeach
-# add the optional dependencies
-foreach d:optional_deps
- if is_variable(def_lib + '_rte_' + d) and d not in deps
- deps += d
- endif
-endforeach
cflags += no_wvla_cflag
cflags += no_shadow_cflag
diff --git a/drivers/meson.build b/drivers/meson.build
index 440c3959cf..e75fa983e2 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -174,6 +174,9 @@ foreach subpath:subdirs
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
+ # optional_deps: internal dependencies to link against only if they are
+ # already being built, rather than being always required
+ optional_deps = []
# ext_deps: Stores external library dependency got
# using dependency() (preferred) or find_library().
# For the find_library() case (but not with dependency()) we also
@@ -249,6 +252,12 @@ foreach subpath:subdirs
static_deps += [get_variable('static_rte_' + d)]
endif
endforeach
+ foreach d:optional_deps
+ if build and is_variable('shared_rte_' + d) and not deps.contains(d)
+ shared_deps += [get_variable('shared_rte_' + d)]
+ static_deps += [get_variable('static_rte_' + d)]
+ endif
+ endforeach
endif
if not build
diff --git a/drivers/net/intel/ice/meson.build b/drivers/net/intel/ice/meson.build
index 322d9597d2..e5ba7ac92c 100644
--- a/drivers/net/intel/ice/meson.build
+++ b/drivers/net/intel/ice/meson.build
@@ -22,9 +22,10 @@ testpmd_sources = files('ice_testpmd.c')
deps += ['hash', 'net']
-if dpdk_conf.has('RTE_NET_IAVF')
- deps += 'net_iavf'
-else
+# link against the iavf driver if it is being built, otherwise build the parts
+# of it needed here directly into this driver
+optional_deps = ['net_iavf']
+if not dpdk_conf.has('RTE_NET_IAVF')
includes += include_directories(
'../iavf',
'../iavf/base'
diff --git a/lib/meson.build b/lib/meson.build
index 0c5da21522..87bfb914e8 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -137,9 +137,11 @@ foreach l:libraries
# instruction-set optimized versions of code
# use "deps" for internal DPDK dependencies, and "ext_deps" for
- # external package/library requirements
+ # external package/library requirements. Use "optional_deps" for internal
+ # dependencies to link against only if they are already being built.
ext_deps = []
deps = []
+ optional_deps = []
if dpdk_conf.has('RTE_LIB_EAL')
# eal is standard dependency once built
deps += ['eal']
@@ -201,6 +203,12 @@ foreach l:libraries
static_deps += [get_variable('static_rte_' + d)]
endif
endforeach
+ foreach d:optional_deps
+ if build and is_variable('shared_rte_' + d) and not deps.contains(d)
+ shared_deps += [get_variable('shared_rte_' + d)]
+ static_deps += [get_variable('static_rte_' + d)]
+ endif
+ endforeach
if not build
dpdk_libs_disabled += name
--
2.53.0
next prev parent reply other threads:[~2026-10-16 11:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 10:59 [RFC PATCH 00/12] Add config-time dependency tracking Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 01/12] build: fix name of base library object Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 02/12] build: fix ignoring requested driver when class is disabled Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 03/12] build: prevent overlap of enable and disable lists Bruce Richardson
2026-10-16 10:59 ` Bruce Richardson [this message]
2026-10-16 10:59 ` [RFC PATCH 05/12] net/bond: rename directory for consistency Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 06/12] build: add script to generate dependencies list Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 07/12] build: use recursive addition for enabled libraries option Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 08/12] build: use recursive addition for enabled drivers option Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 09/12] build: improve error reporting for unbuildable components Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 10/12] build: add EAL common directory to global include list Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 11/12] build: make EAL an explicit dependency Bruce Richardson
2026-10-16 10:59 ` [RFC PATCH 12/12] build: simplify mandatory library lists Bruce Richardson
2026-10-16 14:35 ` [RFC PATCH 00/12] Add config-time dependency tracking David Marchand
2026-10-16 14:44 ` Bruce Richardson
2026-10-16 14:51 ` David Marchand
2026-10-16 15:42 ` Bruce Richardson
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=20261016105950.273068-5-bruce.richardson@intel.com \
--to=bruce.richardson@intel.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