3d97e96f384cdb0fee8ad7024f02da6d99b168c3
[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'), check: true).stdout().strip(),
9         license: 'BSD',
10         default_options: [
11             'buildtype=release',
12             'default_library=static',
13             'warning_level=2',
14         ],
15         meson_version: '>= 0.49.2'
16 )
17
18 # check for developer mode
19 developer_mode = false
20 if get_option('developer_mode').auto()
21     if meson.version().version_compare('>=0.53') # fs module available
22         fs = import('fs')
23         developer_mode = fs.is_dir('.git')
24     endif
25 else
26     developer_mode = get_option('developer_mode').enabled()
27 endif
28 if developer_mode
29     message('## Building in Developer Mode ##')
30 endif
31
32 # set up some global vars for compiler, platform, configuration, etc.
33 cc = meson.get_compiler('c')
34 dpdk_conf = configuration_data()
35 dpdk_libraries = []
36 dpdk_static_libraries = []
37 dpdk_chkinc_headers = []
38 dpdk_driver_classes = []
39 dpdk_drivers = []
40 dpdk_extra_ldflags = []
41 dpdk_libs_disabled = []
42 dpdk_drvs_disabled = []
43 abi_version_file = files('ABI_VERSION')
44
45 if host_machine.cpu_family().startswith('x86')
46     arch_subdir = 'x86'
47 elif host_machine.cpu_family().startswith('arm') or host_machine.cpu_family().startswith('aarch')
48     arch_subdir = 'arm'
49 elif host_machine.cpu_family().startswith('ppc')
50     arch_subdir = 'ppc'
51 endif
52
53 # configure the build, and make sure configs here and in config folder are
54 # able to be included in any file. We also store a global array of include dirs
55 # for passing to pmdinfogen scripts
56 global_inc = include_directories('.', 'config',
57     'lib/eal/include',
58     'lib/eal/@0@/include'.format(host_machine.system()),
59     'lib/eal/@0@/include'.format(arch_subdir),
60 )
61
62 # do configuration and get tool paths
63 subdir('buildtools')
64 subdir('config')
65
66 # build libs and drivers
67 subdir('lib')
68 subdir('drivers')
69
70 # build binaries and installable tools
71 subdir('usertools')
72 subdir('app')
73
74 # build docs
75 subdir('doc')
76
77 # build any examples explicitly requested - useful for developers - and
78 # install any example code into the appropriate install path
79 subdir('examples')
80 install_subdir('examples',
81         install_dir: get_option('datadir') + '/dpdk',
82         exclude_files: ex_file_excludes)
83
84 # build kernel modules if enabled
85 if get_option('enable_kmods')
86     subdir('kernel')
87 endif
88
89 # check header includes if requested
90 if get_option('check_includes')
91     subdir('buildtools/chkincs')
92 endif
93
94 # write the build config
95 build_cfg = 'rte_build_config.h'
96 configure_file(output: build_cfg,
97         configuration: dpdk_conf,
98         install_dir: join_paths(get_option('includedir'),
99             get_option('include_subdir_arch')))
100
101 # build pkg-config files for dpdk
102 subdir('buildtools/pkg-config')
103
104 # final output, list all the libs and drivers to be built
105 # this does not affect any part of the build, for information only.
106 output_message = '\n=================\nLibraries Enabled\n=================\n'
107 output_message += '\nlibs:\n\t'
108 output_count = 0
109 foreach lib:enabled_libs
110     output_message += lib + ', '
111     output_count += 1
112     if output_count == 8
113         output_message += '\n\t'
114         output_count = 0
115     endif
116 endforeach
117 message(output_message + '\n')
118
119 output_message = '\n===============\nDrivers Enabled\n===============\n'
120 foreach class:dpdk_driver_classes
121     class_drivers = get_variable(class + '_drivers')
122     output_message += '\n' + class + ':\n\t'
123     output_count = 0
124     foreach drv:class_drivers
125         output_message += drv + ', '
126         output_count += 1
127         if output_count == 8
128             output_message += '\n\t'
129             output_count = 0
130         endif
131     endforeach
132 endforeach
133 message(output_message + '\n')
134
135 output_message = '\n=================\nContent Skipped\n=================\n'
136 output_message += '\nlibs:\n\t'
137 foreach lib:dpdk_libs_disabled
138     reason = get_variable(lib.underscorify() + '_disable_reason')
139     output_message += lib + ':\t' + reason + '\n\t'
140 endforeach
141 output_message += '\ndrivers:\n\t'
142 foreach drv:dpdk_drvs_disabled
143     reason = get_variable(drv.underscorify() + '_disable_reason')
144     output_message += drv + ':\t' + reason + '\n\t'
145 endforeach
146 message(output_message + '\n')