Skip to content

Commit

Permalink
build: pass cflags in subproject
Browse files Browse the repository at this point in the history
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: f93a605 ("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>
  • Loading branch information
rjarry authored and tmonjalo committed Mar 15, 2024
1 parent 7d386a8 commit 3f9aa55
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions buildtools/subproject/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
# 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,
link_args: dpdk_extra_ldflags)
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
Expand Down

0 comments on commit 3f9aa55

Please sign in to comment.