From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2BF30A0093; Sat, 21 May 2022 02:54:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F89A40222; Sat, 21 May 2022 02:54:25 +0200 (CEST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id 04EBC40156 for ; Sat, 21 May 2022 02:54:23 +0200 (CEST) Received: by mail-wr1-f45.google.com with SMTP id w4so13419238wrg.12 for ; Fri, 20 May 2022 17:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NPn26lietQhhZniJcdxHK1teLiLohvrZOWFPGsLQRUM=; b=eq7TytFp7nCYXAMVxLDaZXp/4qrDCxXyutqjvbgBYxCIqJkW6fmjlN1G1bAPZqtvWq B5yIRR5L9qHQsk3d2W2TyWHrhZcBMWPlfHwS/HD6kEptRafNnmYEus7hw0nSQmscbAN5 NqWYsC9zmPll5zSHHr4jMIaUfZKt3978exJAZaQ90DyFrZCBW/U4StYH0V2L6hsixmBM inyBBLMQieLM7k0f5q3FLF6l1YxBm92EQZqdX1D8J1Ln+SodpUoZHcBqM9hwx6/gU4h6 e6YoX5jwCe8I4FNS/k5SitKzzvYUMNIZeB/MOOAy5j4jg0IyiD2ZbC37STFbDtyAFxeW 3Waw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NPn26lietQhhZniJcdxHK1teLiLohvrZOWFPGsLQRUM=; b=8LDckyn7bRLkKz4gcZWdur1QJLrURPKAkIDaQmGUW0GtL+3ts9FXeiVo3OSZ0AhYeu /lOSOhFa2DO3UKygcnrkMfMXPEqL9fwiu28jwxJq8g9sPp0l8CiD8VSVwW5T3vGIn26A lRTO04rdJC8qLw7nSTAxK25FeJK3W9TM3sdv4Xu7nDSF0OooqreBZ4oIDG2flNkF9cFH pzIjvWS553viB3zcw6eXyMpUJolha5L/DSTINDd/UhW6eI3p0vl/awixK0fqVRKU8g4p +7tTGWyJgJnwIBxYAxTnm0njFowOYKjwQG0azuw+dlcLIntKfPBHVXlxvGjhMKkY/8+A 9LmQ== X-Gm-Message-State: AOAM532XNufUQlUxQOoFezf8c0RyzK73bBJsq4+whiDCA2YGyIBogdGf agrG4BDFyOpUUlgdw/lphaW9rbhof02H4lXzScuRNh8K X-Google-Smtp-Source: ABdhPJwZkmQ9W/06zJqB43G8iOGnnwh3GRFyLw02bePNtZkgHALElcYOfYQp0UezWOqdfLcuUtcl4sQxXfYrplCyEGc= X-Received: by 2002:a5d:47c8:0:b0:20c:95c6:23df with SMTP id o8-20020a5d47c8000000b0020c95c623dfmr10340248wrc.315.1653094462562; Fri, 20 May 2022 17:54:22 -0700 (PDT) MIME-Version: 1.0 References: <20211103221205.63175-1-stephen@networkplumber.org> <20220506144318.540584-1-bruce.richardson@intel.com> In-Reply-To: <20220506144318.540584-1-bruce.richardson@intel.com> From: Ben Magistro Date: Fri, 20 May 2022 20:54:11 -0400 Message-ID: Subject: Re: [PATCH v3] build: add definitions for use as meson subproject To: Bruce Richardson Cc: dev@dpdk.org, Stephen Hemminger Content-Type: multipart/alternative; boundary="00000000000038a5ae05df7b0c49" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --00000000000038a5ae05df7b0c49 Content-Type: text/plain; charset="UTF-8" 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 Tested-by: Ben Magistro On Fri, May 6, 2022 at 10:43 AM Bruce Richardson 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 > Signed-off-by: Bruce Richardson > --- > 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 > > --00000000000038a5ae05df7b0c49 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Currently utilizing this in an upcoming set of changes for= TLDK and all seems to be working for fallback dependency support under bot= h shared and static linkage.

Reviewed-by: Ben Magistro &= lt;koncept1@gmail.com>
Tested-by: Ben Magistro <koncep= t1@gmail.com>

On Fri, May 6, 2022 at 10:43 AM Bruce Richardson = <bruce.richardson@intel.co= m> 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 =3D dependency('libdpdk', fallback: ['dpdk', 'd= pdk_dep'])

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
=C2=A0buildtools/subproject/meson.build | 21 +++++++++++++++++++++
=C2=A0drivers/meson.build=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0|=C2=A0 4 ++++
=C2=A0lib/meson.build=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0|=C2=A0 2 ++
=C2=A0meson.build=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 6 ++++++
=C2=A04 files changed, 33 insertions(+)
=C2=A0create mode 100644 buildtools/subproject/meson.build

diff --git a/buildtools/subproject/meson.build b/buildtools/subproject/meso= n.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_libr= ary'))
+if get_option('default_library') =3D=3D 'static'
+=C2=A0 =C2=A0 dpdk_dep =3D declare_dependency(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 version: meson.project_version()= ,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dependencies: dpdk_static_lib_de= ps,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # static library deps in DPDK bu= ild don't include "link_with" parameters,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # so explicitly link-in both lib= s and drivers
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 link_with: dpdk_static_libraries= ,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 link_whole: dpdk_drivers,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 link_args: dpdk_extra_ldflags) +else
+=C2=A0 =C2=A0 dpdk_dep =3D declare_dependency(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 version: meson.project_version()= ,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # shared library deps include al= l necessary linking parameters
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dependencies: dpdk_shared_lib_de= ps)
+endif
+
+libdpdk_dep =3D 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

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set_variable('shared_@0@'.format(= lib_name), shared_dep)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set_variable('static_@0@'.format(= lib_name), static_dep)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 # for drivers, we only need to add dependency = objects for static libs,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 # shared lib drivers are not linked in
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 dpdk_static_lib_deps +=3D static_dep
+
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dependency_name =3D ''.join(lib_n= ame.split('rte_'))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if developer_mode
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0message('drivers/@0@: D= efining 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

=C2=A0 =C2=A0 =C2=A0set_variable('shared_rte_' + name, shared_dep)<= br> =C2=A0 =C2=A0 =C2=A0set_variable('static_rte_' + name, static_dep)<= br> +=C2=A0 =C2=A0 dpdk_shared_lib_deps +=3D shared_dep
+=C2=A0 =C2=A0 dpdk_static_lib_deps +=3D static_dep
=C2=A0 =C2=A0 =C2=A0if developer_mode
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0message('lib/@0@: Defining dependency= "@1@"'.format(l, name))
=C2=A0 =C2=A0 =C2=A0endif
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 =3D meson.current_build_dir()
=C2=A0dpdk_conf =3D configuration_data()
=C2=A0dpdk_libraries =3D []
=C2=A0dpdk_static_libraries =3D []
+dpdk_shared_lib_deps =3D []
+dpdk_static_lib_deps =3D []
=C2=A0dpdk_chkinc_headers =3D []
=C2=A0dpdk_driver_classes =3D []
=C2=A0dpdk_drivers =3D []
@@ -103,6 +105,10 @@ configure_file(output: build_cfg,
=C2=A0# build pkg-config files for dpdk
=C2=A0subdir('buildtools/pkg-config')

+if meson.is_subproject()
+=C2=A0 =C2=A0 subdir('buildtools/subproject')
+endif
+
=C2=A0# final output, list all the libs and drivers to be built
=C2=A0# this does not affect any part of the build, for information only. =C2=A0output_message =3D '\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D\nLibraries Enabled\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D\n'
--
2.34.1

--00000000000038a5ae05df7b0c49--