1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
4 # set the machine type and cflags for it
5 if meson.is_cross_build()
6 machine = host_machine.cpu()
8 machine = get_option('machine')
10 dpdk_conf.set('RTE_MACHINE', machine)
12 # ppc64 does not support -march=native
13 if host_machine.cpu_family().startswith('ppc') and machine == 'native'
14 machine_args += '-mcpu=' + machine
15 machine_args += '-mtune=' + machine
17 machine_args += '-march=' + machine
20 toolchain = cc.get_id()
21 dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
22 dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper(), 1)
25 add_project_link_arguments('-pthread', language: 'c')
26 dpdk_extra_ldflags += '-pthread'
28 # some libs depend on maths lib
29 add_project_link_arguments('-lm', language: 'c')
30 dpdk_extra_ldflags += '-lm'
32 # for linux link against dl, for bsd execinfo
33 if host_machine.system() == 'linux'
38 add_project_link_arguments('-l' + link_lib, language: 'c')
39 dpdk_extra_ldflags += '-l' + link_lib
41 # check for libraries used in multiple places in DPDK
43 numa_dep = cc.find_library('numa', required: false)
44 if numa_dep.found() and cc.has_header('numaif.h')
45 dpdk_conf.set10('RTE_HAS_LIBNUMA', true)
47 add_project_link_arguments('-lnuma', language: 'c')
48 dpdk_extra_ldflags += '-lnuma'
52 if host_machine.system() == 'linux' and cc.find_library('bsd',
53 required: false).found() and cc.has_header('bsd/string.h')
54 dpdk_conf.set('RTE_USE_LIBBSD', 1)
55 add_project_link_arguments('-lbsd', language: 'c')
56 dpdk_extra_ldflags += '-lbsd'
59 # add -include rte_config to cflags
60 add_project_arguments('-include', 'rte_config.h', language: 'c')
62 # enable extra warnings and disable any unwanted warnings
66 '-Wno-address-of-packed-member'
68 if cc.sizeof('void *') == 4
69 # for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!!
70 warning_flags += '-Wno-pointer-to-int-cast'
72 foreach arg: warning_flags
73 if cc.has_argument(arg)
74 add_project_arguments(arg, language: 'c')
78 # set other values pulled from the build options
79 dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores'))
80 dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes'))
81 dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet'))
82 dpdk_conf.set('RTE_EAL_ALLOW_INV_SOCKET_ID', get_option('allow_invalid_socket_id'))
83 # values which have defaults which may be overridden
84 dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64)
85 dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64)
86 dpdk_conf.set('RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', true)
88 compile_time_cpuflags = []
89 if host_machine.cpu_family().startswith('x86')
91 elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
93 elif host_machine.cpu_family().startswith('ppc')
94 arch_subdir = 'ppc_64'
97 dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))
99 # set the install path for the drivers
100 dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
102 install_headers('rte_config.h', subdir: get_option('include_subdir_arch'))