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