build: add dependency on telemetry to apps with meson
[dpdk.git] / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
3
4 project('DPDK', 'C',
5         version: '18.11.0-rc0',
6         license: 'BSD',
7         default_options: ['buildtype=release', 'default_library=static'],
8         meson_version: '>= 0.41'
9 )
10
11 # set up some global vars for compiler, platform, configuration, etc.
12 cc = meson.get_compiler('c')
13 dpdk_conf = configuration_data()
14 dpdk_libraries = []
15 dpdk_static_libraries = []
16 dpdk_drivers = []
17 dpdk_extra_ldflags = []
18 dpdk_app_link_libraries = []
19
20 driver_install_path = join_paths(get_option('libdir'), 'dpdk/drivers')
21 eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
22
23 # configure the build, and make sure configs here and in config folder are
24 # able to be included in any file. We also store a global array of include dirs
25 # for passing to pmdinfogen scripts
26 global_inc = include_directories('.', 'config')
27 subdir('config')
28
29 # build libs and drivers
30 subdir('lib')
31 subdir('buildtools')
32 subdir('drivers')
33
34 # build binaries and installable tools
35 subdir('usertools')
36 subdir('app')
37 subdir('test')
38
39 # build docs
40 subdir('doc')
41
42 # build any examples explicitly requested - useful for developers
43 if get_option('examples') != ''
44         subdir('examples')
45 endif
46
47 # build kernel modules if enabled
48 if get_option('enable_kmods')
49         subdir('kernel')
50 endif
51
52 # write the build config
53 build_cfg = 'rte_build_config.h'
54 configure_file(output: build_cfg,
55                 configuration: dpdk_conf,
56                 install_dir: join_paths(get_option('includedir'),
57                                 get_option('include_subdir_arch')))
58
59 # for static builds, include the drivers as libs and we need to "whole-archive"
60 # them.
61 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
62
63 # driver .so files often depend upon the bus drivers for their connect bus,
64 # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
65 # to be in the library path, so symlink the drivers from the main lib directory.
66 meson.add_install_script('buildtools/symlink-drivers-solibs.sh',
67                 driver_install_path,
68                 get_option('libdir'))
69
70 pkg = import('pkgconfig')
71 pkg.generate(name: meson.project_name(),
72         filebase: 'lib' + meson.project_name().to_lower(),
73         version: meson.project_version(),
74         libraries: dpdk_libraries,
75         libraries_private: dpdk_drivers + dpdk_libraries +
76                         ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
77         description: 'The Data Plane Development Kit (DPDK)',
78         subdirs: [get_option('include_subdir_arch'), '.'],
79         extra_cflags: ['-include', 'rte_config.h'] + machine_args
80 )
81
82 # final output, list all the libs and drivers to be built
83 # this does not affect any part of the build, for information only.
84 output_message = '\n=================\nLibraries Enabled\n=================\n'
85 output_message += '\nlibs:\n\t'
86 output_count = 0
87 foreach lib:enabled_libs
88         output_message += lib + ', '
89         output_count += 1
90         if output_count == 8
91                 output_message += '\n\t'
92                 output_count = 0
93         endif
94 endforeach
95 message(output_message + '\n')
96
97
98 # prior to 0.47 set_variable didn't work with arrays, so we can't
99 # track driver lists easily
100 if meson.version().version_compare('>=0.47')
101         output_message = '\n===============\nDrivers Enabled\n===============\n'
102         foreach class:driver_classes
103                 class_drivers = get_variable(class + '_drivers')
104                 output_message += '\n' + class + ':\n\t'
105                 output_count = 0
106                 foreach drv:class_drivers
107                         output_message += drv + ', '
108                         output_count += 1
109                         if output_count == 8
110                                 output_message += '\n\t'
111                                 output_count = 0
112                         endif
113                 endforeach
114         endforeach
115         message(output_message + '\n')
116 endif