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