build/pkg-config: improve static linking flags
[dpdk.git] / app / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017-2019 Intel Corporation
3
4 if is_windows
5         subdir_done()
6 endif
7
8 apps = [
9         'pdump',
10         'proc-info',
11         'test-acl',
12         'test-bbdev',
13         'test-cmdline',
14         'test-compress-perf',
15         'test-crypto-perf',
16         'test-eventdev',
17         'test-fib',
18         'test-flow-perf',
19         'test-pipeline',
20         'test-pmd',
21         'test-sad']
22
23 # for BSD only
24 lib_execinfo = cc.find_library('execinfo', required: false)
25
26 default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
27
28 foreach app:apps
29         build = true
30         name = app
31         sources = []
32         includes = []
33         cflags = default_cflags
34         objs = [] # other object files to link against, used e.g. for
35                   # instruction-set optimized versions of code
36
37         # use "deps" for internal DPDK dependencies, and "ext_deps" for
38         # external package/library requirements
39         ext_deps = []
40         deps = []
41
42         subdir(name)
43
44         if build
45                 dep_objs = []
46                 foreach d:deps
47                         dep_objs += get_variable(get_option('default_library')
48                                  + '_rte_' + d)
49                 endforeach
50                 dep_objs += lib_execinfo
51
52                 link_libs = []
53                 if get_option('default_library') == 'static'
54                         link_libs = dpdk_static_libraries + dpdk_drivers
55                 endif
56
57                 executable('dpdk-' + name,
58                                 sources,
59                                 c_args: cflags,
60                                 link_whole: link_libs,
61                                 dependencies: dep_objs,
62                                 install_rpath: join_paths(get_option('prefix'),
63                                                  driver_install_path),
64                                 install: true)
65         endif
66 endforeach
67
68 # special case the autotests
69 subdir('test')