From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id DC5BD43BC7
	for <public@inbox.dpdk.org>; Fri,  8 Mar 2024 12:58:58 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D492242F3F;
	Fri,  8 Mar 2024 12:58:58 +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 0923840291
 for <stable@dpdk.org>; Fri,  8 Mar 2024 12:58:57 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1709899137;
 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;
 bh=Vukm7VAXP9a3JdCPMK9nCoASehCyfCfeIOGbklfiVOc=;
 b=IRi22zR1zvG4cIMK8s8SxvHyJedwNS3qb/3BMaGgOpQvuVZ9LnKb/z2pVa4K70UFaNh+LA
 mP+Iq13AotLjF9XMC0JLAkYqJtwdJlmcBmmio87FEpeXGPsqqy61HChjlXxx7nipqGtnYo
 O7XoWbJAmOv/dsvmLZChdMsNXNCLrR8=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
 us-mta-279-OTwmGb7SM4qw-Sn6PSJpUQ-1; Fri, 08 Mar 2024 06:58:56 -0500
X-MC-Unique: OTwmGb7SM4qw-Sn6PSJpUQ-1
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com
 [10.11.54.3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AFDFC85A58C;
 Fri,  8 Mar 2024 11:58:55 +0000 (UTC)
Received: from ringo.redhat.com (unknown [10.39.208.8])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 632FB111D785;
 Fri,  8 Mar 2024 11:58:54 +0000 (UTC)
From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,
 Ben Magistro <koncept1@gmail.com>,
 Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH] build: pass cflags in subproject
Date: Fri,  8 Mar 2024 12:58:40 +0100
Message-ID: <20240308115839.320793-2-rjarry@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"; x-default=true
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

When DPDK is used as a subproject, include the required compile
arguments so that the parent project is also built with the appropriate
cflags (most importantly -march). Use the same cflags as pkg-config.

Fixes: f93a605f2d6e ("build: add definitions for use as Meson subproject")
Cc: stable@dpdk.org

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 buildtools/subproject/meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/buildtools/subproject/meson.build b/buildtools/subproject/meson.build
index 322e01c02969..203c5d36c6e9 100644
--- a/buildtools/subproject/meson.build
+++ b/buildtools/subproject/meson.build
@@ -2,10 +2,15 @@
 # Copyright(c) 2022 Intel Corporation
 
 message('DPDK subproject linking: ' + get_option('default_library'))
+subproject_cflags = ['-include', 'rte_config.h'] + machine_args
+if is_freebsd
+    subproject_cflags += ['-D__BSD_VISIBLE']
+endif
 if get_option('default_library') == 'static'
     dpdk_dep = declare_dependency(
             version: meson.project_version(),
             dependencies: dpdk_static_lib_deps,
+            compile_args: subproject_cflags,
             # static library deps in DPDK build don't include "link_with" parameters,
             # so explicitly link-in both libs and drivers
             link_whole: dpdk_static_libraries + dpdk_drivers,
@@ -13,6 +18,7 @@ if get_option('default_library') == 'static'
 else
     dpdk_dep = declare_dependency(
             version: meson.project_version(),
+            compile_args: subproject_cflags,
             # shared library deps include all necessary linking parameters
             dependencies: dpdk_shared_lib_deps)
 endif
-- 
2.44.0