build: change default driver installation 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: '18.11.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 driver_install_path = join_paths(get_option('libdir'), 'dpdk',
26         'pmds-' + major_version)
27 eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
28
29 # configure the build, and make sure configs here and in config folder are
30 # able to be included in any file. We also store a global array of include dirs
31 # for passing to pmdinfogen scripts
32 global_inc = include_directories('.', 'config')
33 subdir('config')
34
35 # build libs and drivers
36 subdir('lib')
37 subdir('buildtools')
38 subdir('drivers')
39
40 # build binaries and installable tools
41 subdir('usertools')
42 subdir('app')
43 subdir('test')
44
45 # build docs
46 subdir('doc')
47
48 # build any examples explicitly requested - useful for developers
49 if get_option('examples') != ''
50         subdir('examples')
51 endif
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 # driver .so files often depend upon the bus drivers for their connect bus,
70 # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
71 # to be in the library path, so symlink the drivers from the main lib directory.
72 meson.add_install_script('buildtools/symlink-drivers-solibs.sh',
73                 driver_install_path,
74                 get_option('libdir'))
75
76 pkg = import('pkgconfig')
77 pkg.generate(name: meson.project_name(),
78         filebase: 'lib' + meson.project_name().to_lower(),
79         version: meson.project_version(),
80         libraries: dpdk_libraries,
81         libraries_private: dpdk_drivers + dpdk_libraries +
82                         ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
83         description: 'The Data Plane Development Kit (DPDK)',
84         subdirs: [get_option('include_subdir_arch'), '.'],
85         extra_cflags: ['-include', 'rte_config.h'] + machine_args
86 )
87
88 # final output, list all the libs and drivers to be built
89 # this does not affect any part of the build, for information only.
90 output_message = '\n=================\nLibraries Enabled\n=================\n'
91 output_message += '\nlibs:\n\t'
92 output_count = 0
93 foreach lib:enabled_libs
94         output_message += lib + ', '
95         output_count += 1
96         if output_count == 8
97                 output_message += '\n\t'
98                 output_count = 0
99         endif
100 endforeach
101 message(output_message + '\n')
102
103
104 # prior to 0.47 set_variable didn't work with arrays, so we can't
105 # track driver lists easily
106 if meson.version().version_compare('>=0.47')
107         output_message = '\n===============\nDrivers Enabled\n===============\n'
108         foreach class:driver_classes
109                 class_drivers = get_variable(class + '_drivers')
110                 output_message += '\n' + class + ':\n\t'
111                 output_count = 0
112                 foreach drv:class_drivers
113                         output_message += drv + ', '
114                         output_count += 1
115                         if output_count == 8
116                                 output_message += '\n\t'
117                                 output_count = 0
118                         endif
119                 endforeach
120         endforeach
121         message(output_message + '\n')
122 endif