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', 'reorder', 'sched', 'security', 'stack', 'vhost',
26 # ipsec lib depends on net, crypto and security
28 # add pkt framework libs which use other libs from above
29 'port', 'table', 'pipeline',
30 # flow_classify lib depends on pkt framework table lib
31 'flow_classify', 'bpf', 'telemetry']
34 libraries = ['kvargs','eal'] # only supported libraries for windows
37 default_cflags = machine_args
38 if cc.has_argument('-Wno-format-truncation')
39 default_cflags += '-Wno-format-truncation'
42 enabled_libs = [] # used to print summary at the end
46 reason = '<unknown reason>' # set if build == false to explain why
49 allow_experimental_apis = false
53 cflags = default_cflags
54 objs = [] # other object files to link against, used e.g. for
55 # instruction-set optimized versions of code
57 # use "deps" for internal DPDK dependencies, and "ext_deps" for
58 # external package/library requirements
61 # eal is standard dependency once built
62 if dpdk_conf.has('RTE_LIBRTE_EAL')
66 dir_name = 'librte_' + l
70 dpdk_libs_disabled += name
71 set_variable(name.underscorify() + '_disable_reason', reason)
74 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
75 install_headers(headers)
77 libname = 'rte_' + name
78 includes += include_directories(dir_name)
80 if sources.length() == 0
81 # if no C files, just set a dependency on header path
82 shared_dep = declare_dependency(include_directories: includes)
83 static_dep = shared_dep
85 shared_deps = ext_deps
86 static_deps = ext_deps
88 if not is_variable('shared_rte_' + d)
89 error('Missing dependency ' + d +
90 ' for library ' + libname)
92 shared_deps += [get_variable('shared_rte_' + d)]
93 static_deps += [get_variable('static_rte_' + d)]
96 if allow_experimental_apis
97 cflags += '-DALLOW_EXPERIMENTAL_API'
100 if get_option('per_library_versions')
101 lib_version = '@0@.1'.format(version)
102 so_version = '@0@'.format(version)
104 lib_version = major_version
105 so_version = major_version
108 # first build static lib
109 static_lib = static_library(libname,
113 dependencies: static_deps,
114 include_directories: includes,
116 static_dep = declare_dependency(link_with: static_lib,
117 include_directories: includes,
118 dependencies: static_deps)
120 # then use pre-build objects to build shared lib
122 objs += static_lib.extract_all_objects(recursive: false)
123 version_map = '@0@/@1@/rte_@2@_version.map'.format(
124 meson.current_source_dir(), dir_name, name)
125 implib = dir_name + '.dll.a'
127 def_file = custom_target(name + '_def',
128 command: [map_to_def_cmd, '@INPUT@', '@OUTPUT@'],
130 output: 'rte_@0@_exports.def'.format(name))
132 lk_args = ['-Wl,/def:' + def_file.full_path(),
133 '-Wl,/implib:lib\\' + implib]
135 lk_args = ['-Wl,--version-script=' + version_map]
138 shared_lib = shared_library(libname,
142 dependencies: shared_deps,
143 include_directories: includes,
145 link_depends: [version_map, def_file],
146 version: lib_version,
147 soversion: so_version,
149 shared_dep = declare_dependency(link_with: shared_lib,
150 include_directories: includes,
151 dependencies: shared_deps)
153 dpdk_libraries = [shared_lib] + dpdk_libraries
154 dpdk_static_libraries = [static_lib] + dpdk_static_libraries
155 endif # sources.length() > 0
157 set_variable('shared_' + libname, shared_dep)
158 set_variable('static_' + libname, static_dep)