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 'telemetry', # basic info querying
14 'eal', # everything depends on eal
16 'rcu', # rcu depends on ring
17 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
19 'metrics', # bitrate/latency stats depends on this
20 'hash', # efd depends on this
21 'timer', # eventdev depends on this
22 'acl', 'bbdev', 'bitratestats', 'cfgfile',
23 'compressdev', 'cryptodev',
24 'distributor', 'efd', 'eventdev',
25 'gro', 'gso', 'ip_frag', 'jobstats',
26 'kni', 'latencystats', 'lpm', 'member',
27 'power', 'pdump', 'rawdev', 'regexdev',
28 'rib', 'reorder', 'sched', 'security', 'stack', 'vhost',
29 # ipsec lib depends on net, crypto and security
31 #fib lib depends on rib
33 # add pkt framework libs which use other libs from above
34 'port', 'table', 'pipeline',
35 # flow_classify lib depends on pkt framework table lib
36 'flow_classify', 'bpf', 'graph', 'node']
45 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci',
49 ] # only supported libraries for windows
52 default_cflags = machine_args
53 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
54 default_cflags += ['-DALLOW_INTERNAL_API']
56 if cc.has_argument('-Wno-format-truncation')
57 default_cflags += '-Wno-format-truncation'
60 enabled_libs = [] # used to print summary at the end
64 reason = '<unknown reason>' # set if build == false to explain why
66 use_function_versioning = false
69 indirect_headers = [] # public headers not directly included by apps
71 cflags = default_cflags
72 objs = [] # other object files to link against, used e.g. for
73 # instruction-set optimized versions of code
75 # use "deps" for internal DPDK dependencies, and "ext_deps" for
76 # external package/library requirements
79 # eal is standard dependency once built
80 if dpdk_conf.has('RTE_LIB_EAL')
84 dir_name = 'librte_' + l
88 shared_deps = ext_deps
89 static_deps = ext_deps
91 if not is_variable('shared_rte_' + d)
92 error('Missing internal dependency "@0@" for @1@ [@2@]'
93 .format(d, name, 'lib/' + dir_name))
95 shared_deps += [get_variable('shared_rte_' + d)]
96 static_deps += [get_variable('static_rte_' + d)]
101 dpdk_libs_disabled += name
102 set_variable(name.underscorify() + '_disable_reason', reason)
105 dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1)
106 install_headers(headers)
107 install_headers(indirect_headers)
108 dpdk_chkinc_headers += headers
110 libname = 'rte_' + name
111 includes += include_directories(dir_name)
113 if sources.length() == 0
114 # if no C files, just set a dependency on header path
115 shared_dep = declare_dependency(include_directories: includes)
116 static_dep = shared_dep
118 if is_windows and use_function_versioning
119 message('@0@: Function versioning is not supported by Windows.'
123 if use_function_versioning
124 cflags += '-DRTE_USE_FUNCTION_VERSIONING'
127 # first build static lib
128 static_lib = static_library(libname,
132 dependencies: static_deps,
133 include_directories: includes,
135 static_dep = declare_dependency(
136 include_directories: includes,
137 dependencies: static_deps)
139 if not use_function_versioning or is_windows
140 # use pre-build objects to build shared lib
142 objs += static_lib.extract_all_objects(recursive: false)
144 # for compat we need to rebuild with
145 # RTE_BUILD_SHARED_LIB defined
146 cflags += '-DRTE_BUILD_SHARED_LIB'
148 version_map = '@0@/@1@/version.map'.format(
149 meson.current_source_dir(), dir_name)
150 implib = dir_name + '.dll.a'
152 def_file = custom_target(libname + '_def',
153 command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
155 output: '@0@_exports.def'.format(libname))
157 mingw_map = custom_target(libname + '_mingw',
158 command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
160 output: '@0@_mingw.map'.format(libname))
163 lk_args = ['-Wl,/def:' + def_file.full_path()]
164 if meson.version().version_compare('<0.54.0')
165 lk_args += ['-Wl,/implib:lib\\' + implib]
169 lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
171 lk_args = ['-Wl,--version-script=' + version_map]
175 lk_deps = [version_map, def_file, mingw_map]
177 # on unix systems check the output of the
178 # check-symbols.sh script, using it as a
179 # dependency of the .so build
180 lk_deps += custom_target(name + '.sym_chk',
181 command: [check_symbols,
182 version_map, '@INPUT@'],
185 output: name + '.sym_chk')
188 shared_lib = shared_library(libname,
192 dependencies: shared_deps,
193 include_directories: includes,
195 link_depends: lk_deps,
196 version: abi_version,
197 soversion: so_version,
199 shared_dep = declare_dependency(link_with: shared_lib,
200 include_directories: includes,
201 dependencies: shared_deps)
203 dpdk_libraries = [shared_lib] + dpdk_libraries
204 dpdk_static_libraries = [static_lib] + dpdk_static_libraries
205 endif # sources.length() > 0
207 set_variable('shared_rte_' + name, shared_dep)
208 set_variable('static_rte_' + name, static_dep)
209 message('lib/@0@: Defining dependency "@1@"'.format(