dpdk/meson.build
<<
>>
Prefs
   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.49.2'
  12)
  13
  14# check for developer mode
  15developer_mode = false
  16if get_option('developer_mode').auto()
  17    if meson.version().version_compare('>=0.53') # fs module available
  18        fs = import('fs')
  19        developer_mode = fs.is_dir('.git')
  20    endif
  21else
  22    developer_mode = get_option('developer_mode').enabled()
  23endif
  24if developer_mode
  25    message('## Building in Developer Mode ##')
  26endif
  27
  28# set up some global vars for compiler, platform, configuration, etc.
  29cc = meson.get_compiler('c')
  30dpdk_conf = configuration_data()
  31dpdk_libraries = []
  32dpdk_static_libraries = []
  33dpdk_chkinc_headers = []
  34dpdk_driver_classes = []
  35dpdk_drivers = []
  36dpdk_extra_ldflags = []
  37dpdk_libs_disabled = []
  38dpdk_drvs_disabled = []
  39abi_version_file = files('ABI_VERSION')
  40
  41if host_machine.cpu_family().startswith('x86')
  42    arch_subdir = 'x86'
  43elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
  44    arch_subdir = 'arm'
  45elif host_machine.cpu_family().startswith('ppc')
  46    arch_subdir = 'ppc'
  47endif
  48
  49# configure the build, and make sure configs here and in config folder are
  50# able to be included in any file. We also store a global array of include dirs
  51# for passing to pmdinfogen scripts
  52global_inc = include_directories('.', 'config',
  53    'lib/eal/include',
  54    'lib/eal/@0@/include'.format(host_machine.system()),
  55    'lib/eal/@0@/include'.format(arch_subdir),
  56)
  57
  58# do configuration and get tool paths
  59subdir('buildtools')
  60subdir('config')
  61
  62# build libs and drivers
  63subdir('lib')
  64subdir('drivers')
  65
  66# build binaries and installable tools
  67subdir('usertools')
  68subdir('app')
  69
  70# build docs
  71subdir('doc')
  72
  73# build any examples explicitly requested - useful for developers - and
  74# install any example code into the appropriate install path
  75subdir('examples')
  76install_subdir('examples',
  77        install_dir: get_option('datadir') + '/dpdk',
  78        exclude_files: ex_file_excludes)
  79
  80# build kernel modules if enabled
  81if get_option('enable_kmods')
  82    subdir('kernel')
  83endif
  84
  85# check header includes if requested
  86if get_option('check_includes')
  87    subdir('buildtools/chkincs')
  88endif
  89
  90# write the build config
  91build_cfg = 'rte_build_config.h'
  92configure_file(output: build_cfg,
  93        configuration: dpdk_conf,
  94        install_dir: join_paths(get_option('includedir'),
  95            get_option('include_subdir_arch')))
  96
  97# build pkg-config files for dpdk
  98subdir('buildtools/pkg-config')
  99
 100# final output, list all the libs and drivers to be built
 101# this does not affect any part of the build, for information only.
 102output_message = '\n=================\nLibraries Enabled\n=================\n'
 103output_message += '\nlibs:\n\t'
 104output_count = 0
 105foreach lib:enabled_libs
 106    output_message += lib + ', '
 107    output_count += 1
 108    if output_count == 8
 109        output_message += '\n\t'
 110        output_count = 0
 111    endif
 112endforeach
 113message(output_message + '\n')
 114
 115output_message = '\n===============\nDrivers Enabled\n===============\n'
 116foreach class:dpdk_driver_classes
 117    class_drivers = get_variable(class + '_drivers')
 118    output_message += '\n' + class + ':\n\t'
 119    output_count = 0
 120    foreach drv:class_drivers
 121        output_message += drv + ', '
 122        output_count += 1
 123        if output_count == 8
 124            output_message += '\n\t'
 125            output_count = 0
 126        endif
 127    endforeach
 128endforeach
 129message(output_message + '\n')
 130
 131output_message = '\n=================\nContent Skipped\n=================\n'
 132output_message += '\nlibs:\n\t'
 133foreach lib:dpdk_libs_disabled
 134    reason = get_variable(lib.underscorify() + '_disable_reason')
 135    output_message += lib + ':\t' + reason + '\n\t'
 136endforeach
 137output_message += '\ndrivers:\n\t'
 138foreach drv:dpdk_drvs_disabled
 139    reason = get_variable(drv.underscorify() + '_disable_reason')
 140    output_message += drv + ':\t' + reason + '\n\t'
 141endforeach
 142message(output_message + '\n')
 143