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