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
24 'metrics', # bitrate/latency stats depends on this
25 'hash', # efd depends on this
26 'timer', # eventdev depends on this
54 'ipsec', # ipsec lib depends on net, crypto and security
55 'fib', #fib lib depends on rib
56 'port', # pkt framework libs which use other libs from above
59 'flow_classify', # flow_classify lib depends on pkt framework table lib
81 ] # only supported libraries for windows
84 default_cflags = machine_args
85 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
86 default_cflags += ['-DALLOW_INTERNAL_API']
88 if cc.has_argument('-Wno-format-truncation')
89 default_cflags += '-Wno-format-truncation'
92 enabled_libs = [] # used to print summary at the end
96 reason = '<unknown reason>' # set if build == false to explain why
98 use_function_versioning = false
101 indirect_headers = [] # public headers not directly included by apps
102 driver_sdk_headers = [] # public headers included by drivers
104 cflags = default_cflags
105 objs = [] # other object files to link against, used e.g. for
106 # instruction-set optimized versions of code
108 # use "deps" for internal DPDK dependencies, and "ext_deps" for
109 # external package/library requirements
112 # eal is standard dependency once built
113 if dpdk_conf.has('RTE_LIB_EAL')
117 dir_name = 'librte_' + l
121 dpdk_libs_disabled += name
122 set_variable(name.underscorify() + '_disable_reason', reason)
126 shared_deps = ext_deps
127 static_deps = ext_deps
129 if not is_variable('shared_rte_' + d)
130 error('Missing internal dependency "@0@" for @1@ [@2@]'
131 .format(d, name, 'lib/' + dir_name))
133 shared_deps += [get_variable('shared_rte_' + d)]
134 static_deps += [get_variable('static_rte_' + d)]
138 dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1)
139 install_headers(headers)
140 install_headers(indirect_headers)
141 if get_option('enable_driver_sdk')
142 install_headers(driver_sdk_headers)
144 dpdk_chkinc_headers += headers
146 libname = 'rte_' + name
147 includes += include_directories(dir_name)
149 if is_windows and use_function_versioning
150 message('@0@: Function versioning is not supported by Windows.'.format(name))
153 if use_function_versioning
154 cflags += '-DRTE_USE_FUNCTION_VERSIONING'
157 # first build static lib
158 static_lib = static_library(libname,
162 dependencies: static_deps,
163 include_directories: includes,
165 static_dep = declare_dependency(
166 include_directories: includes,
167 dependencies: static_deps)
169 if not use_function_versioning or is_windows
170 # use pre-build objects to build shared lib
172 objs += static_lib.extract_all_objects(recursive: false)
174 # for compat we need to rebuild with
175 # RTE_BUILD_SHARED_LIB defined
176 cflags += '-DRTE_BUILD_SHARED_LIB'
178 version_map = '@0@/@1@/version.map'.format(
179 meson.current_source_dir(), dir_name)
180 implib = dir_name + '.dll.a'
182 def_file = custom_target(libname + '_def',
183 command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
185 output: '@0@_exports.def'.format(libname))
187 mingw_map = custom_target(libname + '_mingw',
188 command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
190 output: '@0@_mingw.map'.format(libname))
193 lk_args = ['-Wl,/def:' + def_file.full_path()]
194 if meson.version().version_compare('<0.54.0')
195 lk_args += ['-Wl,/implib:lib\\' + implib]
199 lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
201 lk_args = ['-Wl,--version-script=' + version_map]
205 lk_deps = [version_map, def_file, mingw_map]
207 # on unix systems check the output of the
208 # check-symbols.sh script, using it as a
209 # dependency of the .so build
210 lk_deps += custom_target(name + '.sym_chk',
211 command: [check_symbols,
212 version_map, '@INPUT@'],
215 output: name + '.sym_chk')
218 shared_lib = shared_library(libname,
222 dependencies: shared_deps,
223 include_directories: includes,
225 link_depends: lk_deps,
226 version: abi_version,
227 soversion: so_version,
229 shared_dep = declare_dependency(link_with: shared_lib,
230 include_directories: includes,
231 dependencies: shared_deps)
233 dpdk_libraries = [shared_lib] + dpdk_libraries
234 dpdk_static_libraries = [static_lib] + dpdk_static_libraries
236 set_variable('shared_rte_' + name, shared_dep)
237 set_variable('static_rte_' + name, static_dep)
239 message('lib/@0@: Defining dependency "@1@"'.format(dir_name, name))