vhost: replace vDPA device ID in Vhost
[dpdk.git] / examples / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017-2019 Intel Corporation
3
4 driver_libs = []
5 node_libs = []
6 if get_option('default_library') == 'static'
7         driver_libs = dpdk_drivers
8         node_libs = dpdk_graph_nodes
9 endif
10
11 execinfo = cc.find_library('execinfo', required: false)
12
13 # list of all example apps. Keep 1-3 per line, in alphabetical order.
14 all_examples = [
15         'bbdev_app', 'bond',
16         'cmdline',
17         'distributor', 'ethtool',
18         'eventdev_pipeline',
19         'fips_validation', 'flow_classify',
20         'flow_filtering', 'helloworld',
21         'ioat',
22         'ip_fragmentation', 'ip_pipeline',
23         'ip_reassembly', 'ipsec-secgw',
24         'ipv4_multicast', 'kni',
25         'l2fwd', 'l2fwd-cat', 'l2fwd-event',
26         'l2fwd-crypto', 'l2fwd-jobstats',
27         'l2fwd-keepalive', 'l3fwd',
28         'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph',
29         'link_status_interrupt',
30         'multi_process/client_server_mp/mp_client',
31         'multi_process/client_server_mp/mp_server',
32         'multi_process/hotplug_mp',
33         'multi_process/simple_mp',
34         'multi_process/symmetric_mp',
35         'ntb', 'packet_ordering',
36         'performance-thread/l3fwd-thread',
37         'performance-thread/pthread_shim',
38         'ptpclient',
39         'qos_meter', 'qos_sched',
40         'rxtx_callbacks',
41         'server_node_efd/node',
42         'server_node_efd/server',
43         'service_cores',
44         'skeleton', 'tep_termination',
45         'timer', 'vdpa',
46         'vhost', 'vhost_crypto',
47         'vhost_blk', 'vm_power_manager',
48         'vm_power_manager/guest_cli',
49         'vmdq', 'vmdq_dcb',
50 ]
51 # install all example code on install - irrespective of whether the example in
52 # question is to be built as part of this build or not.
53 foreach ex:all_examples
54         install_subdir(ex,
55                         install_dir: get_option('datadir') + '/dpdk/examples',
56                         exclude_files: 'meson.build')
57 endforeach
58
59 if get_option('examples') == ''
60         subdir_done()
61 endif
62
63 if get_option('examples').to_lower() == 'all'
64         examples = all_examples
65         allow_skips = true # don't flag an error if we can't build an app
66 else
67         examples = get_option('examples').split(',')
68         allow_skips = false # error out if we can't build a requested app
69 endif
70 default_cflags = machine_args
71 if cc.has_argument('-Wno-format-truncation')
72         default_cflags += '-Wno-format-truncation'
73 endif
74
75 foreach example: examples
76         name = example.split('/')[-1]
77         build = true
78         sources = []
79         allow_experimental_apis = false
80         cflags = default_cflags
81
82         ext_deps = [execinfo]
83         includes = [include_directories(example)]
84         deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
85         if is_windows
86                 deps = ['eal'] # only supported lib on Windows currently
87         endif
88         subdir(example)
89
90         if build
91                 dep_objs = ext_deps
92                 foreach d:deps
93                         var_name = get_option('default_library') + '_rte_' + d
94                         if not is_variable(var_name)
95                                 error('Missing dependency "@0@" for example "@1@"'.format(d, name))
96                         endif
97                         dep_objs += [get_variable(var_name)]
98                 endforeach
99                 if allow_experimental_apis
100                         cflags += '-DALLOW_EXPERIMENTAL_API'
101                 endif
102                 executable('dpdk-' + name, sources,
103                         include_directories: includes,
104                         link_whole: driver_libs + node_libs,
105                         link_args: dpdk_extra_ldflags,
106                         c_args: cflags,
107                         dependencies: dep_objs)
108         elif not allow_skips
109                 error('Cannot build requested example "' + name + '"')
110         else
111                 message('Skipping example "' + name + '"')
112         endif
113 endforeach