net: add rte prefix to ICMP structure
[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         'bpf', 'cmdline',
15         'distributor', 'ethtool',
16         'eventdev_pipeline', 'exception_path',
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         'l3fwd-vf', 'link_status_interrupt',
27         'load_balancer', 'multi_process',
28         'netmap_compat', 'packet_ordering',
29         'performance-thread', 'ptpclient',
30         'qos_meter', 'qos_sched',
31         'quota_watermark', 'rxtx_callbacks',
32         'server_node_efd', 'service_cores',
33         'skeleton', 'tep_termination',
34         'timer', 'vdpa',
35         'vhost', 'vhost_crypto',
36         'vhost_scsi', 'vm_power_manager',
37         'vmdq', 'vmdq_dcb',
38 ]
39 # install all example code on install - irrespective of whether the example in
40 # question is to be built as part of this build or not.
41 foreach ex:all_examples
42         install_subdir(ex,
43                         install_dir: get_option('datadir') + '/dpdk/examples',
44                         exclude_files: 'meson.build')
45 endforeach
46
47 if get_option('examples') == ''
48         subdir_done()
49 endif
50
51 if get_option('examples').to_lower() == 'all'
52         examples = all_examples
53         allow_skips = true # don't flag an error if we can't build an app
54 else
55         examples = get_option('examples').split(',')
56         allow_skips = false # error out if we can't build a requested app
57 endif
58 default_cflags = machine_args
59 if cc.has_argument('-Wno-format-truncation')
60         default_cflags += '-Wno-format-truncation'
61 endif
62
63 # specify -D_GNU_SOURCE unconditionally
64 default_cflags += '-D_GNU_SOURCE'
65
66 foreach example: examples
67         name = example
68         build = true
69         sources = []
70         allow_experimental_apis = false
71         cflags = default_cflags
72
73         ext_deps = [execinfo]
74         includes = [include_directories(example)]
75         deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
76         if is_windows
77                 deps = ['eal'] # only supported lib on Windows currently
78         endif
79         subdir(example)
80
81         if build
82                 dep_objs = ext_deps
83                 foreach d:deps
84                         var_name = get_option('default_library') + '_rte_' + d
85                         if not is_variable(var_name)
86                                 error('Missing dependency "@0@" for example "@1@"'.format(d, name))
87                         endif
88                         dep_objs += [get_variable(var_name)]
89                 endforeach
90                 if allow_experimental_apis
91                         cflags += '-DALLOW_EXPERIMENTAL_API'
92                 endif
93                 executable('dpdk-' + name, sources,
94                         include_directories: includes,
95                         link_whole: driver_libs,
96                         link_args: dpdk_extra_ldflags,
97                         c_args: cflags,
98                         dependencies: dep_objs)
99         elif not allow_skips
100                 error('Cannot build requested example "' + name + '"')
101         else
102                 message('Skipping example "' + name + '"')
103         endif
104 endforeach