kvargs: fix invalid token parsing on FreeBSD
[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_app_link_libraries = []
24 dpdk_libs_disabled = []
25 dpdk_drvs_disabled = []
26 abi_version_file = files('ABI_VERSION')
27
28 # configure the build, and make sure configs here and in config folder are
29 # able to be included in any file. We also store a global array of include dirs
30 # for passing to pmdinfogen scripts
31 global_inc = include_directories('.', 'config',
32         'lib/librte_eal/include',
33         'lib/librte_eal/@0@/include'.format(host_machine.system()),
34 )
35 subdir('config')
36
37 # build libs and drivers
38 subdir('buildtools')
39 subdir('lib')
40 subdir('drivers')
41
42 # build binaries and installable tools
43 subdir('usertools')
44 subdir('app')
45
46 # build docs
47 subdir('doc')
48
49 # build any examples explicitly requested - useful for developers - and
50 # install any example code into the appropriate install path
51 subdir('examples')
52
53 # build kernel modules if enabled
54 if get_option('enable_kmods')
55         subdir('kernel')
56 endif
57
58 # write the build config
59 build_cfg = 'rte_build_config.h'
60 configure_file(output: build_cfg,
61                 configuration: dpdk_conf,
62                 install_dir: join_paths(get_option('includedir'),
63                                 get_option('include_subdir_arch')))
64
65 # for static builds, include the drivers as libs and we need to "whole-archive"
66 # them.
67 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
68
69 pkg = import('pkgconfig')
70 pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
71 if is_freebsd
72         pkg_extra_cflags += ['-D__BSD_VISIBLE']
73 endif
74 pkg.generate(name: meson.project_name(),
75         filebase: 'lib' + meson.project_name().to_lower(),
76         version: meson.project_version(),
77         libraries: dpdk_libraries,
78         libraries_private: dpdk_drivers + dpdk_static_libraries +
79                         ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
80         requires: libbsd, # apps using rte_string_fns.h may need this if enabled
81                           # if libbsd is not enabled, then this is blank
82         description: '''The Data Plane Development Kit (DPDK).
83 Note that CFLAGS might contain an -march flag higher than typical baseline.
84 This is required for a number of static inline functions in the public headers.''',
85         subdirs: [get_option('include_subdir_arch'), '.'],
86         extra_cflags: pkg_extra_cflags
87 )
88
89 # final output, list all the libs and drivers to be built
90 # this does not affect any part of the build, for information only.
91 output_message = '\n=================\nLibraries Enabled\n=================\n'
92 output_message += '\nlibs:\n\t'
93 output_count = 0
94 foreach lib:enabled_libs
95         output_message += lib + ', '
96         output_count += 1
97         if output_count == 8
98                 output_message += '\n\t'
99                 output_count = 0
100         endif
101 endforeach
102 message(output_message + '\n')
103
104 output_message = '\n===============\nDrivers Enabled\n===============\n'
105 foreach class:dpdk_driver_classes
106         class_drivers = get_variable(class + '_drivers')
107         output_message += '\n' + class + ':\n\t'
108         output_count = 0
109         foreach drv:class_drivers
110                 output_message += drv + ', '
111                 output_count += 1
112                 if output_count == 8
113                         output_message += '\n\t'
114                         output_count = 0
115                 endif
116         endforeach
117 endforeach
118 message(output_message + '\n')
119
120 output_message = '\n=================\nContent Skipped\n=================\n'
121 output_message += '\nlibs:\n\t'
122 foreach lib:dpdk_libs_disabled
123         reason = get_variable(lib.underscorify() + '_disable_reason')
124         output_message += lib + ':\t' + reason + '\n\t'
125 endforeach
126 output_message += '\ndrivers:\n\t'
127 foreach drv:dpdk_drvs_disabled
128         reason = get_variable(drv.underscorify() + '_disable_reason')
129         output_message += drv + ':\t' + reason + '\n\t'
130 endforeach
131 message(output_message + '\n')