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 E7E11A0C56; Fri, 5 Nov 2021 19:11:14 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A9BAC40DFD; Fri, 5 Nov 2021 19:11:14 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 50C2240151 for ; Fri, 5 Nov 2021 19:11:13 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10159"; a="229419086" X-IronPort-AV: E=Sophos;i="5.87,212,1631602800"; d="scan'208";a="229419086" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2021 11:11:12 -0700 X-IronPort-AV: E=Sophos;i="5.87,212,1631602800"; d="scan'208";a="600701378" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.3.73]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 05 Nov 2021 11:11:10 -0700 Date: Fri, 5 Nov 2021 18:11:07 +0000 From: Bruce Richardson To: Stephen Hemminger Cc: dev@dpdk.org Message-ID: References: <20211103221205.63175-1-stephen@networkplumber.org> <20211105172213.103988-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211105172213.103988-1-stephen@networkplumber.org> Subject: Re: [dpdk-dev] [PATCH v2] build: add definitions for use as meson subproject 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 Sender: "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 One comment inline below. Otherwise: Acked-by: Bruce Richardson > --- > > 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 >