1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 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 'cmdline', # ethdev depends on cmdline for parsing functions
15 '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 'reorder', 'sched', 'security', 'vhost',
26 #ipsec lib depends on 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']
33 default_cflags = machine_args
34 if cc.has_argument('-Wno-format-truncation')
35 default_cflags += '-Wno-format-truncation'
38 enabled_libs = [] # used to print summary at the end
40 # -D_GNU_SOURCE unconditionally
41 default_cflags += '-D_GNU_SOURCE'
47 allow_experimental_apis = false
51 cflags = default_cflags
52 objs = [] # other object files to link against, used e.g. for
53 # instruction-set optimized versions of code
55 # use "deps" for internal DPDK dependencies, and "ext_deps" for
56 # external package/library requirements
59 # eal is standard dependency once built
60 if dpdk_conf.has('RTE_LIBRTE_EAL')
64 dir_name = 'librte_' + l
69 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
70 install_headers(headers)
72 libname = 'rte_' + name
73 includes += include_directories(dir_name)
75 if sources.length() == 0
76 # if no C files, just set a dependency on header path
77 shared_dep = declare_dependency(include_directories: includes)
78 static_dep = shared_dep
80 shared_deps = ext_deps
81 static_deps = ext_deps
83 if not is_variable('shared_rte_' + d)
84 error('Missing dependency ' + d +
85 ' for library ' + libname)
87 shared_deps += [get_variable('shared_rte_' + d)]
88 static_deps += [get_variable('static_rte_' + d)]
91 if allow_experimental_apis
92 cflags += '-DALLOW_EXPERIMENTAL_API'
95 if get_option('per_library_versions')
96 lib_version = '@0@.1'.format(version)
97 so_version = '@0@'.format(version)
99 lib_version = major_version
100 so_version = major_version
103 # first build static lib
104 static_lib = static_library(libname,
108 dependencies: static_deps,
109 include_directories: includes,
111 static_dep = declare_dependency(link_with: static_lib,
112 include_directories: includes,
113 dependencies: static_deps)
115 # then use pre-build objects to build shared lib
117 objs += static_lib.extract_all_objects(recursive: false)
118 version_map = '@0@/@1@/rte_@2@_version.map'.format(
119 meson.current_source_dir(), dir_name, name)
120 shared_lib = shared_library(libname,
124 dependencies: shared_deps,
125 include_directories: includes,
126 link_args: '-Wl,--version-script=' + version_map,
127 link_depends: version_map,
128 version: lib_version,
129 soversion: so_version,
131 shared_dep = declare_dependency(link_with: shared_lib,
132 include_directories: includes,
133 dependencies: shared_deps)
135 dpdk_libraries = [shared_lib] + dpdk_libraries
136 dpdk_static_libraries = [static_lib] + dpdk_static_libraries
137 endif # sources.length() > 0
139 set_variable('shared_' + libname, shared_dep)
140 set_variable('static_' + libname, static_dep)