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 9execinfo = cc.find_library('execinfo', required: false) 10 11# list of all example apps. Keep 1-3 per line, in alphabetical order. 12all_examples = [ 13 'bbdev_app', 'bond', 14 'cmdline', 15 'distributor', 'ethtool', 16 'eventdev_pipeline', 17 'fips_validation', 'flow_classify', 18 'flow_filtering', 'helloworld', 19 'ioat', 20 'ip_fragmentation', 'ip_pipeline', 21 'ip_reassembly', 'ipsec-secgw', 22 'ipv4_multicast', 'kni', 23 'l2fwd', 'l2fwd-cat', 'l2fwd-event', 24 'l2fwd-crypto', 'l2fwd-jobstats', 25 'l2fwd-keepalive', 'l3fwd', 26 'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph', 27 'link_status_interrupt', 28 'multi_process/client_server_mp/mp_client', 29 'multi_process/client_server_mp/mp_server', 30 'multi_process/hotplug_mp', 31 'multi_process/simple_mp', 32 'multi_process/symmetric_mp', 33 'ntb', 'packet_ordering', 34 'performance-thread/l3fwd-thread', 35 'performance-thread/pthread_shim', 36 'pipeline', 37 'ptpclient', 38 'qos_meter', 'qos_sched', 39 'rxtx_callbacks', 40 'server_node_efd/node', 41 'server_node_efd/server', 42 'service_cores', 43 'skeleton', 44 'timer', 'vdpa', 45 'vhost', 'vhost_crypto', 46 'vhost_blk', 'vm_power_manager', 47 'vm_power_manager/guest_cli', 48 'vmdq', 'vmdq_dcb', 49] 50 51if get_option('examples') == '' 52 subdir_done() 53endif 54 55if get_option('examples').to_lower() == 'all' 56 examples = all_examples 57 allow_skips = true # don't flag an error if we can't build an app 58else 59 examples = get_option('examples').split(',') 60 allow_skips = false # error out if we can't build a requested app 61endif 62default_cflags = machine_args 63if cc.has_argument('-Wno-format-truncation') 64 default_cflags += '-Wno-format-truncation' 65endif 66default_ldflags = dpdk_extra_ldflags 67if get_option('default_library') == 'static' and not is_windows 68 default_ldflags += ['-Wl,--export-dynamic'] 69endif 70 71foreach example: examples 72 name = example.split('/')[-1] 73 build = true 74 sources = [] 75 allow_experimental_apis = false 76 cflags = default_cflags 77 ldflags = default_ldflags 78 79 ext_deps = [execinfo] 80 includes = [include_directories(example)] 81 deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] 82 subdir(example) 83 84 if build 85 dep_objs = ext_deps 86 foreach d:deps 87 var_name = get_option('default_library') + '_rte_' + d 88 if not is_variable(var_name) 89 error('Missing dependency "@0@" for example "@1@"'.format(d, name)) 90 endif 91 dep_objs += [get_variable(var_name)] 92 endforeach 93 if allow_experimental_apis 94 cflags += '-DALLOW_EXPERIMENTAL_API' 95 endif 96 executable('dpdk-' + name, sources, 97 include_directories: includes, 98 link_whole: link_whole_libs, 99 link_args: ldflags, 100 c_args: cflags, 101 dependencies: dep_objs) 102 elif not allow_skips 103 error('Cannot build requested example "' + name + '"') 104 else 105 message('Skipping example "' + name + '"') 106 endif 107endforeach 108