build: pass cflags in subproject

Message ID 20240308115839.320793-2-rjarry@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series build: pass cflags in subproject |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Robin Jarry March 8, 2024, 11:58 a.m. UTC
  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(+)
  

Comments

David Marchand March 8, 2024, 2:24 p.m. UTC | #1
On Fri, Mar 8, 2024 at 12:59 PM Robin Jarry <rjarry@redhat.com> wrote:
>
> 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>

Reviewed-by: David Marchand <david.marchand@redhat.com>
  
Thomas Monjalon March 15, 2024, 11:47 a.m. UTC | #2
08/03/2024 15:24, David Marchand:
> On Fri, Mar 8, 2024 at 12:59 PM Robin Jarry <rjarry@redhat.com> wrote:
> >
> > 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>
> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
  

Patch

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