1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017 Intel Corporation 3 4project('DPDK', 'C', 5 version: '19.05.0-rc0', 6 license: 'BSD', 7 default_options: ['buildtype=release', 'default_library=static'], 8 meson_version: '>= 0.47.1' 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_static_libraries = [] 16dpdk_driver_classes = [] 17dpdk_drivers = [] 18dpdk_extra_ldflags = [] 19dpdk_app_link_libraries = [] 20 21# set the major version, which might be used by drivers and libraries 22# depending on the configuration options 23pver = meson.project_version().split('.') 24major_version = '@0@.@1@'.format(pver.get(0), pver.get(1)) 25 26pmd_subdir_opt = get_option('drivers_install_subdir') 27if pmd_subdir_opt.contains('<VERSION>') 28 pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>')) 29endif 30driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt) 31eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) 32 33# configure the build, and make sure configs here and in config folder are 34# able to be included in any file. We also store a global array of include dirs 35# for passing to pmdinfogen scripts 36global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include') 37subdir('config') 38 39# build libs and drivers 40subdir('lib') 41subdir('buildtools') 42subdir('drivers') 43 44# build binaries and installable tools 45subdir('usertools') 46subdir('app') 47 48# build docs 49subdir('doc') 50 51# build any examples explicitly requested - useful for developers 52if get_option('examples') != '' 53 subdir('examples') 54endif 55 56# build kernel modules if enabled 57if get_option('enable_kmods') 58 subdir('kernel') 59endif 60 61# write the build config 62build_cfg = 'rte_build_config.h' 63configure_file(output: build_cfg, 64 configuration: dpdk_conf, 65 install_dir: join_paths(get_option('includedir'), 66 get_option('include_subdir_arch'))) 67 68# for static builds, include the drivers as libs and we need to "whole-archive" 69# them. 70dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] 71 72# driver .so files often depend upon the bus drivers for their connect bus, 73# e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need 74# to be in the library path, so symlink the drivers from the main lib directory. 75meson.add_install_script('buildtools/symlink-drivers-solibs.sh', 76 driver_install_path, 77 get_option('libdir')) 78 79pkg = import('pkgconfig') 80pkg.generate(name: meson.project_name(), 81 filebase: 'lib' + meson.project_name().to_lower(), 82 version: meson.project_version(), 83 libraries: dpdk_libraries, 84 libraries_private: dpdk_drivers + dpdk_static_libraries + 85 ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, 86 description: '''The Data Plane Development Kit (DPDK). 87Note that CFLAGS might contain an -march flag higher than typical baseline. 88This is required for a number of static inline functions in the public headers.''', 89 subdirs: [get_option('include_subdir_arch'), '.'], 90 extra_cflags: ['-include', 'rte_config.h'] + machine_args 91) 92 93# final output, list all the libs and drivers to be built 94# this does not affect any part of the build, for information only. 95output_message = '\n=================\nLibraries Enabled\n=================\n' 96output_message += '\nlibs:\n\t' 97output_count = 0 98foreach lib:enabled_libs 99 output_message += lib + ', ' 100 output_count += 1 101 if output_count == 8 102 output_message += '\n\t' 103 output_count = 0 104 endif 105endforeach 106message(output_message + '\n') 107 108output_message = '\n===============\nDrivers Enabled\n===============\n' 109foreach class:dpdk_driver_classes 110 class_drivers = get_variable(class + '_drivers') 111 output_message += '\n' + class + ':\n\t' 112 output_count = 0 113 foreach drv:class_drivers 114 output_message += drv + ', ' 115 output_count += 1 116 if output_count == 8 117 output_message += '\n\t' 118 output_count = 0 119 endif 120 endforeach 121endforeach 122message(output_message + '\n') 123