dpdk/examples/meson.build
<<
>>
Prefs
   1# SPDX-License-Identifier: BSD-3-Clause
   2# Copyright(c) 2017-2019 Intel Corporation
   3
   4link_whole_libs = []
   5if get_option('default_library') == 'static'
   6    link_whole_libs = dpdk_static_libraries + dpdk_drivers
   7endif
   8
   9# list of all example apps. Keep 1-3 per line, in alphabetical order.
  10all_examples = [
  11        'bbdev_app',
  12        'bond',
  13        'cmdline',
  14        'distributor',
  15        'dma',
  16        'ethtool',
  17        'eventdev_pipeline',
  18        'fips_validation',
  19        'flow_classify',
  20        'flow_filtering',
  21        'helloworld',
  22        'ip_fragmentation',
  23        'ip_pipeline',
  24        'ip_reassembly',
  25        'ipsec-secgw',
  26        'ipv4_multicast',
  27        'kni',
  28        'l2fwd',
  29        'l2fwd-cat',
  30        'l2fwd-crypto',
  31        'l2fwd-event',
  32        'l2fwd-jobstats',
  33        'l2fwd-keepalive',
  34        'l3fwd',
  35        'l3fwd-graph',
  36        'l3fwd-power',
  37        'link_status_interrupt',
  38        'multi_process/client_server_mp/mp_client',
  39        'multi_process/client_server_mp/mp_server',
  40        'multi_process/hotplug_mp',
  41        'multi_process/simple_mp',
  42        'multi_process/symmetric_mp',
  43        'ntb',
  44        'packet_ordering',
  45        'pipeline',
  46        'ptpclient',
  47        'qos_meter',
  48        'qos_sched',
  49        'rxtx_callbacks',
  50        'server_node_efd/node',
  51        'server_node_efd/server',
  52        'service_cores',
  53        'skeleton',
  54        'timer',
  55        'vdpa',
  56        'vhost',
  57        'vhost_blk',
  58        'vhost_crypto',
  59        'vm_power_manager',
  60        'vm_power_manager/guest_cli',
  61        'vmdq',
  62        'vmdq_dcb',
  63]
  64
  65# on install, skip copying all meson.build files
  66ex_file_excludes = ['meson.build']
  67foreach ex:all_examples
  68    ex_file_excludes += [ex + '/meson.build']
  69endforeach
  70
  71if get_option('examples') == ''
  72    subdir_done()
  73endif
  74
  75if get_option('examples').to_lower() == 'all'
  76    examples = all_examples
  77    allow_skips = true # don't flag an error if we can't build an app
  78else
  79    examples = get_option('examples').split(',')
  80    allow_skips = false # error out if we can't build a requested app
  81endif
  82default_cflags = machine_args
  83if cc.has_argument('-Wno-format-truncation')
  84    default_cflags += '-Wno-format-truncation'
  85endif
  86default_ldflags = dpdk_extra_ldflags
  87if get_option('default_library') == 'static' and not is_windows
  88    default_ldflags += ['-Wl,--export-dynamic']
  89endif
  90
  91foreach example: examples
  92    name = example.split('/')[-1]
  93    build = true
  94    sources = []
  95    allow_experimental_apis = false
  96    cflags = default_cflags
  97    ldflags = default_ldflags
  98
  99    ext_deps = []
 100    includes = [include_directories(example, 'common')]
 101    deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
 102    subdir(example)
 103
 104    if build
 105        dep_objs = ext_deps
 106        foreach d:deps
 107            var_name = get_option('default_library') + '_rte_' + d
 108            if not is_variable(var_name)
 109                build = false
 110                message('Missing dependency "@0@" for example "@1@"'.format(d, name))
 111                break
 112            endif
 113            dep_objs += [get_variable(var_name)]
 114        endforeach
 115    endif
 116
 117    if not build
 118        if not allow_skips
 119            error('Cannot build requested example "' + name + '"')
 120        endif
 121        message('Skipping example "' + name + '"')
 122        continue
 123    endif
 124
 125    if allow_experimental_apis
 126        cflags += '-DALLOW_EXPERIMENTAL_API'
 127    endif
 128    executable('dpdk-' + name, sources,
 129            include_directories: includes,
 130            link_whole: link_whole_libs,
 131            link_args: ldflags,
 132            c_args: cflags,
 133            dependencies: dep_objs)
 134endforeach
 135