build: replace license text with SPDX tag
[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.02.0',
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_drivers = []
16 dpdk_extra_ldflags = []
17
18 driver_install_path = join_paths(get_option('libdir'), 'dpdk/drivers')
19 eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
20
21 # configure the build, and make sure configs here and in config folder are
22 # able to be included in any file. We also store a global array of include dirs
23 # for passing to pmdinfogen scripts
24 global_inc = include_directories('.', 'config')
25 subdir('config')
26
27 # build libs and drivers
28 subdir('lib')
29 subdir('buildtools')
30 subdir('drivers')
31
32 # build binaries and installable tools
33 subdir('usertools')
34 subdir('app')
35
36 # build any examples explicitly requested - useful for developers
37 if get_option('examples') != ''
38         subdir('examples')
39 endif
40
41 # write the build config
42 build_cfg = 'rte_build_config.h'
43 configure_file(output: build_cfg,
44                 configuration: dpdk_conf,
45                 install_dir: join_paths(get_option('includedir'),
46                                 get_option('include_subdir_arch')))
47
48 # for static builds, include the drivers as libs and we need to "whole-archive"
49 # them.
50 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
51
52 # driver .so files often depend upon the bus drivers for their connect bus,
53 # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
54 # to be in the library path, so symlink the drivers from the main lib directory.
55 meson.add_install_script('buildtools/symlink-drivers-solibs.sh',
56                 driver_install_path,
57                 get_option('libdir'))
58
59 pkg = import('pkgconfig')
60 pkg.generate(name: meson.project_name(),
61         filebase: 'lib' + meson.project_name().to_lower(),
62         version: meson.project_version(),
63         libraries: dpdk_libraries,
64         libraries_private: dpdk_drivers + dpdk_libraries +
65                         ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
66         description: 'The Data Plane Development Kit (DPDK)',
67         subdirs: [get_option('include_subdir_arch'), '.'],
68         extra_cflags: ['-include', 'rte_config.h', '-march=@0@'.format(machine)]
69 )