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.
32 driver_classes = ['bus', 'crypto', 'mempool']
34 foreach class:driver_classes
37 config_flag_fmt = '' # format string used to set the value in dpdk_conf
38 driver_name_fmt = '' # format string for driver name, used to name
39 # the library, the dependency and to find the
40 # version file for linking
45 drv_path = join_paths(class, drv)
47 # set up empty variables used for build
48 build = true # set to false to disable, e.g. missing deps
51 allow_experimental_apis = false
55 includes = [include_directories(drv_path)]
56 # set up internal deps. Drivers can append/override as necessary
58 # ext_deps: Stores external library dependency got
59 # using dependency() or cc.find_library(). For most cases, we
60 # probably also need to specify the "-l" flags in
61 # pkgconfig_extra_libs variable too, so that it can be reflected
62 # in the pkgconfig output for static builds
64 pkgconfig_extra_libs = []
66 # pull in driver directory which should assign to each of the above
70 dpdk_conf.set(config_flag_fmt.format(name.to_upper()),1)
72 if allow_experimental_apis
73 cflags += '-DALLOW_EXPERIMENTAL_API'
76 # get dependency objs from strings
79 dep_objs += [get_variable('dep_rte_' + d)]
82 dpdk_extra_ldflags += pkgconfig_extra_libs
84 # generate pmdinfo sources
85 pmdinfogen_srcs = run_command('grep', '--files-with-matches',
86 'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
87 foreach src: pmdinfogen_srcs
88 out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
89 tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
90 src, include_directories: includes,
91 dependencies: dep_objs,
93 sources += custom_target(out_filename,
94 command: [pmdinfo, tmp_lib.full_path(),
95 '@OUTPUT@', pmdinfogen],
97 depends: [pmdinfogen, tmp_lib])
100 # now build the driver itself, and add to the drivers list
101 lib_name = driver_name_fmt.format(name)
102 version_map = '@0@/@1@/@2@_version.map'.format(
103 meson.current_source_dir(),
105 lib = library(lib_name,
108 include_directories: includes,
109 dependencies: dep_objs,
111 link_args: '-Wl,--version-script=' + version_map,
112 link_depends: version_map,
113 version: '@0@.1'.format(version),
115 install_dir: driver_install_path)
119 # create a dependency object and add it to the global dictionary so
120 # testpmd or other built-in apps can find it if necessary
121 set_variable('dep_@0@'.format(lib_name),
122 declare_dependency(link_with: lib,
123 include_directories: includes,
124 dependencies: dep_objs))