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