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 CEBFCA0C4B; Sat, 6 Nov 2021 09:53:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 649574067C; Sat, 6 Nov 2021 09:53:23 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 31E8940151 for ; Sat, 6 Nov 2021 09:53:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636188801; 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=9Il0HzPW1xbNFtCY6/90QNoF16xgfNT6UJXcr08yXPU=; b=IRFZxNSNUcLeExr8lXibduGnOdTOJepE9Z0jPo97CJ7/+REj3vNoyZ9Gqj/BbXwjqHs4Q8 CQG4Zb26P2/L2Px7XYIGi4w4n1SQx7qFtDsrK3ZXq0nuu+cUO0jTuICaXN9kQE7pO4zKY2 4dgD9Mg/LKi8pFOy3H/9YE2f+gGROgw= 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-407-kphrGfZPMu6-2maiNGudxA-1; Sat, 06 Nov 2021 04:53:20 -0400 X-MC-Unique: kphrGfZPMu6-2maiNGudxA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A7ED10A8E00; Sat, 6 Nov 2021 08:53:19 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.194.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51D206788C; Sat, 6 Nov 2021 08:53:16 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: bruce.richardson@intel.com, ferruh.yigit@intel.com, thomas@monjalon.net, David Hunt , Maxime Coquelin , Chenbo Xia Date: Sat, 6 Nov 2021 09:53:04 +0100 Message-Id: <20211106085304.2376-1-david.marchand@redhat.com> In-Reply-To: <20211105133055.13824-1-david.marchand@redhat.com> References: <20211105133055.13824-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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" Subject: [dpdk-dev] [PATCH v2] examples: skip example when missing dependencies 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" Trying to disable the vhost library, meson will complain it can't build the vhost* and vdpa examples when passing -Dexamples=all. -Dexamples=all skips examples if the example itself announces it can't be built (for external dependencies, internal dependencies and other reasons). Since examples/meson.build will evaluate the internal dependencies in any case, let's move the check there and resolve the issue for optional internal libraries. Fixes: 0bf583222297 ("lib: allow disabling optional libraries") Signed-off-by: David Marchand Acked-by: Bruce Richardson --- Changes since v1: - changed to a more explicit way to break from the foreach deps loop, --- examples/distributor/meson.build | 6 ------ examples/kni/meson.build | 6 ------ examples/l3fwd-power/meson.build | 5 ----- examples/meson.build | 21 ++++++++++++------- examples/vhost_crypto/meson.build | 5 ----- .../vm_power_manager/guest_cli/meson.build | 5 ----- examples/vm_power_manager/meson.build | 5 ----- 7 files changed, 13 insertions(+), 40 deletions(-) diff --git a/examples/distributor/meson.build b/examples/distributor/meson.build index 9df59923ce..ca1eca952e 100644 --- a/examples/distributor/meson.build +++ b/examples/distributor/meson.build @@ -6,12 +6,6 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -# require the power library -build = dpdk_conf.has('RTE_LIB_POWER') -if not build - subdir_done() -endif - allow_experimental_apis = true deps += ['distributor', 'power'] sources = files( diff --git a/examples/kni/meson.build b/examples/kni/meson.build index 1c0bf99a49..6bd4eb50e6 100644 --- a/examples/kni/meson.build +++ b/examples/kni/meson.build @@ -6,12 +6,6 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -# this app can be built if-and-only-if KNI library is buildable -build = dpdk_conf.has('RTE_LIB_KNI') -if not build - subdir_done() -endif - deps += ['kni', 'bus_pci'] sources = files( 'main.c', diff --git a/examples/l3fwd-power/meson.build b/examples/l3fwd-power/meson.build index 0f69bb782c..624ef5e947 100644 --- a/examples/l3fwd-power/meson.build +++ b/examples/l3fwd-power/meson.build @@ -6,11 +6,6 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -if not dpdk_conf.has('RTE_LIB_POWER') - build = false - subdir_done() -endif - allow_experimental_apis = true deps += ['power', 'timer', 'lpm', 'hash', 'metrics', 'telemetry'] sources = files( diff --git a/examples/meson.build b/examples/meson.build index d50f09db12..bac9b76007 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -104,6 +104,19 @@ foreach example: examples deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] subdir(example) + if build + dep_objs = ext_deps + foreach d:deps + var_name = get_option('default_library') + '_rte_' + d + if not is_variable(var_name) + build = false + message('Missing dependency "@0@" for example "@1@"'.format(d, name)) + break + endif + dep_objs += [get_variable(var_name)] + endforeach + endif + if not build if not allow_skips error('Cannot build requested example "' + name + '"') @@ -112,14 +125,6 @@ foreach example: examples continue endif - dep_objs = ext_deps - foreach d:deps - var_name = get_option('default_library') + '_rte_' + d - if not is_variable(var_name) - error('Missing dependency "@0@" for example "@1@"'.format(d, name)) - endif - dep_objs += [get_variable(var_name)] - endforeach if allow_experimental_apis cflags += '-DALLOW_EXPERIMENTAL_API' endif diff --git a/examples/vhost_crypto/meson.build b/examples/vhost_crypto/meson.build index 720f42dd70..1c294c286f 100644 --- a/examples/vhost_crypto/meson.build +++ b/examples/vhost_crypto/meson.build @@ -6,11 +6,6 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -build = dpdk_conf.has('RTE_LIB_VHOST') -if not build - subdir_done() -endif - allow_experimental_apis = true deps += ['vhost', 'cryptodev'] sources = files( diff --git a/examples/vm_power_manager/guest_cli/meson.build b/examples/vm_power_manager/guest_cli/meson.build index 666eef94ae..a69f809e3b 100644 --- a/examples/vm_power_manager/guest_cli/meson.build +++ b/examples/vm_power_manager/guest_cli/meson.build @@ -6,11 +6,6 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -if not dpdk_conf.has('RTE_LIB_POWER') - build = false - subdir_done() -endif - deps += ['power'] sources = files( diff --git a/examples/vm_power_manager/meson.build b/examples/vm_power_manager/meson.build index c15bad6609..b866d8fd54 100644 --- a/examples/vm_power_manager/meson.build +++ b/examples/vm_power_manager/meson.build @@ -6,11 +6,6 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -if not dpdk_conf.has('RTE_LIB_POWER') - build = false - subdir_done() -endif - deps += ['power'] if dpdk_conf.has('RTE_NET_BNXT') -- 2.23.0