[dpdk-dev] [PATCH 1/2] build: remove architecture flag as default C flag
Bruce Richardson
bruce.richardson at intel.com
Tue Dec 19 11:52:21 CET 2017
Any flags added to the project args are automatically added to all builds,
both native and cross-compiled. This is not what we want for the -march
flag as a valid -march for the cross-compile is not valid for pmdinfogen
which is a native-build tool.
Instead we store the march flag as a variable, and add it to the default
cflags for all libs, drivers, examples, etc. This will allow pmdinfogen to
compile successfully in a cross-compilation environment.
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
app/test-pmd/meson.build | 1 +
buildtools/pmdinfogen/meson.build | 3 +--
config/meson.build | 8 ++++++--
drivers/meson.build | 2 +-
drivers/net/i40e/meson.build | 2 +-
drivers/net/ixgbe/meson.build | 2 +-
examples/meson.build | 2 +-
lib/meson.build | 2 +-
meson.build | 2 +-
9 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index b1820c77d..bef044c82 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -73,6 +73,7 @@ endif
executable('dpdk-testpmd',
sources,
+ c_args: machine_arg,
link_whole: link_libs,
dependencies: dep_objs,
install_rpath: join_paths(get_option('prefix'), driver_install_path),
diff --git a/buildtools/pmdinfogen/meson.build b/buildtools/pmdinfogen/meson.build
index 1f4836013..026d9745b 100644
--- a/buildtools/pmdinfogen/meson.build
+++ b/buildtools/pmdinfogen/meson.build
@@ -34,5 +34,4 @@ pmdinfogen_inc += include_directories('../../lib/librte_pci')
pmdinfogen = executable('pmdinfogen',
'pmdinfogen.c',
include_directories: pmdinfogen_inc,
- native: true,
- c_args: cflags)
+ native: true)
diff --git a/config/meson.build b/config/meson.build
index d7fb64422..d9a8e9f2c 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -30,9 +30,13 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# set the machine type and cflags for it
-machine = get_option('machine')
+if meson.is_cross_build()
+ machine = host_machine.cpu()
+else
+ machine = get_option('machine')
+endif
dpdk_conf.set('RTE_MACHINE', machine)
-add_project_arguments('-march=@0@'.format(machine), language: 'c')
+machine_arg = '-march=' + machine
# use pthreads
add_project_link_arguments('-pthread', language: 'c')
diff --git a/drivers/meson.build b/drivers/meson.build
index bb9a23523..da74e6c6b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -50,7 +50,7 @@ foreach class:driver_classes
version = 1
sources = []
objs = []
- cflags = []
+ cflags = [machine_arg]
includes = [include_directories(drv_path)]
# set up internal deps. Drivers can append/override as necessary
deps = std_deps
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index dc5e59d19..376e83a02 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -29,7 +29,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-cflags = ['-DPF_DRIVER',
+cflags += ['-DPF_DRIVER',
'-DVF_DRIVER',
'-DINTEGRATED_VF',
'-DX722_A0_SUPPORT']
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index 648494ee1..59ed1d7af 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -29,7 +29,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-cflags = ['-DRTE_LIBRTE_IXGBE_BYPASS']
+cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
subdir('base')
objs = [base_objs]
diff --git a/examples/meson.build b/examples/meson.build
index d5397cdd0..bd20f9f61 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -37,7 +37,7 @@ endif
foreach example: get_option('examples').split(',')
name = example
sources = []
- cflags = []
+ cflags = [machine_arg]
ext_deps = []
includes = [include_directories(example)]
deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index d12816f55..4826699f1 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -59,7 +59,7 @@ foreach l:libraries
sources = []
headers = []
includes = []
- cflags = []
+ cflags = [machine_arg]
objs = [] # other object files to link against, used e.g. for
# instruction-set optimized versions of code
diff --git a/meson.build b/meson.build
index 04eea721d..5249a4d48 100644
--- a/meson.build
+++ b/meson.build
@@ -93,5 +93,5 @@ pkg.generate(name: meson.project_name(),
['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
description: 'The Data Plane Development Kit (DPDK)',
subdirs: [get_option('include_subdir_arch'), '.'],
- extra_cflags: ['-include "rte_config.h"', '-march=@0@'.format(machine)]
+ extra_cflags: ['-include "rte_config.h"', machine_arg]
)
--
2.14.3
More information about the dev
mailing list