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