16c9457c2SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause 2fa647c57SAnand Rawat# Copyright(c) 2017-2019 Intel Corporation 389f0711fSBruce Richardson 4e2db26f7SBruce Richardsonlink_whole_libs = [] 589f0711fSBruce Richardsonif get_option('default_library') == 'static' 6e2db26f7SBruce Richardson link_whole_libs = dpdk_static_libraries + dpdk_drivers 789f0711fSBruce Richardsonendif 889f0711fSBruce Richardson 9699729beSBruce Richardson# list of all example apps. Keep 1-3 per line, in alphabetical order. 10699729beSBruce Richardsonall_examples = [ 11cf59165dSBruce Richardson 'bbdev_app', 12cf59165dSBruce Richardson 'bond', 13e6d78628SBruce Richardson 'cmdline', 14cf59165dSBruce Richardson 'distributor', 15bb4141dbSKevin Laatz 'dma', 16cf59165dSBruce Richardson 'ethtool', 17207361b3SBruce Richardson 'eventdev_pipeline', 18cf59165dSBruce Richardson 'fips_validation', 19cf59165dSBruce Richardson 'flow_filtering', 20cf59165dSBruce Richardson 'helloworld', 21cf59165dSBruce Richardson 'ip_fragmentation', 22cf59165dSBruce Richardson 'ip_pipeline', 23cf59165dSBruce Richardson 'ip_reassembly', 24cf59165dSBruce Richardson 'ipsec-secgw', 25cf59165dSBruce Richardson 'ipv4_multicast', 26cf59165dSBruce Richardson 'l2fwd', 27cf59165dSBruce Richardson 'l2fwd-cat', 28cf59165dSBruce Richardson 'l2fwd-crypto', 29cf59165dSBruce Richardson 'l2fwd-event', 30cf59165dSBruce Richardson 'l2fwd-jobstats', 31cf59165dSBruce Richardson 'l2fwd-keepalive', 32*322ebca6SAkhil Goyal 'l2fwd-macsec', 33cf59165dSBruce Richardson 'l3fwd', 34cf59165dSBruce Richardson 'l3fwd-graph', 35cf59165dSBruce Richardson 'l3fwd-power', 36bd6e9819SBruce Richardson 'link_status_interrupt', 37f10aadfdSAli Alnubani 'multi_process/client_server_mp/mp_client', 38f10aadfdSAli Alnubani 'multi_process/client_server_mp/mp_server', 39f10aadfdSAli Alnubani 'multi_process/hotplug_mp', 40f10aadfdSAli Alnubani 'multi_process/simple_mp', 41f10aadfdSAli Alnubani 'multi_process/symmetric_mp', 42cf59165dSBruce Richardson 'ntb', 43cf59165dSBruce Richardson 'packet_ordering', 44b77f6600SCristian Dumitrescu 'pipeline', 4564eee69aSBruce Richardson 'ptpclient', 46cf59165dSBruce Richardson 'qos_meter', 47cf59165dSBruce Richardson 'qos_sched', 4846971b27SCiara Power 'rxtx_callbacks', 497faf4bd3SDavid Marchand 'server_node_efd/efd_node', 507faf4bd3SDavid Marchand 'server_node_efd/efd_server', 516186dea0SBruce Richardson 'service_cores', 52079981e9SXiaoyun Li 'skeleton', 53cf59165dSBruce Richardson 'timer', 54cf59165dSBruce Richardson 'vdpa', 55cf59165dSBruce Richardson 'vhost', 56cf59165dSBruce Richardson 'vhost_blk', 57cf59165dSBruce Richardson 'vhost_crypto', 58cf59165dSBruce Richardson 'vm_power_manager', 597f7d4406SBruce Richardson 'vm_power_manager/guest_cli', 60cf59165dSBruce Richardson 'vmdq', 61cf59165dSBruce Richardson 'vmdq_dcb', 62699729beSBruce Richardson] 63038e5eccSBruce Richardson 645d20515eSBruce Richardson# on install, skip copying all meson.build files 655d20515eSBruce Richardsonex_file_excludes = ['meson.build'] 665d20515eSBruce Richardsonforeach ex:all_examples 675d20515eSBruce Richardson ex_file_excludes += [ex + '/meson.build'] 685d20515eSBruce Richardsonendforeach 695d20515eSBruce Richardson 7085d7158eSBruce Richardsonif get_option('examples') == '' 7185d7158eSBruce Richardson subdir_done() 7285d7158eSBruce Richardsonendif 7385d7158eSBruce Richardson 74038e5eccSBruce Richardsonif get_option('examples').to_lower() == 'all' 752daf565fSBruce Richardson examples = all_examples 762daf565fSBruce Richardson allow_skips = true # don't flag an error if we can't build an app 77038e5eccSBruce Richardsonelse 78038e5eccSBruce Richardson examples = get_option('examples').split(',') 79038e5eccSBruce Richardson allow_skips = false # error out if we can't build a requested app 80038e5eccSBruce Richardsonendif 813e3eeb4dSBruce Richardsondefault_cflags = machine_args 823e3eeb4dSBruce Richardsonif cc.has_argument('-Wno-format-truncation') 833e3eeb4dSBruce Richardson default_cflags += '-Wno-format-truncation' 843e3eeb4dSBruce Richardsonendif 85b031e13dSOlivier Matzdefault_ldflags = dpdk_extra_ldflags 86da042bcfSDmitry Kozlyukif get_option('default_library') == 'static' and not is_windows 87b031e13dSOlivier Matz default_ldflags += ['-Wl,--export-dynamic'] 88b031e13dSOlivier Matzendif 895d7b673dSAnatoly Burakov 90038e5eccSBruce Richardsonforeach example: examples 91711d11c6SAli Alnubani name = example.split('/')[-1] 92038e5eccSBruce Richardson build = true 9389f0711fSBruce Richardson sources = [] 9489f0711fSBruce Richardson allow_experimental_apis = false 953e3eeb4dSBruce Richardson cflags = default_cflags 96b031e13dSOlivier Matz ldflags = default_ldflags 97d292a42fSGavin Hu 981cd512b2SThomas Monjalon ext_deps = [] 99732115ceSRahul Bhansali includes = [include_directories(example, 'common')] 10089f0711fSBruce Richardson deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline'] 10189f0711fSBruce Richardson subdir(example) 10289f0711fSBruce Richardson 103f01ca13fSDavid Marchand if build 104f01ca13fSDavid Marchand dep_objs = ext_deps 105f01ca13fSDavid Marchand foreach d:deps 106f01ca13fSDavid Marchand var_name = get_option('default_library') + '_rte_' + d 107f01ca13fSDavid Marchand if not is_variable(var_name) 108f01ca13fSDavid Marchand build = false 109f01ca13fSDavid Marchand message('Missing dependency "@0@" for example "@1@"'.format(d, name)) 110f01ca13fSDavid Marchand break 111f01ca13fSDavid Marchand endif 112f01ca13fSDavid Marchand dep_objs += [get_variable(var_name)] 113f01ca13fSDavid Marchand endforeach 114f01ca13fSDavid Marchand endif 115f01ca13fSDavid Marchand 116cf59165dSBruce Richardson if not build 117cf59165dSBruce Richardson if not allow_skips 118cf59165dSBruce Richardson error('Cannot build requested example "' + name + '"') 119cf59165dSBruce Richardson endif 120cf59165dSBruce Richardson message('Skipping example "' + name + '"') 121cf59165dSBruce Richardson continue 122cf59165dSBruce Richardson endif 123cf59165dSBruce Richardson 12489f0711fSBruce Richardson if allow_experimental_apis 12589f0711fSBruce Richardson cflags += '-DALLOW_EXPERIMENTAL_API' 12689f0711fSBruce Richardson endif 12789f0711fSBruce Richardson executable('dpdk-' + name, sources, 12889f0711fSBruce Richardson include_directories: includes, 129de321d59SThomas Monjalon link_whole: link_whole_libs, 130b031e13dSOlivier Matz link_args: ldflags, 13189f0711fSBruce Richardson c_args: cflags, 13289f0711fSBruce Richardson dependencies: dep_objs) 13389f0711fSBruce Richardsonendforeach 134