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