app: generalize meson build
[dpdk.git] / app / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
3
4 apps = ['test-eventdev',
5         'test-pmd']
6
7 # for BSD only
8 lib_execinfo = cc.find_library('execinfo', required: false)
9
10 foreach app:apps
11         build = true
12         name = app
13         allow_experimental_apis = false
14         sources = []
15         includes = []
16         cflags = machine_args
17         objs = [] # other object files to link against, used e.g. for
18                   # instruction-set optimized versions of code
19
20         # use "deps" for internal DPDK dependencies, and "ext_deps" for
21         # external package/library requirements
22         ext_deps = []
23         deps = []
24
25         subdir(name)
26
27         if build
28                 dep_objs = []
29                 foreach d:deps
30                         dep_objs += get_variable(get_option('default_library')
31                                  + '_rte_' + d)
32                 endforeach
33                 dep_objs += lib_execinfo
34
35                 link_libs = []
36                 if get_option('default_library') == 'static'
37                         link_libs = dpdk_drivers
38                 endif
39
40                 if allow_experimental_apis
41                         cflags += '-DALLOW_EXPERIMENTAL_API'
42                 endif
43
44                 executable('dpdk-' + name,
45                                 sources,
46                                 c_args: cflags,
47                                 link_whole: link_libs,
48                                 dependencies: dep_objs,
49                                 install_rpath: join_paths(get_option('prefix'),
50                                                  driver_install_path),
51                                 install: true)
52         endif
53 endforeach