From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Reshma Pattan <reshma.pattan@intel.com>,
Nicolas Chautru <nicolas.chautru@intel.com>,
Brian Dooley <brian.dooley@intel.com>,
Aman Singh <aman.deep.singh@intel.com>,
Akhil Goyal <gakhil@marvell.com>,
Fan Zhang <fanzhang.oss@gmail.com>,
David Hunt <david.hunt@intel.com>,
Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Subject: [PATCH v6 1/8] build: introduce optional internal dependencies
Date: Tue, 18 Feb 2025 11:15:27 +0000 [thread overview]
Message-ID: <6a2c1083c2196b6dbf39f3fe043e3336e5216358.1739877266.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1739877265.git.anatoly.burakov@intel.com>
Allow specifying internal dependencies as either mandatory or optional.
Specifying a dependency as optional will mean that the component being
built will be skipped if said dependency is not being built. At build
time, the build system will resolve any optional dependencies and add
them to the list of dependencies to be built. Any source files requiring
said optional depepdencies will still have to be added explicitly to the
build by the respective component (e.g. adding BPF-related files when BPF
support is being built).
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
Notes:
v4 -> v5:
- Automatically handle optional dependencies based on Bruce's
earlier patch [1]
[1] https://patches.dpdk.org/project/dpdk/patch/20231220142152.492556-4-bruce.richardson@intel.com/
app/meson.build | 14 ++++++-
app/proc-info/meson.build | 4 +-
app/test-bbdev/meson.build | 18 +++------
app/test-crypto-perf/meson.build | 4 +-
app/test-pmd/meson.build | 56 +++++++++------------------
app/test/meson.build | 12 +++---
drivers/meson.build | 13 ++++++-
examples/ethtool/meson.build | 4 +-
examples/l2fwd-crypto/meson.build | 4 +-
examples/l3fwd/meson.build | 4 +-
examples/meson.build | 13 ++++++-
examples/vm_power_manager/meson.build | 16 +++-----
lib/meson.build | 13 ++++++-
13 files changed, 89 insertions(+), 86 deletions(-)
diff --git a/app/meson.build b/app/meson.build
index e2db888ae1..61202495bd 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -66,6 +66,7 @@ foreach app:apps
# external package/library requirements
ext_deps = []
deps = []
+ optional_deps = []
if not enable_apps.contains(app)
build = false
@@ -83,10 +84,19 @@ foreach app:apps
endif
endif
+ # resolve any optional internal dependencies
+ def_lib = get_option('default_library')
+ foreach d: optional_deps
+ # if optional dependency is defined, add it to the deps list
+ if is_variable(def_lib + '_rte_' + d)
+ deps += [d]
+ endif
+ endforeach
+
if build
dep_objs = []
foreach d:deps
- var_name = get_option('default_library') + '_rte_' + d
+ var_name = def_lib + '_rte_' + d
if not is_variable(var_name)
build = false
reason = 'missing internal dependency, "@0@"'.format(d)
@@ -111,7 +121,7 @@ foreach app:apps
dpdk_apps_enabled += app
link_libs = []
- if get_option('default_library') == 'static'
+ if def_lib == 'static'
link_libs = dpdk_static_libraries + dpdk_drivers
endif
diff --git a/app/proc-info/meson.build b/app/proc-info/meson.build
index 316253cd5d..51315f72a1 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 85b060edec..d41bd60396 100644
--- a/app/test-bbdev/meson.build
+++ b/app/test-bbdev/meson.build
@@ -14,17 +14,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_fpga_lte_fec',
+ 'baseband_fpga_5gnr_fec',
+ 'baseband_acc',
+ 'baseband_la12xx',
+]
cflags += no_wvla_cflag
diff --git a/app/test-crypto-perf/meson.build b/app/test-crypto-perf/meson.build
index 87dd3bc5f1..fb48d9ec29 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 f1c36529b4..bbc8d429f8 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -34,47 +34,29 @@ sources = files(
if dpdk_conf.has('RTE_HAS_JANSSON')
ext_deps += jansson_dep
endif
-
-deps += ['ethdev', 'cmdline']
-if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
- deps += 'crypto_scheduler'
-endif
-if dpdk_conf.has('RTE_LIB_BITRATESTATS')
- deps += 'bitratestats'
-endif
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
+deps += ['ethdev', 'cmdline']
+optional_deps += [
+ 'crypto_scheduler',
+ 'bitratestats',
+ 'bpf',
+ 'gro',
+ 'gso',
+ 'latencystats',
+ 'metrics',
+ 'pdump',
+ 'net_bnxt',
+ 'net_i40e',
+ 'net_ixgbe',
+ 'bus_dpaa',
+ 'mempool_dpaa',
+ 'net_dpaa',
+]
+
# Driver-specific commands are located in driver directories.
includes = include_directories('.')
sources += testpmd_drivers_sources
-deps += testpmd_drivers_deps
+optional_deps += testpmd_drivers_deps
diff --git a/app/test/meson.build b/app/test/meson.build
index b6285a6b45..eb0447e8c6 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -7,7 +7,7 @@ sources += files('commands.c', 'test.c')
# optional dependencies: some files may use these - and so we should link them in -
# but do not explicitly require them so they are not listed in the per-file lists below
-optional_deps = ['crypto_scheduler', 'lpm']
+opt_deps = ['crypto_scheduler', 'lpm']
# some other utility C files, providing functions used by various tests
# so we need to include these deps in the dependency list for the files using those fns.
@@ -222,8 +222,8 @@ foreach f, f_deps : source_file_deps
break
else
# technically we might not need this dep, but adding it is harmless
- if d not in deps
- deps += d
+ if d not in optional_deps and d not in deps
+ optional_deps += d
endif
endif
endforeach
@@ -244,9 +244,9 @@ foreach f, f_deps : source_file_deps
endif
endforeach
# add the optional dependencies
-foreach d:optional_deps
- if is_variable(def_lib + '_rte_' + d) and d not in deps
- deps += d
+foreach d:opt_deps
+ if d not in optional_deps and d not in deps
+ optional_deps += d
endif
endforeach
diff --git a/drivers/meson.build b/drivers/meson.build
index 05391a575d..fb48e11eaf 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -133,6 +133,7 @@ foreach subpath:subdirs
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
+ 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
@@ -178,11 +179,21 @@ foreach subpath:subdirs
# get dependency objs from strings
shared_deps = ext_deps
static_deps = ext_deps
+
+ # resolve any optional internal dependencies
+ def_lib = get_option('default_library')
+ foreach d: optional_deps
+ # if optional dependency is defined, add it to the deps list
+ if is_variable(def_lib + '_rte_' + d)
+ deps += [d]
+ endif
+ endforeach
+
foreach d:deps
if not build
break
endif
- if not is_variable('shared_rte_' + d)
+ if not is_variable(def_lib + '_rte_' + d)
build = false
reason = 'missing internal dependency, "@0@"'.format(d)
if dpdk_libs_deprecated.contains(d)
diff --git a/examples/ethtool/meson.build b/examples/ethtool/meson.build
index d7f63d48af..bb2a7fbb89 100644
--- a/examples/ethtool/meson.build
+++ b/examples/ethtool/meson.build
@@ -19,8 +19,6 @@ sources = files(
includes = include_directories('lib', 'ethtool-app')
deps += 'bus_pci'
-if dpdk_conf.has('RTE_NET_IXGBE')
- deps += 'net_ixgbe'
-endif
+optional_deps += 'net_ixgbe'
allow_experimental_apis = true
diff --git a/examples/l2fwd-crypto/meson.build b/examples/l2fwd-crypto/meson.build
index c21722b85c..2a1070707e 100644
--- a/examples/l2fwd-crypto/meson.build
+++ b/examples/l2fwd-crypto/meson.build
@@ -7,9 +7,7 @@
# DPDK instance, use 'make'
deps += 'cryptodev'
-if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
- deps += 'crypto_scheduler'
-endif
+optional_deps += 'crypto_scheduler'
allow_experimental_apis = true
sources = files(
'main.c',
diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build
index 74144c7979..9a9f2c6d40 100644
--- a/examples/l3fwd/meson.build
+++ b/examples/l3fwd/meson.build
@@ -18,7 +18,5 @@ sources = files(
'l3fwd_lpm.c',
'main.c',
)
-if dpdk_conf.has('RTE_LIB_EVENTDEV')
- deps += 'eventdev'
-endif
+optional_deps += 'eventdev'
cflags += no_wvla_cflag
diff --git a/examples/meson.build b/examples/meson.build
index 8e8968a1fa..14b8aadf68 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -98,12 +98,23 @@ foreach example: examples
ext_deps = []
includes = [include_directories(example, 'common')]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
+ optional_deps = []
subdir(example)
if build
dep_objs = ext_deps
+
+ # resolve any optional internal dependencies
+ def_lib = get_option('default_library')
+ foreach d: optional_deps
+ # if optional dependency is defined, add it to the deps list
+ if is_variable(def_lib + '_rte_' + d)
+ deps += [d]
+ endif
+ endforeach
+
foreach d:deps
- var_name = get_option('default_library') + '_rte_' + d
+ var_name = def_lib + '_rte_' + d
if not is_variable(var_name)
build = false
message('Missing dependency "@0@" for example "@1@"'.format(d, name))
diff --git a/examples/vm_power_manager/meson.build b/examples/vm_power_manager/meson.build
index dcf23198eb..6fc081b06b 100644
--- a/examples/vm_power_manager/meson.build
+++ b/examples/vm_power_manager/meson.build
@@ -8,17 +8,11 @@
deps += ['power', 'power_kvm_vm']
-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
+optional_deps += [
+ 'net_bnxt',
+ 'net_i40e',
+ 'net_ixgbe',
+]
allow_experimental_apis = true
sources = files(
diff --git a/lib/meson.build b/lib/meson.build
index ce92cb5537..76bf849852 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -134,6 +134,7 @@ foreach l:libraries
# external package/library requirements
ext_deps = []
deps = []
+ optional_deps = []
# eal is standard dependency once built
if dpdk_conf.has('RTE_LIB_EAL')
deps += ['eal']
@@ -171,11 +172,21 @@ foreach l:libraries
shared_deps = ext_deps
static_deps = ext_deps
+
+ # resolve any optional internal dependencies
+ def_lib = get_option('default_library')
+ foreach d: optional_deps
+ # if optional dependency is defined, add it to the deps list
+ if is_variable(def_lib + '_rte_' + d)
+ deps += [d]
+ endif
+ endforeach
+
foreach d:deps
if not build
break
endif
- if not is_variable('shared_rte_' + d)
+ if not is_variable(def_lib + '_rte_' + d)
build = false
reason = 'missing internal dependency, "@0@"'.format(d)
if dpdk_libs_deprecated.contains(d)
--
2.43.5
next prev parent reply other threads:[~2025-02-18 11:15 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 14:55 [PATCH] build: output a dependency log in build directory Bruce Richardson
2024-07-31 9:07 ` Konstantin Ananyev
2024-07-31 10:17 ` Ferruh Yigit
2024-07-31 10:27 ` Bruce Richardson
2024-08-02 12:44 ` [PATCH v2 0/7] record and rework component dependencies Bruce Richardson
2024-08-02 12:44 ` [PATCH v2 1/7] build: output a dependency log in build directory Bruce Richardson
2024-09-02 14:34 ` Burakov, Anatoly
2024-09-03 8:31 ` Bruce Richardson
2024-08-02 12:44 ` [PATCH v2 2/7] devtools: add script to flag unneeded dependencies Bruce Richardson
2024-08-02 12:44 ` [PATCH v2 3/7] build: remove kvargs from driver class dependencies Bruce Richardson
2024-08-02 12:44 ` [PATCH v2 4/7] build: reduce library dependencies Bruce Richardson
2024-08-02 12:44 ` [PATCH v2 5/7] build: reduce driver dependencies Bruce Richardson
2024-08-02 12:44 ` [PATCH v2 6/7] build: reduce app dependencies Bruce Richardson
2024-08-02 12:44 ` [PATCH v2 7/7] devtools: add script to generate DPDK dependency graphs Bruce Richardson
2024-08-02 13:29 ` [PATCH v2 0/7] record and rework component dependencies Morten Brørup
2024-08-02 15:05 ` Patrick Robb
2024-08-02 15:11 ` Bruce Richardson
2024-08-02 17:18 ` Ferruh Yigit
2024-08-06 8:35 ` Bruce Richardson
2024-09-04 15:08 ` [PATCH v3 0/8] " Anatoly Burakov
2024-09-04 15:08 ` [PATCH v3 1/8] build: split dependencies into mandatory and optional Anatoly Burakov
2024-09-06 14:51 ` Bruce Richardson
2024-09-09 8:41 ` Burakov, Anatoly
2024-09-09 9:01 ` Bruce Richardson
2024-09-04 15:08 ` [PATCH v3 2/8] build: output a dependency log in build directory Anatoly Burakov
2024-09-04 15:08 ` [PATCH v3 3/8] devtools: add script to flag unneeded dependencies Anatoly Burakov
2024-09-04 15:08 ` [PATCH v3 4/8] build: remove kvargs from driver class dependencies Anatoly Burakov
2024-09-04 15:08 ` [PATCH v3 5/8] build: reduce library dependencies Anatoly Burakov
2024-09-04 15:08 ` [PATCH v3 6/8] build: reduce driver dependencies Anatoly Burakov
2024-09-04 15:08 ` [PATCH v3 7/8] build: reduce app dependencies Anatoly Burakov
2024-09-04 15:08 ` [PATCH v3 8/8] devtools: add script to generate DPDK dependency graphs Anatoly Burakov
2024-09-05 6:05 ` [PATCH v3 0/8] record and rework component dependencies Morten Brørup
2024-11-26 14:39 ` [PATCH v4 0/8] Record " Anatoly Burakov
2024-11-26 14:39 ` [PATCH v4 1/8] build: split dependencies into mandatory and optional Anatoly Burakov
2024-11-26 14:39 ` [PATCH v4 2/8] build: output a dependency log in build directory Anatoly Burakov
2024-11-26 14:39 ` [PATCH v4 3/8] devtools: add script to flag unneeded dependencies Anatoly Burakov
2024-11-26 14:39 ` [PATCH v4 4/8] build: remove kvargs from driver class dependencies Anatoly Burakov
2024-11-26 14:39 ` [PATCH v4 5/8] build: reduce library dependencies Anatoly Burakov
2024-11-26 14:39 ` [PATCH v4 6/8] build: reduce driver dependencies Anatoly Burakov
2024-11-27 2:17 ` Xu, Rosen
2024-11-26 14:39 ` [PATCH v4 7/8] build: reduce app dependencies Anatoly Burakov
2024-11-26 14:39 ` [PATCH v4 8/8] devtools: add script to generate DPDK dependency graphs Anatoly Burakov
2024-11-26 15:11 ` [PATCH v4 0/8] Record and rework component dependencies Burakov, Anatoly
2024-11-27 14:56 ` [PATCH v5 " Anatoly Burakov
2024-11-27 14:56 ` [PATCH v5 1/8] build: introduce optional internal dependencies Anatoly Burakov
2024-11-27 14:56 ` [PATCH v5 2/8] build: output a dependency log in build directory Anatoly Burakov
2024-11-27 14:56 ` [PATCH v5 3/8] devtools: add script to flag unneeded dependencies Anatoly Burakov
2024-11-27 14:56 ` [PATCH v5 4/8] build: remove kvargs from driver class dependencies Anatoly Burakov
2024-11-27 14:56 ` [PATCH v5 5/8] build: reduce library dependencies Anatoly Burakov
2024-11-27 14:56 ` [PATCH v5 6/8] build: reduce driver dependencies Anatoly Burakov
2024-11-27 16:19 ` Burakov, Anatoly
2024-12-16 16:06 ` David Marchand
2024-11-27 14:56 ` [PATCH v5 7/8] build: reduce app dependencies Anatoly Burakov
2024-11-27 14:56 ` [PATCH v5 8/8] devtools: add script to generate DPDK dependency graphs Anatoly Burakov
2025-02-18 11:15 ` [PATCH v6 0/8] Record and rework component dependencies Anatoly Burakov
2025-02-18 11:15 ` Anatoly Burakov [this message]
2025-02-18 11:28 ` [PATCH v6 1/8] build: introduce optional internal dependencies Bruce Richardson
2025-02-18 11:15 ` [PATCH v6 2/8] build: output a dependency log in build directory Anatoly Burakov
2025-02-18 11:15 ` [PATCH v6 3/8] devtools: add script to flag unneeded dependencies Anatoly Burakov
2025-02-18 11:15 ` [PATCH v6 4/8] drivers: remove kvargs from class dependencies Anatoly Burakov
2025-02-18 11:15 ` [PATCH v6 5/8] lib: reduce library dependencies Anatoly Burakov
2025-02-18 11:15 ` [PATCH v6 6/8] drivers: reduce driver dependencies Anatoly Burakov
2025-02-18 11:15 ` [PATCH v6 7/8] app: reduce app dependencies Anatoly Burakov
2025-02-19 8:05 ` David Marchand
2025-02-19 8:16 ` [EXTERNAL] " Akhil Goyal
2025-02-19 10:18 ` Morten Brørup
2025-02-19 10:21 ` Bruce Richardson
2025-02-19 10:50 ` Akhil Goyal
2025-02-18 11:15 ` [PATCH v6 8/8] devtools: add script to generate DPDK dependency graphs Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 0/8] Record and rework component dependencies Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 1/8] build: introduce optional internal dependencies Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 2/8] build: output a dependency log in build directory Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 3/8] devtools: add script to flag unneeded dependencies Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 4/8] drivers: remove kvargs from class dependencies Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 5/8] lib: reduce library dependencies Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 6/8] drivers: reduce driver dependencies Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 7/8] app: reduce app dependencies Anatoly Burakov
2025-02-19 10:57 ` [PATCH v7 8/8] devtools: add script to generate DPDK dependency graphs Anatoly Burakov
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=6a2c1083c2196b6dbf39f3fe043e3336e5216358.1739877266.git.anatoly.burakov@intel.com \
--to=anatoly.burakov@intel.com \
--cc=aman.deep.singh@intel.com \
--cc=brian.dooley@intel.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
--cc=nicolas.chautru@intel.com \
--cc=reshma.pattan@intel.com \
--cc=sivaprasad.tummala@amd.com \
/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).