net/iavf: fix link speed
[dpdk.git] / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017-2019 Intel Corporation
3
4 project('DPDK', 'C',
5         # Get version number from file.
6         # Fallback to "more" for Windows compatibility.
7         version: run_command(find_program('cat', 'more'),
8                 files('VERSION')).stdout().strip(),
9         license: 'BSD',
10         default_options: ['buildtype=release', 'default_library=static'],
11         meson_version: '>= 0.47.1'
12 )
13
14 # set up some global vars for compiler, platform, configuration, etc.
15 cc = meson.get_compiler('c')
16 dpdk_conf = configuration_data()
17 dpdk_libraries = []
18 dpdk_static_libraries = []
19 dpdk_graph_nodes = []
20 dpdk_driver_classes = []
21 dpdk_drivers = []
22 dpdk_extra_ldflags = []
23 dpdk_app_link_libraries = []
24 dpdk_libs_disabled = []
25 dpdk_drvs_disabled = []
26 abi_version_file = files('ABI_VERSION')
27
28 if host_machine.cpu_family().startswith('x86')
29         arch_subdir = 'x86'
30 elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
31         arch_subdir = 'arm'
32 elif host_machine.cpu_family().startswith('ppc')
33         arch_subdir = 'ppc'
34 endif
35
36 # configure the build, and make sure configs here and in config folder are
37 # able to be included in any file. We also store a global array of include dirs
38 # for passing to pmdinfogen scripts
39 global_inc = include_directories('.', 'config',
40         'lib/librte_eal/include',
41         'lib/librte_eal/@0@/include'.format(host_machine.system()),
42         'lib/librte_eal/@0@/include'.format(arch_subdir),
43 )
44 subdir('config')
45
46 # build libs and drivers
47 subdir('buildtools')
48 subdir('lib')
49 subdir('drivers')
50
51 # build binaries and installable tools
52 subdir('usertools')
53 subdir('app')
54
55 # build docs
56 subdir('doc')
57
58 # build any examples explicitly requested - useful for developers - and
59 # install any example code into the appropriate install path
60 subdir('examples')
61
62 # build kernel modules if enabled
63 if get_option('enable_kmods')
64         subdir('kernel')
65 endif
66
67 # write the build config
68 build_cfg = 'rte_build_config.h'
69 configure_file(output: build_cfg,
70                 configuration: dpdk_conf,
71                 install_dir: join_paths(get_option('includedir'),
72                                 get_option('include_subdir_arch')))
73
74 # for static builds, include the drivers as libs and we need to "whole-archive"
75 # them.
76 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
77
78 pkg = import('pkgconfig')
79 pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
80 if is_freebsd
81         pkg_extra_cflags += ['-D__BSD_VISIBLE']
82 endif
83 pkg.generate(name: meson.project_name(),
84         filebase: 'lib' + meson.project_name().to_lower(),
85         version: meson.project_version(),
86         libraries: dpdk_libraries,
87         libraries_private: dpdk_drivers + dpdk_static_libraries +
88                         ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
89         requires: libbsd, # apps using rte_string_fns.h may need this if enabled
90                           # if libbsd is not enabled, then this is blank
91         description: '''The Data Plane Development Kit (DPDK).
92 Note that CFLAGS might contain an -march flag higher than typical baseline.
93 This is required for a number of static inline functions in the public headers.''',
94         subdirs: [get_option('include_subdir_arch'), '.'],
95         extra_cflags: pkg_extra_cflags
96 )
97
98 # final output, list all the libs and drivers to be built
99 # this does not affect any part of the build, for information only.
100 output_message = '\n=================\nLibraries Enabled\n=================\n'
101 output_message += '\nlibs:\n\t'
102 output_count = 0
103 foreach lib:enabled_libs
104         output_message += lib + ', '
105         output_count += 1
106         if output_count == 8
107                 output_message += '\n\t'
108                 output_count = 0
109         endif
110 endforeach
111 message(output_message + '\n')
112
113 output_message = '\n===============\nDrivers Enabled\n===============\n'
114 foreach class:dpdk_driver_classes
115         class_drivers = get_variable(class + '_drivers')
116         output_message += '\n' + class + ':\n\t'
117         output_count = 0
118         foreach drv:class_drivers
119                 output_message += drv + ', '
120                 output_count += 1
121                 if output_count == 8
122                         output_message += '\n\t'
123                         output_count = 0
124                 endif
125         endforeach
126 endforeach
127 message(output_message + '\n')
128
129 output_message = '\n=================\nContent Skipped\n=================\n'
130 output_message += '\nlibs:\n\t'
131 foreach lib:dpdk_libs_disabled
132         reason = get_variable(lib.underscorify() + '_disable_reason')
133         output_message += lib + ':\t' + reason + '\n\t'
134 endforeach
135 output_message += '\ndrivers:\n\t'
136 foreach drv:dpdk_drvs_disabled
137         reason = get_variable(drv.underscorify() + '_disable_reason')
138         output_message += drv + ':\t' + reason + '\n\t'
139 endforeach
140 message(output_message + '\n')