16c9457c2SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause 2428eb983SAnand Rawat# Copyright(c) 2017-2019 Intel Corporation 3a25a650bSBruce Richardson 4a25a650bSBruce Richardsonproject('DPDK', 'C', 5c04172b5SBruce Richardson # Get version number from file. 6b77c1d1cSAli Alnubani # Fallback to "more" for Windows compatibility. 7b77c1d1cSAli Alnubani version: run_command(find_program('cat', 'more'), 8ecb904ccSBruce Richardson files('VERSION'), check: true).stdout().strip(), 9a25a650bSBruce Richardson license: 'BSD', 10d832326aSBruce Richardson default_options: [ 11d832326aSBruce Richardson 'buildtype=release', 12d832326aSBruce Richardson 'default_library=static', 13d832326aSBruce Richardson 'warning_level=2', 14d832326aSBruce Richardson ], 158c105308SGabriel Ganne meson_version: '>= 0.49.2' 16a25a650bSBruce Richardson) 17a25a650bSBruce Richardson 18bc461743SBruce Richardson# check for developer mode 19bc461743SBruce Richardsondeveloper_mode = false 20bc461743SBruce Richardsonif get_option('developer_mode').auto() 21bc461743SBruce Richardson if meson.version().version_compare('>=0.53') # fs module available 22bc461743SBruce Richardson fs = import('fs') 23bc461743SBruce Richardson developer_mode = fs.is_dir('.git') 24bc461743SBruce Richardson endif 25bc461743SBruce Richardsonelse 26bc461743SBruce Richardson developer_mode = get_option('developer_mode').enabled() 27bc461743SBruce Richardsonendif 28bc461743SBruce Richardsonif developer_mode 29bc461743SBruce Richardson message('## Building in Developer Mode ##') 30bc461743SBruce Richardsonendif 31bc461743SBruce Richardson 32a25a650bSBruce Richardson# set up some global vars for compiler, platform, configuration, etc. 33a25a650bSBruce Richardsoncc = meson.get_compiler('c') 34*e16b972bSBruce Richardsondpdk_source_root = meson.current_source_dir() 35*e16b972bSBruce Richardsondpdk_build_root = meson.current_build_dir() 36a25a650bSBruce Richardsondpdk_conf = configuration_data() 37a25a650bSBruce Richardsondpdk_libraries = [] 3857ae0ec6SKevin Laatzdpdk_static_libraries = [] 3905050ac4SBruce Richardsondpdk_chkinc_headers = [] 400ffbdd1dSAndrius Sirvysdpdk_driver_classes = [] 41a25a650bSBruce Richardsondpdk_drivers = [] 42a25a650bSBruce Richardsondpdk_extra_ldflags = [] 438baad6f8SBruce Richardsondpdk_libs_disabled = [] 448baad6f8SBruce Richardsondpdk_drvs_disabled = [] 453eb485c6SBruce Richardsonabi_version_file = files('ABI_VERSION') 46a25a650bSBruce Richardson 4744dfb297SBruce Richardsonif host_machine.cpu_family().startswith('x86') 4844dfb297SBruce Richardson arch_subdir = 'x86' 4944dfb297SBruce Richardsonelif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch') 5044dfb297SBruce Richardson arch_subdir = 'arm' 5144dfb297SBruce Richardsonelif host_machine.cpu_family().startswith('ppc') 5244dfb297SBruce Richardson arch_subdir = 'ppc' 5344dfb297SBruce Richardsonendif 5444dfb297SBruce Richardson 55a25a650bSBruce Richardson# configure the build, and make sure configs here and in config folder are 56a25a650bSBruce Richardson# able to be included in any file. We also store a global array of include dirs 57a25a650bSBruce Richardson# for passing to pmdinfogen scripts 58428eb983SAnand Rawatglobal_inc = include_directories('.', 'config', 5999a2dd95SBruce Richardson 'lib/eal/include', 6099a2dd95SBruce Richardson 'lib/eal/@0@/include'.format(host_machine.system()), 6199a2dd95SBruce Richardson 'lib/eal/@0@/include'.format(arch_subdir), 62428eb983SAnand Rawat) 6368b1f1cdSBruce Richardson 6468b1f1cdSBruce Richardson# do configuration and get tool paths 6568b1f1cdSBruce Richardsonsubdir('buildtools') 66a25a650bSBruce Richardsonsubdir('config') 67a25a650bSBruce Richardson 689314afb6SBruce Richardson# build libs and drivers 694c773788SBruce Richardsonsubdir('lib') 709314afb6SBruce Richardsonsubdir('drivers') 71a25a650bSBruce Richardson 727dd34c71SBruce Richardson# build binaries and installable tools 737dd34c71SBruce Richardsonsubdir('usertools') 7416ade738SBruce Richardsonsubdir('app') 75a25a650bSBruce Richardson 76720b14dbSLuca Boccassi# build docs 77720b14dbSLuca Boccassisubdir('doc') 78720b14dbSLuca Boccassi 7985d7158eSBruce Richardson# build any examples explicitly requested - useful for developers - and 8085d7158eSBruce Richardson# install any example code into the appropriate install path 8189f0711fSBruce Richardsonsubdir('examples') 82e5b95003SBruce Richardsoninstall_subdir('examples', 83e5b95003SBruce Richardson install_dir: get_option('datadir') + '/dpdk', 845d20515eSBruce Richardson exclude_files: ex_file_excludes) 8589f0711fSBruce Richardson 8689200580SBruce Richardson# build kernel modules if enabled 8789200580SBruce Richardsonif get_option('enable_kmods') 8889200580SBruce Richardson subdir('kernel') 8989200580SBruce Richardsonendif 9089200580SBruce Richardson 9105050ac4SBruce Richardson# check header includes if requested 9205050ac4SBruce Richardsonif get_option('check_includes') 9305050ac4SBruce Richardson subdir('buildtools/chkincs') 9405050ac4SBruce Richardsonendif 9505050ac4SBruce Richardson 96a25a650bSBruce Richardson# write the build config 97a25a650bSBruce Richardsonbuild_cfg = 'rte_build_config.h' 98a25a650bSBruce Richardsonconfigure_file(output: build_cfg, 99a25a650bSBruce Richardson configuration: dpdk_conf, 100d7939c5fSLuca Boccassi install_dir: join_paths(get_option('includedir'), 101d7939c5fSLuca Boccassi get_option('include_subdir_arch'))) 102a25a650bSBruce Richardson 10311a47f9fSBruce Richardson# build pkg-config files for dpdk 10411a47f9fSBruce Richardsonsubdir('buildtools/pkg-config') 105806c45ddSBruce Richardson 106806c45ddSBruce Richardson# final output, list all the libs and drivers to be built 107806c45ddSBruce Richardson# this does not affect any part of the build, for information only. 108806c45ddSBruce Richardsonoutput_message = '\n=================\nLibraries Enabled\n=================\n' 109806c45ddSBruce Richardsonoutput_message += '\nlibs:\n\t' 110806c45ddSBruce Richardsonoutput_count = 0 111806c45ddSBruce Richardsonforeach lib:enabled_libs 112806c45ddSBruce Richardson output_message += lib + ', ' 113806c45ddSBruce Richardson output_count += 1 114806c45ddSBruce Richardson if output_count == 8 115806c45ddSBruce Richardson output_message += '\n\t' 116806c45ddSBruce Richardson output_count = 0 117806c45ddSBruce Richardson endif 118806c45ddSBruce Richardsonendforeach 119806c45ddSBruce Richardsonmessage(output_message + '\n') 120806c45ddSBruce Richardson 121806c45ddSBruce Richardsonoutput_message = '\n===============\nDrivers Enabled\n===============\n' 1220ffbdd1dSAndrius Sirvysforeach class:dpdk_driver_classes 123806c45ddSBruce Richardson class_drivers = get_variable(class + '_drivers') 124806c45ddSBruce Richardson output_message += '\n' + class + ':\n\t' 125806c45ddSBruce Richardson output_count = 0 126806c45ddSBruce Richardson foreach drv:class_drivers 127806c45ddSBruce Richardson output_message += drv + ', ' 128806c45ddSBruce Richardson output_count += 1 129806c45ddSBruce Richardson if output_count == 8 130806c45ddSBruce Richardson output_message += '\n\t' 131806c45ddSBruce Richardson output_count = 0 132806c45ddSBruce Richardson endif 133806c45ddSBruce Richardson endforeach 134806c45ddSBruce Richardsonendforeach 135806c45ddSBruce Richardsonmessage(output_message + '\n') 1368baad6f8SBruce Richardson 1378baad6f8SBruce Richardsonoutput_message = '\n=================\nContent Skipped\n=================\n' 1388baad6f8SBruce Richardsonoutput_message += '\nlibs:\n\t' 1398baad6f8SBruce Richardsonforeach lib:dpdk_libs_disabled 1408baad6f8SBruce Richardson reason = get_variable(lib.underscorify() + '_disable_reason') 1418baad6f8SBruce Richardson output_message += lib + ':\t' + reason + '\n\t' 1428baad6f8SBruce Richardsonendforeach 1438baad6f8SBruce Richardsonoutput_message += '\ndrivers:\n\t' 1448baad6f8SBruce Richardsonforeach drv:dpdk_drvs_disabled 1458baad6f8SBruce Richardson reason = get_variable(drv.underscorify() + '_disable_reason') 1468baad6f8SBruce Richardson output_message += drv + ':\t' + reason + '\n\t' 1478baad6f8SBruce Richardsonendforeach 1488baad6f8SBruce Richardsonmessage(output_message + '\n') 149