DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject
@ 2022-04-18 14:48 Ben Magistro
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Magistro @ 2022-04-18 14:48 UTC (permalink / raw)
  To: bruce.richardson, stephen, dev

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

I am currently in the process of trying to embed DPDK into a project
utilizing meson's subproject so have some interest in this patch now.  To
Bruce's question, I believe default_library parameter that would be passed
when including the subproject would correctly handle flipping between
static and shared for the dependency.

Still learning/figuring out meson (and hoping this gets attached to the
patch discussion).

[-- Attachment #2: Type: text/html, Size: 474 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject
  2021-11-05 18:11   ` Bruce Richardson
@ 2022-02-02 20:59     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2022-02-02 20:59 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Bruce Richardson, david.marchand

05/11/2021 19:11, Bruce Richardson:
> On Fri, Nov 05, 2021 at 10:22:13AM -0700, Stephen Hemminger wrote:
> > +# 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
> 
> Minor nit, but the dpdk_libraries is always the shared libs, it's
> dpdk_static_libraries in the static case. Since elsewhere you switched on
> the "default_library" value, maybe you should do so here.
> 
> Personally, I'd tend more towards having two new vars, "dpdk_libs_deps" and
> "dpdk_static_libs_deps", and then define two global dependency objects:
> "libdpdk_dep" and "libdpdk_static_dep", to make it easy for subprojects to
> pull in the one they want.

I don't want to merge this patch without having an answer to this comment.
Stephen, what do you think?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject
  2021-11-05 17:22 ` [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject Stephen Hemminger
@ 2021-11-05 18:11   ` Bruce Richardson
  2022-02-02 20:59     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2021-11-05 18:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Fri, Nov 05, 2021 at 10:22:13AM -0700, Stephen Hemminger wrote:
> 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@networkplumber.org>

One comment inline below. Otherwise:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
> 
> 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

Minor nit, but the dpdk_libraries is always the shared libs, it's
dpdk_static_libraries in the static case. Since elsewhere you switched on
the "default_library" value, maybe you should do so here.

Personally, I'd tend more towards having two new vars, "dpdk_libs_deps" and
"dpdk_static_libs_deps", and then define two global dependency objects:
"libdpdk_dep" and "libdpdk_static_dep", to make it easy for subprojects to
pull in the one they want.

> +    )
> +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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject
  2021-11-03 22:12 [dpdk-dev] [RFC] build: allow build DPDK as a meson submodule Stephen Hemminger
@ 2021-11-05 17:22 ` Stephen Hemminger
  2021-11-05 18:11   ` Bruce Richardson
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2021-11-05 17:22 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Stephen Hemminger

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@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-18 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 14:48 [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject Ben Magistro
  -- strict thread matches above, loose matches on Subject: below --
2021-11-03 22:12 [dpdk-dev] [RFC] build: allow build DPDK as a meson submodule Stephen Hemminger
2021-11-05 17:22 ` [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject Stephen Hemminger
2021-11-05 18:11   ` Bruce Richardson
2022-02-02 20:59     ` Thomas Monjalon

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).