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