xref: /dpdk/meson.build (revision 42f4d724)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2017 Intel Corporation
3
4project('DPDK', 'C',
5	version: '18.11.0-rc0',
6	license: 'BSD',
7	default_options: ['buildtype=release', 'default_library=static'],
8	meson_version: '>= 0.41'
9)
10
11# set up some global vars for compiler, platform, configuration, etc.
12cc = meson.get_compiler('c')
13dpdk_conf = configuration_data()
14dpdk_libraries = []
15dpdk_drivers = []
16dpdk_extra_ldflags = []
17
18driver_install_path = join_paths(get_option('libdir'), 'dpdk/drivers')
19eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
20
21# configure the build, and make sure configs here and in config folder are
22# able to be included in any file. We also store a global array of include dirs
23# for passing to pmdinfogen scripts
24global_inc = include_directories('.', 'config')
25subdir('config')
26
27# build libs and drivers
28subdir('lib')
29subdir('buildtools')
30subdir('drivers')
31
32# build binaries and installable tools
33subdir('usertools')
34subdir('app')
35subdir('test')
36
37# build docs
38subdir('doc')
39
40# build any examples explicitly requested - useful for developers
41if get_option('examples') != ''
42	subdir('examples')
43endif
44
45# build kernel modules if enabled
46if get_option('enable_kmods')
47	subdir('kernel')
48endif
49
50# write the build config
51build_cfg = 'rte_build_config.h'
52configure_file(output: build_cfg,
53		configuration: dpdk_conf,
54		install_dir: join_paths(get_option('includedir'),
55				get_option('include_subdir_arch')))
56
57# for static builds, include the drivers as libs and we need to "whole-archive"
58# them.
59dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
60
61# driver .so files often depend upon the bus drivers for their connect bus,
62# e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
63# to be in the library path, so symlink the drivers from the main lib directory.
64meson.add_install_script('buildtools/symlink-drivers-solibs.sh',
65		driver_install_path,
66		get_option('libdir'))
67
68pkg = import('pkgconfig')
69pkg.generate(name: meson.project_name(),
70	filebase: 'lib' + meson.project_name().to_lower(),
71	version: meson.project_version(),
72	libraries: dpdk_libraries,
73	libraries_private: dpdk_drivers + dpdk_libraries +
74			['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
75	description: 'The Data Plane Development Kit (DPDK)',
76	subdirs: [get_option('include_subdir_arch'), '.'],
77	extra_cflags: ['-include', 'rte_config.h'] + machine_args
78)
79
80# final output, list all the libs and drivers to be built
81# this does not affect any part of the build, for information only.
82output_message = '\n=================\nLibraries Enabled\n=================\n'
83output_message += '\nlibs:\n\t'
84output_count = 0
85foreach lib:enabled_libs
86	output_message += lib + ', '
87	output_count += 1
88	if output_count == 8
89		output_message += '\n\t'
90		output_count = 0
91	endif
92endforeach
93message(output_message + '\n')
94
95
96# prior to 0.47 set_variable didn't work with arrays, so we can't
97# track driver lists easily
98if meson.version().version_compare('>=0.47')
99	output_message = '\n===============\nDrivers Enabled\n===============\n'
100	foreach class:driver_classes
101		class_drivers = get_variable(class + '_drivers')
102		output_message += '\n' + class + ':\n\t'
103		output_count = 0
104		foreach drv:class_drivers
105			output_message += drv + ', '
106			output_count += 1
107			if output_count == 8
108				output_message += '\n\t'
109				output_count = 0
110			endif
111		endforeach
112	endforeach
113	message(output_message + '\n')
114endif
115