3 # Copyright(c) 2017 Intel Corporation.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in
14 # the documentation and/or other materials provided with the
16 # * Neither the name of Intel Corporation nor the names of its
17 # contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 default_options: ['buildtype=release', 'default_library=static'],
36 meson_version: '>= 0.41'
39 # set up some global vars for compiler, platform, configuration, etc.
40 cc = meson.get_compiler('c')
41 dpdk_conf = configuration_data()
44 dpdk_extra_ldflags = []
46 driver_install_path = join_paths(get_option('libdir'), 'dpdk/drivers')
47 eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
49 # configure the build, and make sure configs here and in config folder are
50 # able to be included in any file. We also store a global array of include dirs
51 # for passing to pmdinfogen scripts
52 global_inc = include_directories('.', 'config')
55 # build libs and drivers
60 # build binaries and installable tools
64 # build any examples explicitly requested - useful for developers
65 if get_option('examples') != ''
69 # write the build config
70 build_cfg = 'rte_build_config.h'
71 configure_file(output: build_cfg,
72 configuration: dpdk_conf,
73 install_dir: join_paths(get_option('includedir'),
74 get_option('include_subdir_arch')))
76 # for static builds, include the drivers as libs and we need to "whole-archive"
78 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
80 # driver .so files often depend upon the bus drivers for their connect bus,
81 # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
82 # to be in the library path, so symlink the drivers from the main lib directory.
83 meson.add_install_script('buildtools/symlink-drivers-solibs.sh',
87 pkg = import('pkgconfig')
88 pkg.generate(name: meson.project_name(),
89 filebase: 'lib' + meson.project_name().to_lower(),
90 version: meson.project_version(),
91 libraries: dpdk_libraries,
92 libraries_private: dpdk_drivers + dpdk_libraries +
93 ['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
94 description: 'The Data Plane Development Kit (DPDK)',
95 subdirs: [get_option('include_subdir_arch'), '.'],
96 extra_cflags: ['-include', 'rte_config.h', '-march=@0@'.format(machine)]