[dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject
Stephen Hemminger
stephen at networkplumber.org
Fri Nov 5 18:22:13 CET 2021
Some other projects using meson may not be able to use DPDK
using the standard distribution pkg-config mechanism.
Meson supports a way to handle this via the subproject
https://mesonbuild.com/Subprojects.html
This patch adds the necessary dependency to follow the
"Naming convention for dependency variables" from the documentation.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
v2 - add link libraries
lib/meson.build | 5 +++++
meson.build | 13 +++++++++++++
2 files changed, 18 insertions(+)
diff --git a/lib/meson.build b/lib/meson.build
index 499d26060fdd..e6df538bd6ef 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -241,6 +241,11 @@ foreach l:libraries
dpdk_libraries = [shared_lib] + dpdk_libraries
dpdk_static_libraries = [static_lib] + dpdk_static_libraries
+ if get_option('default_library') == 'static'
+ dpdk_libs_deps += static_dep
+ else
+ dpdk_libs_deps += shared_dep
+ endif
set_variable('shared_rte_' + name, shared_dep)
set_variable('static_rte_' + name, static_dep)
diff --git a/meson.build b/meson.build
index 12cb6e0e83f3..3bf6bb794ce1 100644
--- a/meson.build
+++ b/meson.build
@@ -36,6 +36,7 @@ dpdk_drivers = []
dpdk_extra_ldflags = []
dpdk_libs_disabled = []
dpdk_drvs_disabled = []
+dpdk_libs_deps = []
abi_version_file = files('ABI_VERSION')
if host_machine.cpu_family().startswith('x86')
@@ -97,6 +98,18 @@ configure_file(output: build_cfg,
# build pkg-config files for dpdk
subdir('buildtools/pkg-config')
+# If DPDK is being built as subproject then define
+# variable with the dependency convention
+if meson.is_subproject()
+ libdpdk_dep = declare_dependency(
+ version: meson.project_version(),
+ compile_args : pkg_extra_cflags,
+ dependencies: dpdk_libs_deps,
+ link_args: dpdk_extra_ldflags,
+ link_with: dpdk_libraries
+ )
+endif
+
# final output, list all the libs and drivers to be built
# this does not affect any part of the build, for information only.
output_message = '\n=================\nLibraries Enabled\n=================\n'
--
2.30.2
More information about the dev
mailing list