]> git.droids-corp.org - dpdk.git/commitdiff
build: remove architecture flag as default C flag
authorBruce Richardson <bruce.richardson@intel.com>
Fri, 15 Dec 2017 17:12:43 +0000 (17:12 +0000)
committerBruce Richardson <bruce.richardson@intel.com>
Tue, 30 Jan 2018 20:58:59 +0000 (21:58 +0100)
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@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
app/test-pmd/meson.build
buildtools/pmdinfogen/meson.build
config/meson.build
doc/guides/contributing/coding_style.rst
drivers/meson.build
drivers/net/i40e/meson.build
drivers/net/ixgbe/meson.build
examples/meson.build
lib/meson.build
meson.build

index a242703458f9067c84666dd8fe43ac73799a1db2..4614e350607377493f03c88689ed1325cefe6715 100644 (file)
@@ -45,7 +45,7 @@ endif
 
 executable('dpdk-testpmd',
        sources,
-       c_args: '-DALLOW_EXPERIMENTAL_API',
+       c_args: [machine_arg, '-DALLOW_EXPERIMENTAL_API'],
        link_whole: link_libs,
        dependencies: dep_objs,
        install_rpath: join_paths(get_option('prefix'), driver_install_path),
index ea373706a4fd49bbdf81aa3d32995c41c8e3f0eb..a219a8e963f71450ca49911012abb3bd1c1b48ed 100644 (file)
@@ -6,5 +6,4 @@ pmdinfogen_inc += include_directories('../../lib/librte_pci')
 pmdinfogen = executable('pmdinfogen',
        'pmdinfogen.c',
        include_directories: pmdinfogen_inc,
-       native: true,
-       c_args: cflags)
+       native: true)
index 4f6511773dc18f4f6ee97b73ec216dd091cf9ecc..95223042f1a20eabcfcb1cbebe88013856b3a27e 100644 (file)
@@ -2,9 +2,13 @@
 # Copyright(c) 2017 Intel Corporation
 
 # 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')
index 3734bf029a34f3e0ddefdfdacb193f4a39bd2a7c..d5fe67fd4acfe5e6b961a4198b55840c876d4c83 100644 (file)
@@ -800,7 +800,7 @@ build
 
 
 cflags
-       **Default Value = []**.
+       **Default Value = [<-march/-mcpu flags>]**.
        Used to specify any additional cflags that need to be passed to compile
        the sources in the library.
 
index f6680ce10774f7244a888c0c0be4af96bdd46d73..5ee00264e6bf29dca9badf100b7f64e161e9f6b0 100644 (file)
@@ -23,7 +23,7 @@ foreach class:driver_classes
                allow_experimental_apis = false
                sources = []
                objs = []
-               cflags = []
+               cflags = [machine_arg]
                includes = [include_directories(drv_path)]
                # set up internal deps. Drivers can append/override as necessary
                deps = std_deps
index 42a8a1d47dd94058b8161d0b6c3c41ece6928ac5..504bfdd0c2c3d543e6a4b7363b88876af2435060 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-cflags = ['-DPF_DRIVER',
+cflags += ['-DPF_DRIVER',
        '-DVF_DRIVER',
        '-DINTEGRATED_VF',
        '-DX722_A0_SUPPORT']
index 36aaff5d71db1fb2aaa02cf7166045d2f77133fe..60af0baef8db31ac4fe2955a5650a10cf74044cf 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-cflags = ['-DRTE_LIBRTE_IXGBE_BYPASS']
+cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
 subdir('base')
 objs = [base_objs]
index b660b4ba1f88ee9f84067fedb5515109a36e349f..cef48fac7491706b12703ed9029c74a84cf6aa99 100644 (file)
@@ -10,7 +10,7 @@ foreach example: get_option('examples').split(',')
        name = example
        sources = []
        allow_experimental_apis = false
-       cflags = []
+       cflags = [machine_arg]
        ext_deps = []
        includes = [include_directories(example)]
        deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
index de751626f44d92ba3dd5f5e5cfd8ea8b5f5aaab8..e8302fbb1b869e97fa79eb95113129ce44e79383 100644 (file)
@@ -33,7 +33,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
 
index 56a8c64d2aa87fbb663a9a98fc3e8ece9683ff70..f572d93e7706e3e96b67e32c38111cfbb8f2d95f 100644 (file)
@@ -65,5 +65,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]
 )