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 78EB9A0503; Fri, 6 May 2022 16:43:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2199D40395; Fri, 6 May 2022 16:43:42 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id D20A54014F for ; Fri, 6 May 2022 16:43:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651848220; x=1683384220; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sgQnKwmvko8q0jVUG3EL4sjNBL+xdF8/y80chVPQBHQ=; b=VVeemnqwggZvU/0EBPL/1llGg00cArK7GgmwBON6ha3nfTn6hm0Skf46 9e9hdL4dXo7W/Ie/TE99Wd7CMt6g6TI4fUebiOzlYE0qeqIPjEkLQ4AtM htdLXKuSdDwBsst2YP9oBARoIQXfFfMT9q7V0rSf2EkPpa3JlPjcqZNPe QijW7FQtYUsa5szFtYM1Dt+kJQVggMYuTvXBGyiyoEQEFxwt+a9Kt1Pb2 oiwQVQX2kPz13t0aQpLI/RLxcdSWwtdw2VqrNLSv+f2pRRJQAW3R9w5bI KI2WhJNOtjgpzpHtCBvZzMblTIdZS/zvSF4Jh0xQ+k6DoyuSW6Vw5DvCt g==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="268087868" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="268087868" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 07:43:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="569125571" Received: from silpixa00401385.ir.intel.com (HELO silpixa00401385.ger.corp.intel.com.) ([10.237.223.87]) by fmsmga007.fm.intel.com with ESMTP; 06 May 2022 07:43:36 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Stephen Hemminger Subject: [PATCH v3] build: add definitions for use as meson subproject Date: Fri, 6 May 2022 15:43:18 +0100 Message-Id: <20220506144318.540584-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211103221205.63175-1-stephen@networkplumber.org> References: <20211103221205.63175-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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