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 9F30CA034F; Wed, 10 Nov 2021 17:49:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E14B41172; Wed, 10 Nov 2021 17:49:24 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id CDC4341171 for ; Wed, 10 Nov 2021 17:49:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636562963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z/y5opQLD6rkmw7+UdV0i3a+Igjd/TEA7TSAOIQKldg=; b=HbrpVOXIKLZSvYNaqF6Ux8NakwjOakv79MdOZJfwQTRSd6VUGODjQnQR4E+ZllGUXNCmm9 D2FvbxftfNXQQ+prd2iH0F1ibLNJ7BStb1/VGk7fNPkVfL+sh0r3lbgriIh8z5NpJz56Wa nU8aY+zeOGTCTqw19xVwq4pGmEb3sL4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-uzIyi0ZtO_yDhUj2QNZFnA-1; Wed, 10 Nov 2021 11:49:20 -0500 X-MC-Unique: uzIyi0ZtO_yDhUj2QNZFnA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DAEB5804141; Wed, 10 Nov 2021 16:49:18 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4330BC888; Wed, 10 Nov 2021 16:49:15 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, bluca@debian.org, tredaelli@redhat.com, i.maximets@ovn.org, james.r.harris@intel.com, mohammed@hawari.fr Subject: [PATCH 5/5] build: select optional libraries Date: Wed, 10 Nov 2021 17:48:14 +0100 Message-Id: <20211110164814.5231-6-david.marchand@redhat.com> In-Reply-To: <20211110164814.5231-1-david.marchand@redhat.com> References: <20211110164814.5231-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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 There is currently no way to know which libraries are optional. Introduce a enable_libs option (close to what we have for drivers) so that packagers or projects consuming DPDK can more easily select the optional libraries that matter to them and disable other optional libraries. Note: the enabled_libs variable is renamed for sake of consistency. Signed-off-by: David Marchand --- buildtools/chkincs/meson.build | 2 +- lib/meson.build | 34 ++++++++++++++++++---------------- meson.build | 3 ++- meson_options.txt | 2 ++ 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index 5ffca89761..6b93d5f46c 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -18,7 +18,7 @@ sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) deps = [] -foreach l:enabled_libs +foreach l:dpdk_libs_enabled deps += get_variable('static_rte_' + l) endforeach diff --git a/lib/meson.build b/lib/meson.build index dad9fce14d..47c857c0fc 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -78,17 +78,10 @@ optional_libs = [ 'vhost', ] -disabled_libs = [] -opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'), +enable_libs = run_command(list_dir_globs, get_option('enable_libs'), + check: true).stdout().split() +disable_libs = run_command(list_dir_globs, get_option('disable_libs'), check: true).stdout().split() -foreach l:opt_disabled_libs - if not optional_libs.contains(l) - warning('Cannot disable mandatory library "@0@"'.format(l)) - continue - endif - disabled_libs += l -endforeach - default_cflags = machine_args default_cflags += ['-DALLOW_EXPERIMENTAL_API'] @@ -98,8 +91,6 @@ if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' endif -enabled_libs = [] # used to print summary at the end - foreach l:libraries build = true reason = '' # set if build == false to explain why @@ -123,10 +114,21 @@ foreach l:libraries deps += ['eal'] endif - if disabled_libs.contains(l) - build = false - reason = 'explicitly disabled via build config' + if optional_libs.contains(l) + # check for enabled libraries only if one is set in config + if enable_libs.length() != 0 and not enable_libs.contains(l) + build = false + reason = 'not in enabled libraries build config' + elif disable_libs.contains(l) + build = false + reason = 'explicitly disabled via build config' + endif else + if disable_libs.contains(l) + warning('Cannot disable mandatory library "@0@"'.format(l)) + endif + endif + if build subdir(l) endif if name != l @@ -150,7 +152,7 @@ foreach l:libraries static_deps += [get_variable('static_rte_' + d)] endforeach - enabled_libs += name + dpdk_libs_enabled += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) install_headers(headers) install_headers(indirect_headers) diff --git a/meson.build b/meson.build index 12cb6e0e83..65855ceee8 100644 --- a/meson.build +++ b/meson.build @@ -35,6 +35,7 @@ dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = [] dpdk_libs_disabled = [] +dpdk_libs_enabled = [] dpdk_drvs_disabled = [] abi_version_file = files('ABI_VERSION') @@ -102,7 +103,7 @@ subdir('buildtools/pkg-config') output_message = '\n=================\nLibraries Enabled\n=================\n' output_message += '\nlibs:\n\t' output_count = 0 -foreach lib:enabled_libs +foreach lib:dpdk_libs_enabled output_message += lib + ', ' output_count += 1 if output_count == 8 diff --git a/meson_options.txt b/meson_options.txt index 7c220ad68d..ccb92cff7a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,6 +16,8 @@ option('enable_docs', type: 'boolean', value: false, description: 'build documentation') option('enable_drivers', type: 'string', value: '', description: 'Comma-separated list of drivers to build. If unspecified, build all drivers.') +option('enable_libs', type: 'string', value: '', description: + 'Comma-separated list of libraries to explicitly enable.') option('enable_driver_sdk', type: 'boolean', value: false, description: 'Install headers to build drivers.') option('enable_kmods', type: 'boolean', value: false, description: -- 2.23.0