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