[dpdk-dev,1/2] build: remove architecture flag as default C flag
Checks
Commit Message
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>
---
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(-)
@@ -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),
@@ -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)
@@ -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')
@@ -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
@@ -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']
@@ -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]
@@ -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']
@@ -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
@@ -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]
)