1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
5 # Get version number from file.
6 # Use "more" rather than "cat" for windows compatibility.
7 version: run_command('more', files('VERSION')).stdout().strip(),
9 default_options: ['buildtype=release', 'default_library=static'],
10 meson_version: '>= 0.47.1'
13 # set up some global vars for compiler, platform, configuration, etc.
14 cc = meson.get_compiler('c')
15 dpdk_conf = configuration_data()
17 dpdk_static_libraries = []
18 dpdk_driver_classes = []
20 dpdk_extra_ldflags = []
21 dpdk_app_link_libraries = []
23 # configure the build, and make sure configs here and in config folder are
24 # able to be included in any file. We also store a global array of include dirs
25 # for passing to pmdinfogen scripts
26 global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
29 # build libs and drivers
34 # build binaries and installable tools
41 # build any examples explicitly requested - useful for developers
42 if get_option('examples') != ''
46 # build kernel modules if enabled
47 if get_option('enable_kmods')
51 # write the build config
52 build_cfg = 'rte_build_config.h'
53 configure_file(output: build_cfg,
54 configuration: dpdk_conf,
55 install_dir: join_paths(get_option('includedir'),
56 get_option('include_subdir_arch')))
58 # for static builds, include the drivers as libs and we need to "whole-archive"
60 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
62 # driver .so files often depend upon the bus drivers for their connect bus,
63 # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
64 # to be in the library path, so symlink the drivers from the main lib directory.
65 meson.add_install_script('buildtools/symlink-drivers-solibs.sh',
69 pkg = import('pkgconfig')
70 pkg.generate(name: meson.project_name(),
71 filebase: 'lib' + meson.project_name().to_lower(),
72 version: meson.project_version(),
73 libraries: dpdk_libraries,
74 libraries_private: dpdk_drivers + dpdk_static_libraries +
75 ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
76 description: '''The Data Plane Development Kit (DPDK).
77 Note that CFLAGS might contain an -march flag higher than typical baseline.
78 This is required for a number of static inline functions in the public headers.''',
79 subdirs: [get_option('include_subdir_arch'), '.'],
80 extra_cflags: ['-include', 'rte_config.h'] + machine_args
83 # final output, list all the libs and drivers to be built
84 # this does not affect any part of the build, for information only.
85 output_message = '\n=================\nLibraries Enabled\n=================\n'
86 output_message += '\nlibs:\n\t'
88 foreach lib:enabled_libs
89 output_message += lib + ', '
92 output_message += '\n\t'
96 message(output_message + '\n')
98 output_message = '\n===============\nDrivers Enabled\n===============\n'
99 foreach class:dpdk_driver_classes
100 class_drivers = get_variable(class + '_drivers')
101 output_message += '\n' + class + ':\n\t'
103 foreach drv:class_drivers
104 output_message += drv + ', '
107 output_message += '\n\t'
112 message(output_message + '\n')