[PATCH v3 3/3] build: RFC - add support for optional dependencies
Bruce Richardson
bruce.richardson at intel.com
Wed Dec 20 15:21:52 CET 2023
In order to remove more libraries from the mandatory list, we need to
have support for optionally having a dependency from a driver or library
to another driver or lib. This patch adds this support by adding a new
optional_deps variable, the contents of which are added to the deps list
if those optional dependencies are present in the build.
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
drivers/meson.build | 7 +++++++
lib/meson.build | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/drivers/meson.build b/drivers/meson.build
index 5ba534049a..af2d8da5a8 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -127,6 +127,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
@@ -168,6 +169,12 @@ foreach subpath:subdirs
# get dependency objs from strings
shared_deps = ext_deps
static_deps = ext_deps
+ foreach d:optional_deps
+ #if optional dep exists, add it to the deps list
+ if is_variable('shared_rte_' + d)
+ deps += d
+ endif
+ endforeach
foreach d:deps
if not build
break
diff --git a/lib/meson.build b/lib/meson.build
index 72e9138d14..733412c276 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -140,6 +140,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']
@@ -177,6 +178,12 @@ foreach l:libraries
shared_deps = ext_deps
static_deps = ext_deps
+ foreach d:optional_deps
+ #if optional dep exists, add it to the deps list
+ if is_variable('shared_rte_' + d)
+ deps += d
+ endif
+ endforeach
foreach d:deps
if not build
break
--
2.40.1
More information about the dev
mailing list