1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017-2019 Intel Corporation 3 4 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. 11libraries = [ 12 'kvargs', # eal depends on kvargs 13 'telemetry', # basic info querying 14 'eal', # everything depends on eal 15 'ring', 16 'rcu', # rcu depends on ring 17 'mempool', 18 'mbuf', 19 'net', 20 'meter', 21 'ethdev', 22 'pci', # core 23 'cmdline', 24 'metrics', # bitrate/latency stats depends on this 25 'hash', # efd depends on this 26 'timer', # eventdev depends on this 27 'acl', 28 'bbdev', 29 'bitratestats', 30 'cfgfile', 31 'compressdev', 32 'cryptodev', 33 'distributor', 34 'efd', 35 'eventdev', 36 'gro', 37 'gso', 38 'ip_frag', 39 'jobstats', 40 'kni', 41 'latencystats', 42 'lpm', 43 'member', 44 'power', 45 'pdump', 46 'rawdev', 47 'regexdev', 48 'dmadev', 49 'rib', 50 'reorder', 51 'sched', 52 'security', 53 'stack', 54 'vhost', 55 'ipsec', # ipsec lib depends on net, crypto and security 56 'fib', #fib lib depends on rib 57 'port', # pkt framework libs which use other libs from above 58 'table', 59 'pipeline', 60 'flow_classify', # flow_classify lib depends on pkt framework table lib 61 'bpf', 62 'graph', 63 'node', 64] 65 66if is_windows 67 libraries = [ 68 'kvargs', 69 'telemetry', 70 'eal', 71 'ring', 72 'rcu', 73 'mempool', 74 'mbuf', 75 'net', 76 'meter', 77 'ethdev', 78 'pci', 79 'cmdline', 80 'metrics', 81 'hash', 82 'timer', 83 'bitratestats', 84 'cryptodev', 85 'cfgfile', 86 'gro', 87 'gso', 88 'latencystats', 89 'pdump', 90 'stack', 91 'security', 92 ] # only supported libraries for windows 93endif 94 95optional_libs = [ 96 'kni', 97 'power', 98 'vhost', 99] 100 101disabled_libs = [] 102opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'), 103 check: true).stdout().split() 104foreach l:opt_disabled_libs 105 if not optional_libs.contains(l) 106 warning('Cannot disable mandatory library "@0@"'.format(l)) 107 continue 108 endif 109 disabled_libs += l 110endforeach 111 112 113default_cflags = machine_args 114default_cflags += ['-DALLOW_EXPERIMENTAL_API'] 115default_cflags += ['-DALLOW_INTERNAL_API'] 116 117if cc.has_argument('-Wno-format-truncation') 118 default_cflags += '-Wno-format-truncation' 119endif 120 121enabled_libs = [] # used to print summary at the end 122 123foreach l:libraries 124 build = true 125 reason = '<unknown reason>' # set if build == false to explain why 126 name = l 127 use_function_versioning = false 128 sources = [] 129 headers = [] 130 indirect_headers = [] # public headers not directly included by apps 131 driver_sdk_headers = [] # public headers included by drivers 132 includes = [] 133 cflags = default_cflags 134 objs = [] # other object files to link against, used e.g. for 135 # instruction-set optimized versions of code 136 137 # use "deps" for internal DPDK dependencies, and "ext_deps" for 138 # external package/library requirements 139 ext_deps = [] 140 deps = [] 141 # eal is standard dependency once built 142 if dpdk_conf.has('RTE_LIB_EAL') 143 deps += ['eal'] 144 endif 145 146 if disabled_libs.contains(l) 147 build = false 148 reason = 'explicitly disabled via build config' 149 else 150 subdir(l) 151 endif 152 if name != l 153 warning('Library name, "@0@", and directory name, "@1@", do not match'.format(name, l)) 154 endif 155 156 if not build 157 dpdk_libs_disabled += name 158 set_variable(name.underscorify() + '_disable_reason', reason) 159 continue 160 endif 161 162 shared_deps = ext_deps 163 static_deps = ext_deps 164 foreach d:deps 165 if not is_variable('shared_rte_' + d) 166 error('Missing internal dependency "@0@" for @1@ [@2@]' 167 .format(d, name, 'lib/' + l)) 168 endif 169 shared_deps += [get_variable('shared_rte_' + d)] 170 static_deps += [get_variable('static_rte_' + d)] 171 endforeach 172 173 enabled_libs += name 174 dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) 175 install_headers(headers) 176 install_headers(indirect_headers) 177 if get_option('enable_driver_sdk') 178 install_headers(driver_sdk_headers) 179 endif 180 dpdk_chkinc_headers += headers 181 182 libname = 'rte_' + name 183 includes += include_directories(l) 184 185 if developer_mode and is_windows and use_function_versioning 186 message('@0@: Function versioning is not supported by Windows.'.format(name)) 187 endif 188 189 if use_function_versioning 190 cflags += '-DRTE_USE_FUNCTION_VERSIONING' 191 endif 192 cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=lib.' + l 193 194 # first build static lib 195 static_lib = static_library(libname, 196 sources, 197 objects: objs, 198 c_args: cflags, 199 dependencies: static_deps, 200 include_directories: includes, 201 install: true) 202 static_dep = declare_dependency( 203 include_directories: includes, 204 dependencies: static_deps) 205 206 if not use_function_versioning or is_windows 207 # use pre-build objects to build shared lib 208 sources = [] 209 objs += static_lib.extract_all_objects(recursive: false) 210 else 211 # for compat we need to rebuild with 212 # RTE_BUILD_SHARED_LIB defined 213 cflags += '-DRTE_BUILD_SHARED_LIB' 214 endif 215 version_map = '@0@/@1@/version.map'.format( 216 meson.current_source_dir(), l) 217 implib = 'librte_' + l + '.dll.a' 218 219 def_file = custom_target(libname + '_def', 220 command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], 221 input: version_map, 222 output: '@0@_exports.def'.format(libname)) 223 224 mingw_map = custom_target(libname + '_mingw', 225 command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], 226 input: version_map, 227 output: '@0@_mingw.map'.format(libname)) 228 229 if is_ms_linker 230 lk_args = ['-Wl,/def:' + def_file.full_path()] 231 if meson.version().version_compare('<0.54.0') 232 lk_args += ['-Wl,/implib:lib\\' + implib] 233 endif 234 else 235 if is_windows 236 lk_args = ['-Wl,--version-script=' + mingw_map.full_path()] 237 else 238 lk_args = ['-Wl,--version-script=' + version_map] 239 endif 240 endif 241 242 lk_deps = [version_map, def_file, mingw_map] 243 if developer_mode and not is_windows 244 # on unix systems check the output of the 245 # check-symbols.sh script, using it as a 246 # dependency of the .so build 247 lk_deps += custom_target(name + '.sym_chk', 248 command: [check_symbols, 249 version_map, '@INPUT@'], 250 capture: true, 251 input: static_lib, 252 output: name + '.sym_chk') 253 endif 254 255 shared_lib = shared_library(libname, 256 sources, 257 objects: objs, 258 c_args: cflags, 259 dependencies: shared_deps, 260 include_directories: includes, 261 link_args: lk_args, 262 link_depends: lk_deps, 263 version: abi_version, 264 soversion: so_version, 265 install: true) 266 shared_dep = declare_dependency(link_with: shared_lib, 267 include_directories: includes, 268 dependencies: shared_deps) 269 270 dpdk_libraries = [shared_lib] + dpdk_libraries 271 dpdk_static_libraries = [static_lib] + dpdk_static_libraries 272 273 set_variable('shared_rte_' + name, shared_dep) 274 set_variable('static_rte_' + name, static_dep) 275 if developer_mode 276 message('lib/@0@: Defining dependency "@1@"'.format(l, name)) 277 endif 278endforeach 279