1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017 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_app_link_libraries = [] 23 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 27global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include') 28subdir('config') 29 30# build libs and drivers 31subdir('lib') 32subdir('buildtools') 33subdir('drivers') 34 35# build binaries and installable tools 36subdir('usertools') 37subdir('app') 38 39# build docs 40subdir('doc') 41 42# build any examples explicitly requested - useful for developers 43if get_option('examples') != '' 44 subdir('examples') 45endif 46 47# build kernel modules if enabled 48if get_option('enable_kmods') 49 subdir('kernel') 50endif 51 52# write the build config 53build_cfg = 'rte_build_config.h' 54configure_file(output: build_cfg, 55 configuration: dpdk_conf, 56 install_dir: join_paths(get_option('includedir'), 57 get_option('include_subdir_arch'))) 58 59# for static builds, include the drivers as libs and we need to "whole-archive" 60# them. 61dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] 62 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. 66meson.add_install_script('buildtools/symlink-drivers-solibs.sh', 67 driver_install_path, 68 get_option('libdir')) 69 70pkg = import('pkgconfig') 71pkg.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). 78Note that CFLAGS might contain an -march flag higher than typical baseline. 79This 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 82) 83 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. 86output_message = '\n=================\nLibraries Enabled\n=================\n' 87output_message += '\nlibs:\n\t' 88output_count = 0 89foreach lib:enabled_libs 90 output_message += lib + ', ' 91 output_count += 1 92 if output_count == 8 93 output_message += '\n\t' 94 output_count = 0 95 endif 96endforeach 97message(output_message + '\n') 98 99output_message = '\n===============\nDrivers Enabled\n===============\n' 100foreach class:dpdk_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 112endforeach 113message(output_message + '\n') 114