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