DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ben Magistro <koncept1@gmail.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [PATCH v3] build: add definitions for use as meson subproject
Date: Fri, 20 May 2022 20:54:11 -0400	[thread overview]
Message-ID: <CAKx8PBhT=6zhCNKDuCXhggu+8DkDAKQRAp8_kymdmDuk9LQnFg@mail.gmail.com> (raw)
In-Reply-To: <20220506144318.540584-1-bruce.richardson@intel.com>

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

Currently utilizing this in an upcoming set of changes for TLDK and all
seems to be working for fallback dependency support under both shared and
static linkage.

Reviewed-by: Ben Magistro <koncept1@gmail.com>
Tested-by: Ben Magistro <koncept1@gmail.com>

On Fri, May 6, 2022 at 10:43 AM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> To allow other projects to easily use DPDK as a subproject, add in the
> necessary dependency definitions. Slightly different definitions are
> necessary for static and shared builds, since for shared builds the
> drivers should not be linked in, and the internal meson dependency
> objects are more complete.
>
> To use DPDK as a subproject fallback i.e. use installed DPDK if present,
> otherwise the shipped one, the following meson statement can be used:
>
> libdpdk = dependency('libdpdk', fallback: ['dpdk', 'dpdk_dep'])
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  buildtools/subproject/meson.build | 21 +++++++++++++++++++++
>  drivers/meson.build               |  4 ++++
>  lib/meson.build                   |  2 ++
>  meson.build                       |  6 ++++++
>  4 files changed, 33 insertions(+)
>  create mode 100644 buildtools/subproject/meson.build
>
> diff --git a/buildtools/subproject/meson.build
> b/buildtools/subproject/meson.build
> new file mode 100644
> index 0000000000..3192efaa40
> --- /dev/null
> +++ b/buildtools/subproject/meson.build
> @@ -0,0 +1,21 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2022 Intel Corporation
> +
> +message('DPDK subproject linking: ' + get_option('default_library'))
> +if get_option('default_library') == 'static'
> +    dpdk_dep = declare_dependency(
> +            version: meson.project_version(),
> +            dependencies: dpdk_static_lib_deps,
> +            # static library deps in DPDK build don't include "link_with"
> parameters,
> +            # so explicitly link-in both libs and drivers
> +            link_with: dpdk_static_libraries,
> +            link_whole: dpdk_drivers,
> +            link_args: dpdk_extra_ldflags)
> +else
> +    dpdk_dep = declare_dependency(
> +            version: meson.project_version(),
> +            # shared library deps include all necessary linking parameters
> +            dependencies: dpdk_shared_lib_deps)
> +endif
> +
> +libdpdk_dep = dpdk_dep
> diff --git a/drivers/meson.build b/drivers/meson.build
> index 1d8123b00c..db4d9c73bd 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -245,6 +245,10 @@ foreach subpath:subdirs
>
>          set_variable('shared_@0@'.format(lib_name), shared_dep)
>          set_variable('static_@0@'.format(lib_name), static_dep)
> +        # for drivers, we only need to add dependency objects for static
> libs,
> +        # shared lib drivers are not linked in
> +        dpdk_static_lib_deps += static_dep
> +
>          dependency_name = ''.join(lib_name.split('rte_'))
>          if developer_mode
>              message('drivers/@0@: Defining dependency "@1@"'.format(
> diff --git a/lib/meson.build b/lib/meson.build
> index 24adbe44c9..c648f7d800 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -266,6 +266,8 @@ foreach l:libraries
>
>      set_variable('shared_rte_' + name, shared_dep)
>      set_variable('static_rte_' + name, static_dep)
> +    dpdk_shared_lib_deps += shared_dep
> +    dpdk_static_lib_deps += static_dep
>      if developer_mode
>          message('lib/@0@: Defining dependency "@1@"'.format(l, name))
>      endif
> diff --git a/meson.build b/meson.build
> index 937f6110c0..6085e32a79 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -36,6 +36,8 @@ dpdk_build_root = meson.current_build_dir()
>  dpdk_conf = configuration_data()
>  dpdk_libraries = []
>  dpdk_static_libraries = []
> +dpdk_shared_lib_deps = []
> +dpdk_static_lib_deps = []
>  dpdk_chkinc_headers = []
>  dpdk_driver_classes = []
>  dpdk_drivers = []
> @@ -103,6 +105,10 @@ configure_file(output: build_cfg,
>  # build pkg-config files for dpdk
>  subdir('buildtools/pkg-config')
>
> +if meson.is_subproject()
> +    subdir('buildtools/subproject')
> +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.34.1
>
>

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

  reply	other threads:[~2022-05-21  0:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 22:12 [dpdk-dev] [RFC] build: allow build DPDK as a meson submodule Stephen Hemminger
2021-11-04  8:59 ` Bruce Richardson
2021-11-05  0:01 ` [dpdk-dev] [PATCH] " Stephen Hemminger
2021-11-05 14:58   ` Bruce Richardson
2021-11-05 16:17     ` 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
2022-05-06 14:06   ` Bruce Richardson
2022-05-06 14:43 ` [PATCH v3] " Bruce Richardson
2022-05-21  0:54   ` Ben Magistro [this message]
2022-06-07 16:05     ` Thomas Monjalon

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='CAKx8PBhT=6zhCNKDuCXhggu+8DkDAKQRAp8_kymdmDuk9LQnFg@mail.gmail.com' \
    --to=koncept1@gmail.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).