xref: /f-stack/dpdk/meson.build (revision 2d9fd380)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2017-2019 Intel Corporation
3
4project('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.
15cc = meson.get_compiler('c')
16dpdk_conf = configuration_data()
17dpdk_libraries = []
18dpdk_static_libraries = []
19dpdk_driver_classes = []
20dpdk_drivers = []
21dpdk_extra_ldflags = []
22dpdk_libs_disabled = []
23dpdk_drvs_disabled = []
24abi_version_file = files('ABI_VERSION')
25
26if host_machine.cpu_family().startswith('x86')
27	arch_subdir = 'x86'
28elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
29	arch_subdir = 'arm'
30elif host_machine.cpu_family().startswith('ppc')
31	arch_subdir = 'ppc'
32endif
33
34# configure the build, and make sure configs here and in config folder are
35# able to be included in any file. We also store a global array of include dirs
36# for passing to pmdinfogen scripts
37global_inc = include_directories('.', 'config',
38	'lib/librte_eal/include',
39	'lib/librte_eal/@0@/include'.format(host_machine.system()),
40	'lib/librte_eal/@0@/include'.format(arch_subdir),
41)
42
43# do configuration and get tool paths
44subdir('buildtools')
45subdir('config')
46
47# build libs and drivers
48subdir('buildtools/pmdinfogen')
49subdir('lib')
50subdir('drivers')
51
52# build binaries and installable tools
53subdir('usertools')
54subdir('app')
55
56# build docs
57subdir('doc')
58
59# build any examples explicitly requested - useful for developers - and
60# install any example code into the appropriate install path
61subdir('examples')
62install_subdir('examples',
63	install_dir: get_option('datadir') + '/dpdk',
64	exclude_files: 'meson.build')
65
66# build kernel modules if enabled
67if get_option('enable_kmods')
68	subdir('kernel')
69endif
70
71# write the build config
72build_cfg = 'rte_build_config.h'
73configure_file(output: build_cfg,
74		configuration: dpdk_conf,
75		install_dir: join_paths(get_option('includedir'),
76				get_option('include_subdir_arch')))
77
78# build pkg-config files for dpdk
79subdir('buildtools/pkg-config')
80
81# final output, list all the libs and drivers to be built
82# this does not affect any part of the build, for information only.
83output_message = '\n=================\nLibraries Enabled\n=================\n'
84output_message += '\nlibs:\n\t'
85output_count = 0
86foreach lib:enabled_libs
87	output_message += lib + ', '
88	output_count += 1
89	if output_count == 8
90		output_message += '\n\t'
91		output_count = 0
92	endif
93endforeach
94message(output_message + '\n')
95
96output_message = '\n===============\nDrivers Enabled\n===============\n'
97foreach class:dpdk_driver_classes
98	class_drivers = get_variable(class + '_drivers')
99	output_message += '\n' + class + ':\n\t'
100	output_count = 0
101	foreach drv:class_drivers
102		output_message += drv + ', '
103		output_count += 1
104		if output_count == 8
105			output_message += '\n\t'
106			output_count = 0
107		endif
108	endforeach
109endforeach
110message(output_message + '\n')
111
112output_message = '\n=================\nContent Skipped\n=================\n'
113output_message += '\nlibs:\n\t'
114foreach lib:dpdk_libs_disabled
115	reason = get_variable(lib.underscorify() + '_disable_reason')
116	output_message += lib + ':\t' + reason + '\n\t'
117endforeach
118output_message += '\ndrivers:\n\t'
119foreach drv:dpdk_drvs_disabled
120	reason = get_variable(drv.underscorify() + '_disable_reason')
121	output_message += drv + ':\t' + reason + '\n\t'
122endforeach
123message(output_message + '\n')
124