New upstream version 18.02
[deb_dpdk.git] / config / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
3
4 # set the machine type and cflags for it
5 if meson.is_cross_build()
6         machine = host_machine.cpu()
7 else
8         machine = get_option('machine')
9 endif
10 dpdk_conf.set('RTE_MACHINE', machine)
11 machine_args = []
12 machine_args += '-march=' + machine
13
14 # use pthreads
15 add_project_link_arguments('-pthread', language: 'c')
16 dpdk_extra_ldflags += '-pthread'
17
18 # some libs depend on maths lib
19 add_project_link_arguments('-lm', language: 'c')
20 dpdk_extra_ldflags += '-lm'
21
22 # for linux link against dl, for bsd execinfo
23 if host_machine.system() == 'linux'
24         link_lib = 'dl'
25 else
26         link_lib = 'execinfo'
27 endif
28 add_project_link_arguments('-l' + link_lib, language: 'c')
29 dpdk_extra_ldflags += '-l' + link_lib
30
31 # check for libraries used in multiple places in DPDK
32 has_libnuma = 0
33 numa_dep = cc.find_library('numa', required: false)
34 if numa_dep.found() and cc.has_header('numaif.h')
35         dpdk_conf.set10('RTE_HAS_LIBNUMA', true)
36         has_libnuma = 1
37         add_project_link_arguments('-lnuma', language: 'c')
38         dpdk_extra_ldflags += '-lnuma'
39 endif
40
41 # add -include rte_config to cflags
42 add_project_arguments('-include', 'rte_config.h', language: 'c')
43
44 # enable extra warnings and disable any unwanted warnings
45 warning_flags = [
46         '-Wsign-compare',
47         '-Wcast-qual',
48         '-Wno-address-of-packed-member',
49         '-Wno-format-truncation'
50 ]
51 foreach arg: warning_flags
52         if cc.has_argument(arg)
53                 add_project_arguments(arg, language: 'c')
54         endif
55 endforeach
56
57 # set other values pulled from the build options
58 dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores'))
59 dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes'))
60 dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet'))
61 dpdk_conf.set('RTE_EAL_ALLOW_INV_SOCKET_ID', get_option('allow_invalid_socket_id'))
62 # values which have defaults which may be overridden
63 dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64)
64
65 compile_time_cpuflags = []
66 if host_machine.cpu_family().startswith('x86')
67         arch_subdir = 'x86'
68 elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
69         arch_subdir = 'arm'
70 endif
71 subdir(arch_subdir)
72 dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))
73
74 # set the install path for the drivers
75 dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
76
77 install_headers('rte_config.h', subdir: get_option('include_subdir_arch'))