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
12 'eal', 'ring', 'mempool', 'mbuf', 'net', 'ether', 'pci', # core
13 'metrics', # bitrate/latency stats depends on this
14 'hash', # efd depends on this
15 'kvargs', # cryptodev depends on this
16 'acl', 'bbdev', 'bitratestats', 'cfgfile',
17 'cmdline', 'cryptodev',
18 'distributor', 'efd', 'eventdev',
19 'gro', 'gso', 'ip_frag', 'jobstats',
20 'kni', 'latencystats', 'lpm', 'member',
21 'meter', 'power', 'pdump',
22 'reorder', 'sched', 'security', 'timer', 'vhost',
23 # add pkt framework libs which use other libs from above
24 'port', 'table', 'pipeline',
25 # flow_classify lib depends on pkt framework table lib
32 allow_experimental_apis = false
37 objs = [] # other object files to link against, used e.g. for
38 # instruction-set optimized versions of code
40 # use "deps" for internal DPDK dependencies, and "ext_deps" for
41 # external package/library requirements
43 deps = ['eal'] # eal is standard dependency except for itself
48 dir_name = 'librte_' + l
52 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
53 install_headers(headers)
55 libname = 'rte_' + name
56 includes += include_directories(dir_name)
58 if sources.length() == 0
59 # if no C files, just set a dependency on header path
60 shared_dep = declare_dependency(include_directories: includes)
61 static_dep = shared_dep
63 shared_deps = ext_deps
64 static_deps = ext_deps
66 shared_deps += [get_variable('shared_rte_' + d)]
67 static_deps += [get_variable('static_rte_' + d)]
70 if allow_experimental_apis
71 cflags += '-DALLOW_EXPERIMENTAL_API'
74 if get_option('per_library_versions')
75 lib_version = '@0@.1'.format(version)
76 so_version = '@0@'.format(version)
78 prj_ver = meson.project_version().split('.')
79 lib_version = '@0@.@1@'.format(
80 prj_ver.get(0), prj_ver.get(1))
81 so_version = lib_version
84 # first build static lib
85 static_lib = static_library(libname,
89 dependencies: static_deps,
90 include_directories: includes,
92 static_dep = declare_dependency(link_with: static_lib,
93 include_directories: includes,
94 dependencies: static_deps)
96 # then use pre-build objects to build shared lib
98 objs += static_lib.extract_all_objects()
99 version_map = '@0@/@1@/rte_@2@_version.map'.format(
100 meson.current_source_dir(), dir_name, name)
101 shared_lib = shared_library(libname,
105 dependencies: shared_deps,
106 include_directories: includes,
107 link_args: '-Wl,--version-script=' + version_map,
108 link_depends: version_map,
109 version: lib_version,
110 soversion: so_version,
112 shared_dep = declare_dependency(link_with: shared_lib,
113 include_directories: includes,
114 dependencies: shared_deps)
116 dpdk_libraries = [shared_lib] + dpdk_libraries
117 endif # sources.length() > 0
119 set_variable('shared_' + libname, shared_dep)
120 set_variable('static_' + libname, static_dep)