1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017 Intel Corporation 3 4# set the machine type and cflags for it 5if meson.is_cross_build() 6 machine = host_machine.cpu() 7else 8 machine = get_option('machine') 9endif 10dpdk_conf.set('RTE_MACHINE', machine) 11machine_args = [] 12# ppc64 does not support -march=native 13if host_machine.cpu_family().startswith('ppc') and machine == 'native' 14 machine_args += '-mcpu=' + machine 15 machine_args += '-mtune=' + machine 16else 17 machine_args += '-march=' + machine 18endif 19 20toolchain = cc.get_id() 21dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain) 22dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper(), 1) 23 24add_project_link_arguments('-Wl,--no-as-needed', language: 'c') 25dpdk_extra_ldflags += '-Wl,--no-as-needed' 26 27# use pthreads 28add_project_link_arguments('-pthread', language: 'c') 29dpdk_extra_ldflags += '-pthread' 30 31# some libs depend on maths lib 32add_project_link_arguments('-lm', language: 'c') 33dpdk_extra_ldflags += '-lm' 34 35# for linux link against dl, for bsd execinfo 36if host_machine.system() == 'linux' 37 link_lib = 'dl' 38else 39 link_lib = 'execinfo' 40endif 41add_project_link_arguments('-l' + link_lib, language: 'c') 42dpdk_extra_ldflags += '-l' + link_lib 43 44# check for libraries used in multiple places in DPDK 45has_libnuma = 0 46numa_dep = cc.find_library('numa', required: false) 47if numa_dep.found() and cc.has_header('numaif.h') 48 dpdk_conf.set10('RTE_HAS_LIBNUMA', true) 49 has_libnuma = 1 50 add_project_link_arguments('-lnuma', language: 'c') 51 dpdk_extra_ldflags += '-lnuma' 52endif 53 54# check for strlcpy 55if host_machine.system() == 'linux' and cc.find_library('bsd', 56 required: false).found() and cc.has_header('bsd/string.h') 57 dpdk_conf.set('RTE_USE_LIBBSD', 1) 58 add_project_link_arguments('-lbsd', language: 'c') 59 dpdk_extra_ldflags += '-lbsd' 60endif 61 62# add -include rte_config to cflags 63add_project_arguments('-include', 'rte_config.h', language: 'c') 64 65# enable extra warnings and disable any unwanted warnings 66warning_flags = [ 67 '-Wsign-compare', 68 '-Wcast-qual', 69 '-Wno-address-of-packed-member' 70] 71if cc.sizeof('void *') == 4 72# for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!! 73 warning_flags += '-Wno-pointer-to-int-cast' 74endif 75foreach arg: warning_flags 76 if cc.has_argument(arg) 77 add_project_arguments(arg, language: 'c') 78 endif 79endforeach 80 81# set other values pulled from the build options 82dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores')) 83dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes')) 84dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet')) 85dpdk_conf.set('RTE_EAL_ALLOW_INV_SOCKET_ID', get_option('allow_invalid_socket_id')) 86# values which have defaults which may be overridden 87dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64) 88dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64) 89dpdk_conf.set('RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', true) 90 91compile_time_cpuflags = [] 92if host_machine.cpu_family().startswith('x86') 93 arch_subdir = 'x86' 94elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch') 95 arch_subdir = 'arm' 96elif host_machine.cpu_family().startswith('ppc') 97 arch_subdir = 'ppc_64' 98endif 99subdir(arch_subdir) 100dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags)) 101 102# set the install path for the drivers 103dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) 104 105install_headers('rte_config.h', subdir: get_option('include_subdir_arch')) 106 107# enable VFIO only if it is linux OS 108dpdk_conf.set('RTE_EAL_VFIO', host_machine.system() == 'linux') 109