examples/ipsec-secgw: fix bypass rule processing
[dpdk.git] / examples / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 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 allow_skips = true # don't flag an error if we can't build an app
12
13 if get_option('examples').to_lower() == 'all'
14         dirs = run_command('sh', '-c',
15                 'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done')
16         examples = dirs.stdout().split()
17 else
18         examples = get_option('examples').split(',')
19         allow_skips = false # error out if we can't build a requested app
20 endif
21 foreach example: examples
22         name = example
23         build = true
24         sources = []
25         allow_experimental_apis = false
26         cflags = machine_args
27         if cc.has_argument('-Wno-format-truncation')
28                 cflags += '-Wno-format-truncation'
29         endif
30
31         ext_deps = [execinfo]
32         includes = [include_directories(example)]
33         deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
34         subdir(example)
35
36         if build
37                 dep_objs = ext_deps
38                 foreach d:deps
39                         var_name = get_option('default_library') + '_rte_' + d
40                         if not is_variable(var_name)
41                                 error('Missing dependency "@0@" for example "@1@"'.format(d, name))
42                         endif
43                         dep_objs += [get_variable(var_name)]
44                 endforeach
45                 if allow_experimental_apis
46                         cflags += '-DALLOW_EXPERIMENTAL_API'
47                 endif
48                 executable('dpdk-' + name, sources,
49                         include_directories: includes,
50                         link_whole: driver_libs,
51                         link_args: dpdk_extra_ldflags,
52                         c_args: cflags,
53                         dependencies: dep_objs)
54         elif not allow_skips
55                 error('Cannot build requested example "' + name + '"')
56         else
57                 message('Skipping example "' + name + '"')
58         endif
59 endforeach