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.
11 libraries = [ 'compat', # just a header, used for versioning
13 'eal', 'ring', 'mempool', 'mbuf', 'net', 'ethdev', 'pci', # core
14 'metrics', # bitrate/latency stats depends on this
15 'hash', # efd depends on this
16 'timer', # eventdev depends on this
17 'acl', 'bbdev', 'bitratestats', 'cfgfile',
18 'cmdline', 'compressdev', 'cryptodev',
19 'distributor', 'efd', 'eventdev',
20 'gro', 'gso', 'ip_frag', 'jobstats',
21 'kni', 'latencystats', 'lpm', 'member',
22 'meter', 'power', 'pdump', 'rawdev',
23 'reorder', 'sched', 'security', 'vhost',
24 # add pkt framework libs which use other libs from above
25 'port', 'table', 'pipeline',
26 # flow_classify lib depends on pkt framework table lib
27 'flow_classify', 'bpf']
29 default_cflags = machine_args
30 if cc.has_argument('-Wno-format-truncation')
31 default_cflags += '-Wno-format-truncation'
37 allow_experimental_apis = false
41 cflags = default_cflags
42 objs = [] # other object files to link against, used e.g. for
43 # instruction-set optimized versions of code
45 # use "deps" for internal DPDK dependencies, and "ext_deps" for
46 # external package/library requirements
48 deps = ['eal'] # eal is standard dependency except for itself
56 dir_name = 'librte_' + l
60 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
61 install_headers(headers)
63 libname = 'rte_' + name
64 includes += include_directories(dir_name)
66 if sources.length() == 0
67 # if no C files, just set a dependency on header path
68 shared_dep = declare_dependency(include_directories: includes)
69 static_dep = shared_dep
71 shared_deps = ext_deps
72 static_deps = ext_deps
74 if not is_variable('shared_rte_' + d)
75 error('Missing dependency ' + d +
76 ' for library ' + lib_name)
78 shared_deps += [get_variable('shared_rte_' + d)]
79 static_deps += [get_variable('static_rte_' + d)]
82 if allow_experimental_apis
83 cflags += '-DALLOW_EXPERIMENTAL_API'
86 if get_option('per_library_versions')
87 lib_version = '@0@.1'.format(version)
88 so_version = '@0@'.format(version)
90 prj_ver = meson.project_version().split('.')
91 lib_version = '@0@.@1@'.format(
92 prj_ver.get(0), prj_ver.get(1))
93 so_version = lib_version
96 # first build static lib
97 static_lib = static_library(libname,
101 dependencies: static_deps,
102 include_directories: includes,
104 static_dep = declare_dependency(link_with: static_lib,
105 include_directories: includes,
106 dependencies: static_deps)
108 # then use pre-build objects to build shared lib
110 objs += static_lib.extract_all_objects(recursive: false)
111 version_map = '@0@/@1@/rte_@2@_version.map'.format(
112 meson.current_source_dir(), dir_name, name)
113 shared_lib = shared_library(libname,
117 dependencies: shared_deps,
118 include_directories: includes,
119 link_args: '-Wl,--version-script=' + version_map,
120 link_depends: version_map,
121 version: lib_version,
122 soversion: so_version,
124 shared_dep = declare_dependency(link_with: shared_lib,
125 include_directories: includes,
126 dependencies: shared_deps)
128 dpdk_libraries = [shared_lib] + dpdk_libraries
129 endif # sources.length() > 0
131 set_variable('shared_' + libname, shared_dep)
132 set_variable('static_' + libname, static_dep)