test: move to app directory
[dpdk.git] / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
3
4 project('DPDK', 'C',
5         version: '19.05.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 # set the major version, which might be used by drivers and libraries
21 # depending on the configuration options
22 pver = meson.project_version().split('.')
23 major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
24
25 pmd_subdir_opt = get_option('drivers_install_subdir')
26 if pmd_subdir_opt.contains('<VERSION>')
27         pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
28 endif
29 driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
30 eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
31
32 # configure the build, and make sure configs here and in config folder are
33 # able to be included in any file. We also store a global array of include dirs
34 # for passing to pmdinfogen scripts
35 global_inc = include_directories('.', 'config', 'lib/librte_eal/common/include')
36 subdir('config')
37
38 # build libs and drivers
39 subdir('lib')
40 subdir('buildtools')
41 subdir('drivers')
42
43 # build binaries and installable tools
44 subdir('usertools')
45 subdir('app')
46
47 # build docs
48 subdir('doc')
49
50 # build any examples explicitly requested - useful for developers
51 if get_option('examples') != ''
52         subdir('examples')
53 endif
54
55 # build kernel modules if enabled
56 if get_option('enable_kmods')
57         subdir('kernel')
58 endif
59
60 # write the build config
61 build_cfg = 'rte_build_config.h'
62 configure_file(output: build_cfg,
63                 configuration: dpdk_conf,
64                 install_dir: join_paths(get_option('includedir'),
65                                 get_option('include_subdir_arch')))
66
67 # for static builds, include the drivers as libs and we need to "whole-archive"
68 # them.
69 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
70
71 # driver .so files often depend upon the bus drivers for their connect bus,
72 # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
73 # to be in the library path, so symlink the drivers from the main lib directory.
74 meson.add_install_script('buildtools/symlink-drivers-solibs.sh',
75                 driver_install_path,
76                 get_option('libdir'))
77
78 pkg = import('pkgconfig')
79 pkg.generate(name: meson.project_name(),
80         filebase: 'lib' + meson.project_name().to_lower(),
81         version: meson.project_version(),
82         libraries: dpdk_libraries,
83         libraries_private: dpdk_drivers + dpdk_static_libraries +
84                         ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
85         description: '''The Data Plane Development Kit (DPDK).
86 Note that CFLAGS might contain an -march flag higher than typical baseline.
87 This is required for a number of static inline functions in the public headers.''',
88         subdirs: [get_option('include_subdir_arch'), '.'],
89         extra_cflags: ['-include', 'rte_config.h'] + machine_args
90 )
91
92 # final output, list all the libs and drivers to be built
93 # this does not affect any part of the build, for information only.
94 output_message = '\n=================\nLibraries Enabled\n=================\n'
95 output_message += '\nlibs:\n\t'
96 output_count = 0
97 foreach lib:enabled_libs
98         output_message += lib + ', '
99         output_count += 1
100         if output_count == 8
101                 output_message += '\n\t'
102                 output_count = 0
103         endif
104 endforeach
105 message(output_message + '\n')
106
107
108 # prior to 0.47 set_variable didn't work with arrays, so we can't
109 # track driver lists easily
110 if meson.version().version_compare('>=0.47')
111         output_message = '\n===============\nDrivers Enabled\n===============\n'
112         foreach class:driver_classes
113                 class_drivers = get_variable(class + '_drivers')
114                 output_message += '\n' + class + ':\n\t'
115                 output_count = 0
116                 foreach drv:class_drivers
117                         output_message += drv + ', '
118                         output_count += 1
119                         if output_count == 8
120                                 output_message += '\n\t'
121                                 output_count = 0
122                         endif
123                 endforeach
124         endforeach
125         message(output_message + '\n')
126 endif