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.
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
50 allow_experimental_apis = false
54 includes = [include_directories(drv_path)]
55 # set up internal deps. Drivers can append/override as necessary
57 # ext_deps: Stores external library dependency got
58 # using dependency() or cc.find_library(). For most cases, we
59 # probably also need to specify the "-l" flags in
60 # pkgconfig_extra_libs variable too, so that it can be reflected
61 # in the pkgconfig output for static builds
63 pkgconfig_extra_libs = []
65 # pull in driver directory which should assign to each of the above
69 dpdk_conf.set(config_flag_fmt.format(drv.to_upper()),1)
71 if allow_experimental_apis
72 cflags += '-DALLOW_EXPERIMENTAL_API'
75 # get dependency objs from strings
78 dep_objs += [get_variable('dep_rte_' + d)]
81 dpdk_extra_ldflags += pkgconfig_extra_libs
83 # generate pmdinfo sources
84 pmdinfogen_srcs = run_command('grep', '--files-with-matches',
85 'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
86 foreach src: pmdinfogen_srcs
87 out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
88 tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
89 src, include_directories: includes,
90 dependencies: dep_objs,
92 sources += custom_target(out_filename,
93 command: [pmdinfo, tmp_lib.full_path(),
94 '@OUTPUT@', pmdinfogen],
96 depends: [pmdinfogen, tmp_lib])
99 # now build the driver itself, and add to the drivers list
100 drv_name = driver_name_fmt.format(drv)
101 version_map = '@0@/@1@/@2@_version.map'.format(
102 meson.current_source_dir(),
104 lib = library(drv_name,
107 include_directories: includes,
108 dependencies: dep_objs,
110 link_args: '-Wl,--version-script=' + version_map,
111 link_depends: version_map,
112 version: '@0@.1'.format(version),
114 install_dir: driver_install_path)
118 # create a dependency object and add it to the global dictionary so
119 # testpmd or other built-in apps can find it if necessary
120 set_variable('dep_@0@'.format(drv_name),
121 declare_dependency(link_with: lib,
122 include_directories: includes,
123 dependencies: dep_objs))