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
15 'rcu', # rcu depends on ring
16 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
18 'metrics', # bitrate/latency stats depends on this
19 'hash', # efd depends on this
20 'timer', # eventdev depends on this
21 'acl', 'bbdev', 'bitratestats', 'cfgfile',
22 'compressdev', 'cryptodev',
23 'distributor', 'efd', 'eventdev',
24 'gro', 'gso', 'ip_frag', 'jobstats',
25 'kni', 'latencystats', 'lpm', 'member',
26 'power', 'pdump', 'rawdev',
27 'rib', 'reorder', 'sched', 'security', 'stack', 'vhost',
28 # ipsec lib depends on net, crypto and security
30 #fib lib depends on rib
32 # add pkt framework libs which use other libs from above
33 'port', 'table', 'pipeline',
34 # flow_classify lib depends on pkt framework table lib
35 'flow_classify', 'bpf', 'graph', 'node', 'telemetry']
38 libraries = ['kvargs','eal'] # only supported libraries for windows
41 default_cflags = machine_args
42 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
43 default_cflags += ['-DALLOW_INTERNAL_API']
45 if cc.has_argument('-Wno-format-truncation')
46 default_cflags += '-Wno-format-truncation'
49 enabled_libs = [] # used to print summary at the end
53 reason = '<unknown reason>' # set if build == false to explain why
55 use_function_versioning = false
59 cflags = default_cflags
60 objs = [] # other object files to link against, used e.g. for
61 # instruction-set optimized versions of code
63 # use "deps" for internal DPDK dependencies, and "ext_deps" for
64 # external package/library requirements
67 # eal is standard dependency once built
68 if dpdk_conf.has('RTE_LIBRTE_EAL')
72 dir_name = 'librte_' + l
76 shared_deps = ext_deps
77 static_deps = ext_deps
79 if not is_variable('shared_rte_' + d)
80 error('Missing internal dependency "@0@" for @1@ [@2@]'
81 .format(d, name, 'lib/' + dir_name))
83 shared_deps += [get_variable('shared_rte_' + d)]
84 static_deps += [get_variable('static_rte_' + d)]
89 dpdk_libs_disabled += name
90 set_variable(name.underscorify() + '_disable_reason', reason)
93 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
94 install_headers(headers)
96 libname = 'rte_' + name
97 includes += include_directories(dir_name)
99 if sources.length() == 0
100 # if no C files, just set a dependency on header path
101 shared_dep = declare_dependency(include_directories: includes)
102 static_dep = shared_dep
105 if use_function_versioning
106 cflags += '-DRTE_USE_FUNCTION_VERSIONING'
109 version_map = '@0@/@1@/rte_@2@_version.map'.format(
110 meson.current_source_dir(), dir_name, name)
112 is_stable = run_command(is_stable_cmd,
113 files(version_map)).returncode() == 0
116 lib_version = abi_version
117 so_version = stable_so_version
119 lib_version = experimental_abi_version
120 so_version = experimental_so_version
123 # first build static lib
124 static_lib = static_library(libname,
128 dependencies: static_deps,
129 include_directories: includes,
131 static_dep = declare_dependency(link_with: static_lib,
132 include_directories: includes,
133 dependencies: static_deps)
135 if not use_function_versioning
136 # use pre-build objects to build shared lib
138 objs += static_lib.extract_all_objects(recursive: false)
140 # for compat we need to rebuild with
141 # RTE_BUILD_SHARED_LIB defined
142 cflags += '-DRTE_BUILD_SHARED_LIB'
144 version_map = '@0@/@1@/rte_@2@_version.map'.format(
145 meson.current_source_dir(), dir_name, name)
146 implib = dir_name + '.dll.a'
148 def_file = custom_target(name + '_def',
149 command: [map_to_def_cmd, '@INPUT@', '@OUTPUT@'],
151 output: 'rte_@0@_exports.def'.format(name))
154 lk_args = ['-Wl,/def:' + def_file.full_path(),
155 '-Wl,/implib:lib\\' + implib]
157 lk_args = ['-Wl,--version-script=' + version_map]
160 lk_deps = [version_map, def_file]
162 # on unix systems check the output of the
163 # check-symbols.sh script, using it as a
164 # dependency of the .so build
165 lk_deps += custom_target(name + '.sym_chk',
166 command: [check_symbols,
167 version_map, '@INPUT@'],
170 output: name + '.sym_chk')
173 shared_lib = shared_library(libname,
177 dependencies: shared_deps,
178 include_directories: includes,
180 link_depends: lk_deps,
181 version: lib_version,
182 soversion: so_version,
184 shared_dep = declare_dependency(link_with: shared_lib,
185 include_directories: includes,
186 dependencies: shared_deps)
188 dpdk_libraries = [shared_lib] + dpdk_libraries
189 dpdk_static_libraries = [static_lib] + dpdk_static_libraries
190 if libname == 'rte_node'
191 dpdk_graph_nodes = [static_lib]
193 endif # sources.length() > 0
195 set_variable('shared_rte_' + name, shared_dep)
196 set_variable('static_rte_' + name, static_dep)
197 message('lib/@0@: Defining dependency "@1@"'.format(