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 = [] 12machine_args += '-march=' + machine 13 14toolchain = cc.get_id() 15dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain) 16dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper(), 1) 17 18# use pthreads 19add_project_link_arguments('-pthread', language: 'c') 20dpdk_extra_ldflags += '-pthread' 21 22# some libs depend on maths lib 23add_project_link_arguments('-lm', language: 'c') 24dpdk_extra_ldflags += '-lm' 25 26# for linux link against dl, for bsd execinfo 27if host_machine.system() == 'linux' 28 link_lib = 'dl' 29else 30 link_lib = 'execinfo' 31endif 32add_project_link_arguments('-l' + link_lib, language: 'c') 33dpdk_extra_ldflags += '-l' + link_lib 34 35# check for libraries used in multiple places in DPDK 36has_libnuma = 0 37numa_dep = cc.find_library('numa', required: false) 38if numa_dep.found() and cc.has_header('numaif.h') 39 dpdk_conf.set10('RTE_HAS_LIBNUMA', true) 40 has_libnuma = 1 41 add_project_link_arguments('-lnuma', language: 'c') 42 dpdk_extra_ldflags += '-lnuma' 43endif 44 45# check for strlcpy 46if host_machine.system() == 'linux' and cc.find_library('bsd', 47 required: false).found() and cc.has_header('bsd/string.h') 48 dpdk_conf.set('RTE_USE_LIBBSD', 1) 49 add_project_link_arguments('-lbsd', language: 'c') 50 dpdk_extra_ldflags += '-lbsd' 51endif 52 53# add -include rte_config to cflags 54add_project_arguments('-include', 'rte_config.h', language: 'c') 55 56# enable extra warnings and disable any unwanted warnings 57warning_flags = [ 58 '-Wsign-compare', 59 '-Wcast-qual', 60 '-Wno-address-of-packed-member' 61] 62foreach arg: warning_flags 63 if cc.has_argument(arg) 64 add_project_arguments(arg, language: 'c') 65 endif 66endforeach 67 68# set other values pulled from the build options 69dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores')) 70dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes')) 71dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet')) 72dpdk_conf.set('RTE_EAL_ALLOW_INV_SOCKET_ID', get_option('allow_invalid_socket_id')) 73# values which have defaults which may be overridden 74dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64) 75dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64) 76 77compile_time_cpuflags = [] 78if host_machine.cpu_family().startswith('x86') 79 arch_subdir = 'x86' 80elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch') 81 arch_subdir = 'arm' 82endif 83subdir(arch_subdir) 84dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags)) 85 86# set the install path for the drivers 87dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) 88 89install_headers('rte_config.h', subdir: get_option('include_subdir_arch')) 90