1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017-2019 Intel Corporation
5 # process all libraries equally, as far as possible
6 # "core" libs first, then others alphebetically as far as possible
7 # NOTE: for speed of meson runs, the dependencies in the subdirectories
8 # sometimes skip deps that would be implied by others, e.g. if mempool is
9 # given as a dep, no need to mention ring. This is especially true for the
10 # core libs which are widely reused, so their deps are kept to a minimum.
12 'kvargs', # eal depends on kvargs
13 'eal', # everything depends on eal
14 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
16 'metrics', # bitrate/latency stats depends on this
17 'hash', # efd depends on this
18 'timer', # eventdev depends on this
19 'acl', 'bbdev', 'bitratestats', 'cfgfile',
20 'compressdev', 'cryptodev',
21 'distributor', 'efd', 'eventdev',
22 'gro', 'gso', 'ip_frag', 'jobstats',
23 'kni', 'latencystats', 'lpm', 'member',
24 'power', 'pdump', 'rawdev',
25 'rcu', 'rib', 'reorder', 'sched', 'security', 'stack', 'vhost',
26 # ipsec lib depends on net, crypto and security
28 #fib lib depends on rib
30 # add pkt framework libs which use other libs from above
31 'port', 'table', 'pipeline',
32 # flow_classify lib depends on pkt framework table lib
33 'flow_classify', 'bpf', 'telemetry']
36 libraries = ['kvargs','eal'] # only supported libraries for windows
39 default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
40 if cc.has_argument('-Wno-format-truncation')
41 default_cflags += '-Wno-format-truncation'
44 enabled_libs = [] # used to print summary at the end
48 reason = '<unknown reason>' # set if build == false to explain why
50 use_function_versioning = false
54 cflags = default_cflags
55 objs = [] # other object files to link against, used e.g. for
56 # instruction-set optimized versions of code
58 # use "deps" for internal DPDK dependencies, and "ext_deps" for
59 # external package/library requirements
62 # eal is standard dependency once built
63 if dpdk_conf.has('RTE_LIBRTE_EAL')
67 dir_name = 'librte_' + l
71 shared_deps = ext_deps
72 static_deps = ext_deps
74 if not is_variable('shared_rte_' + d)
75 error('Missing internal dependency "@0@" for @1@ [@2@]'
76 .format(d, name, 'lib/' + dir_name))
78 shared_deps += [get_variable('shared_rte_' + d)]
79 static_deps += [get_variable('static_rte_' + d)]
84 dpdk_libs_disabled += name
85 set_variable(name.underscorify() + '_disable_reason', reason)
88 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
89 install_headers(headers)
91 libname = 'rte_' + name
92 includes += include_directories(dir_name)
94 if sources.length() == 0
95 # if no C files, just set a dependency on header path
96 shared_dep = declare_dependency(include_directories: includes)
97 static_dep = shared_dep
100 if use_function_versioning
101 cflags += '-DRTE_USE_FUNCTION_VERSIONING'
104 version_map = '@0@/@1@/rte_@2@_version.map'.format(
105 meson.current_source_dir(), dir_name, name)
107 is_experimental = run_command(is_experimental_cmd,
108 files(version_map)).returncode()
110 if is_experimental != 0
111 lib_version = experimental_abi_version
112 so_version = experimental_so_version
114 lib_version = abi_version
115 so_version = stable_so_version
118 # first build static lib
119 static_lib = static_library(libname,
123 dependencies: static_deps,
124 include_directories: includes,
126 static_dep = declare_dependency(link_with: static_lib,
127 include_directories: includes,
128 dependencies: static_deps)
130 if not use_function_versioning
131 # use pre-build objects to build shared lib
133 objs += static_lib.extract_all_objects(recursive: false)
135 # for compat we need to rebuild with
136 # RTE_BUILD_SHARED_LIB defined
137 cflags += '-DRTE_BUILD_SHARED_LIB'
139 version_map = '@0@/@1@/rte_@2@_version.map'.format(
140 meson.current_source_dir(), dir_name, name)
141 implib = dir_name + '.dll.a'
143 def_file = custom_target(name + '_def',
144 command: [map_to_def_cmd, '@INPUT@', '@OUTPUT@'],
146 output: 'rte_@0@_exports.def'.format(name))
149 lk_args = ['-Wl,/def:' + def_file.full_path(),
150 '-Wl,/implib:lib\\' + implib]
152 lk_args = ['-Wl,--version-script=' + version_map]
155 lk_deps = [version_map, def_file]
157 # on unix systems check the output of the
158 # experimental syms script, using it as a
159 # dependency of the .so build
160 lk_deps += custom_target(name + '.exp_chk',
161 command: [check_experimental_syms,
162 version_map, '@INPUT@'],
165 output: name + '.exp_chk')
168 shared_lib = shared_library(libname,
172 dependencies: shared_deps,
173 include_directories: includes,
175 link_depends: lk_deps,
176 version: lib_version,
177 soversion: so_version,
179 shared_dep = declare_dependency(link_with: shared_lib,
180 include_directories: includes,
181 dependencies: shared_deps)
183 dpdk_libraries = [shared_lib] + dpdk_libraries
184 dpdk_static_libraries = [static_lib] + dpdk_static_libraries
185 endif # sources.length() > 0
187 set_variable('shared_rte_' + name, shared_dep)
188 set_variable('static_rte_' + name, static_dep)
189 message('lib/@0@: Defining dependency "@1@"'.format(