build: remove unnecessary variable
[dpdk.git] / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017-2019 Intel Corporation
3
4 project('DPDK', 'C',
5         # Get version number from file.
6         # Fallback to "more" for Windows compatibility.
7         version: run_command(find_program('cat', 'more'),
8                 files('VERSION')).stdout().strip(),
9         license: 'BSD',
10         default_options: ['buildtype=release', 'default_library=static'],
11         meson_version: '>= 0.47.1'
12 )
13
14 # set up some global vars for compiler, platform, configuration, etc.
15 cc = meson.get_compiler('c')
16 dpdk_conf = configuration_data()
17 dpdk_libraries = []
18 dpdk_static_libraries = []
19 dpdk_graph_nodes = []
20 dpdk_driver_classes = []
21 dpdk_drivers = []
22 dpdk_extra_ldflags = []
23 dpdk_libs_disabled = []
24 dpdk_drvs_disabled = []
25 abi_version_file = files('ABI_VERSION')
26
27 if host_machine.cpu_family().startswith('x86')
28         arch_subdir = 'x86'
29 elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
30         arch_subdir = 'arm'
31 elif host_machine.cpu_family().startswith('ppc')
32         arch_subdir = 'ppc'
33 endif
34
35 # configure the build, and make sure configs here and in config folder are
36 # able to be included in any file. We also store a global array of include dirs
37 # for passing to pmdinfogen scripts
38 global_inc = include_directories('.', 'config',
39         'lib/librte_eal/include',
40         'lib/librte_eal/@0@/include'.format(host_machine.system()),
41         'lib/librte_eal/@0@/include'.format(arch_subdir),
42 )
43 subdir('config')
44
45 # build libs and drivers
46 subdir('buildtools')
47 subdir('lib')
48 subdir('drivers')
49
50 # build binaries and installable tools
51 subdir('usertools')
52 subdir('app')
53
54 # build docs
55 subdir('doc')
56
57 # build any examples explicitly requested - useful for developers - and
58 # install any example code into the appropriate install path
59 subdir('examples')
60
61 # build kernel modules if enabled
62 if get_option('enable_kmods')
63         subdir('kernel')
64 endif
65
66 # write the build config
67 build_cfg = 'rte_build_config.h'
68 configure_file(output: build_cfg,
69                 configuration: dpdk_conf,
70                 install_dir: join_paths(get_option('includedir'),
71                                 get_option('include_subdir_arch')))
72
73 # for static builds, include the drivers as libs and we need to "whole-archive"
74 # them.
75 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
76
77 pkg = import('pkgconfig')
78 pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
79 if is_freebsd
80         pkg_extra_cflags += ['-D__BSD_VISIBLE']
81 endif
82 pkg.generate(name: meson.project_name(),
83         filebase: 'lib' + meson.project_name().to_lower(),
84         version: meson.project_version(),
85         libraries: dpdk_libraries,
86         libraries_private: dpdk_drivers + dpdk_static_libraries +
87                         ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
88         requires: libbsd, # apps using rte_string_fns.h may need this if enabled
89                           # if libbsd is not enabled, then this is blank
90         description: '''The Data Plane Development Kit (DPDK).
91 Note that CFLAGS might contain an -march flag higher than typical baseline.
92 This is required for a number of static inline functions in the public headers.''',
93         subdirs: [get_option('include_subdir_arch'), '.'],
94         extra_cflags: pkg_extra_cflags
95 )
96
97 # final output, list all the libs and drivers to be built
98 # this does not affect any part of the build, for information only.
99 output_message = '\n=================\nLibraries Enabled\n=================\n'
100 output_message += '\nlibs:\n\t'
101 output_count = 0
102 foreach lib:enabled_libs
103         output_message += lib + ', '
104         output_count += 1
105         if output_count == 8
106                 output_message += '\n\t'
107                 output_count = 0
108         endif
109 endforeach
110 message(output_message + '\n')
111
112 output_message = '\n===============\nDrivers Enabled\n===============\n'
113 foreach class:dpdk_driver_classes
114         class_drivers = get_variable(class + '_drivers')
115         output_message += '\n' + class + ':\n\t'
116         output_count = 0
117         foreach drv:class_drivers
118                 output_message += drv + ', '
119                 output_count += 1
120                 if output_count == 8
121                         output_message += '\n\t'
122                         output_count = 0
123                 endif
124         endforeach
125 endforeach
126 message(output_message + '\n')
127
128 output_message = '\n=================\nContent Skipped\n=================\n'
129 output_message += '\nlibs:\n\t'
130 foreach lib:dpdk_libs_disabled
131         reason = get_variable(lib.underscorify() + '_disable_reason')
132         output_message += lib + ':\t' + reason + '\n\t'
133 endforeach
134 output_message += '\ndrivers:\n\t'
135 foreach drv:dpdk_drvs_disabled
136         reason = get_variable(drv.underscorify() + '_disable_reason')
137         output_message += drv + ':\t' + reason + '\n\t'
138 endforeach
139 message(output_message + '\n')