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