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