1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017-2019 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', 28 'lib/librte_eal/common/include', 29 'lib/librte_eal/@0@/eal/include'.format(host_machine.system()), 30) 31subdir('config') 32 33# build libs and drivers 34subdir('buildtools') 35subdir('lib') 36subdir('drivers') 37 38# build binaries and installable tools 39subdir('usertools') 40subdir('app') 41 42# build docs 43subdir('doc') 44 45# build any examples explicitly requested - useful for developers - and 46# install any example code into the appropriate install path 47subdir('examples') 48 49# build kernel modules if enabled 50if get_option('enable_kmods') 51 subdir('kernel') 52endif 53 54# write the build config 55build_cfg = 'rte_build_config.h' 56configure_file(output: build_cfg, 57 configuration: dpdk_conf, 58 install_dir: join_paths(get_option('includedir'), 59 get_option('include_subdir_arch'))) 60 61# for static builds, include the drivers as libs and we need to "whole-archive" 62# them. 63dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] 64 65pkg = import('pkgconfig') 66pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args 67if is_freebsd 68 pkg_extra_cflags += ['-D__BSD_VISIBLE'] 69endif 70pkg.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 requires: libbsd, # apps using rte_string_fns.h may need this if enabled 77 # if libbsd is not enabled, then this is blank 78 description: '''The Data Plane Development Kit (DPDK). 79Note that CFLAGS might contain an -march flag higher than typical baseline. 80This is required for a number of static inline functions in the public headers.''', 81 subdirs: [get_option('include_subdir_arch'), '.'], 82 extra_cflags: pkg_extra_cflags 83) 84 85# final output, list all the libs and drivers to be built 86# this does not affect any part of the build, for information only. 87output_message = '\n=================\nLibraries Enabled\n=================\n' 88output_message += '\nlibs:\n\t' 89output_count = 0 90foreach lib:enabled_libs 91 output_message += lib + ', ' 92 output_count += 1 93 if output_count == 8 94 output_message += '\n\t' 95 output_count = 0 96 endif 97endforeach 98message(output_message + '\n') 99 100output_message = '\n===============\nDrivers Enabled\n===============\n' 101foreach class:dpdk_driver_classes 102 class_drivers = get_variable(class + '_drivers') 103 output_message += '\n' + class + ':\n\t' 104 output_count = 0 105 foreach drv:class_drivers 106 output_message += drv + ', ' 107 output_count += 1 108 if output_count == 8 109 output_message += '\n\t' 110 output_count = 0 111 endif 112 endforeach 113endforeach 114message(output_message + '\n') 115