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', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core 18 'cmdline', 19 'metrics', # bitrate/latency stats depends on this 20 'hash', # efd depends on this 21 'timer', # eventdev depends on this 22 'acl', 'bbdev', 'bitratestats', 'cfgfile', 23 'compressdev', 'cryptodev', 24 'distributor', 'efd', 'eventdev', 25 'gro', 'gso', 'ip_frag', 'jobstats', 26 'kni', 'latencystats', 'lpm', 'member', 27 'power', 'pdump', 'rawdev', 'regexdev', 28 'rib', 'reorder', 'sched', 'security', 'stack', 'vhost', 29 # ipsec lib depends on net, crypto and security 30 'ipsec', 31 #fib lib depends on rib 32 'fib', 33 # add pkt framework libs which use other libs from above 34 'port', 'table', 'pipeline', 35 # flow_classify lib depends on pkt framework table lib 36 'flow_classify', 'bpf', 'graph', 'node'] 37 38if is_windows 39 libraries = [ 40 'kvargs', 41 'eal', 42 'ring', 43 'mempool', 'mbuf', 'pci', 44 ] # only supported libraries for windows 45endif 46 47default_cflags = machine_args 48default_cflags += ['-DALLOW_EXPERIMENTAL_API'] 49default_cflags += ['-DALLOW_INTERNAL_API'] 50 51if cc.has_argument('-Wno-format-truncation') 52 default_cflags += '-Wno-format-truncation' 53endif 54 55enabled_libs = [] # used to print summary at the end 56 57foreach l:libraries 58 build = true 59 reason = '<unknown reason>' # set if build == false to explain why 60 name = l 61 use_function_versioning = false 62 sources = [] 63 headers = [] 64 includes = [] 65 cflags = default_cflags 66 objs = [] # other object files to link against, used e.g. for 67 # instruction-set optimized versions of code 68 69 # use "deps" for internal DPDK dependencies, and "ext_deps" for 70 # external package/library requirements 71 ext_deps = [] 72 deps = [] 73 # eal is standard dependency once built 74 if dpdk_conf.has('RTE_LIBRTE_EAL') 75 deps += ['eal'] 76 endif 77 78 dir_name = 'librte_' + l 79 subdir(dir_name) 80 81 if build 82 shared_deps = ext_deps 83 static_deps = ext_deps 84 foreach d:deps 85 if not is_variable('shared_rte_' + d) 86 error('Missing internal dependency "@0@" for @1@ [@2@]' 87 .format(d, name, 'lib/' + dir_name)) 88 endif 89 shared_deps += [get_variable('shared_rte_' + d)] 90 static_deps += [get_variable('static_rte_' + d)] 91 endforeach 92 endif 93 94 if not build 95 dpdk_libs_disabled += name 96 set_variable(name.underscorify() + '_disable_reason', reason) 97 else 98 enabled_libs += name 99 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1) 100 install_headers(headers) 101 102 libname = 'rte_' + name 103 includes += include_directories(dir_name) 104 105 if sources.length() == 0 106 # if no C files, just set a dependency on header path 107 shared_dep = declare_dependency(include_directories: includes) 108 static_dep = shared_dep 109 else 110 if is_windows and use_function_versioning 111 message('@0@: Function versioning is not supported by Windows.' 112 .format(name)) 113 endif 114 115 if use_function_versioning 116 cflags += '-DRTE_USE_FUNCTION_VERSIONING' 117 endif 118 119 # first build static lib 120 static_lib = static_library(libname, 121 sources, 122 objects: objs, 123 c_args: cflags, 124 dependencies: static_deps, 125 include_directories: includes, 126 install: true) 127 static_dep = declare_dependency( 128 include_directories: includes, 129 dependencies: static_deps) 130 131 if not use_function_versioning or is_windows 132 # use pre-build objects to build shared lib 133 sources = [] 134 objs += static_lib.extract_all_objects(recursive: false) 135 else 136 # for compat we need to rebuild with 137 # RTE_BUILD_SHARED_LIB defined 138 cflags += '-DRTE_BUILD_SHARED_LIB' 139 endif 140 version_map = '@0@/@1@/rte_@2@_version.map'.format( 141 meson.current_source_dir(), dir_name, name) 142 implib = dir_name + '.dll.a' 143 144 def_file = custom_target(libname + '_def', 145 command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], 146 input: version_map, 147 output: '@0@_exports.def'.format(libname)) 148 149 mingw_map = custom_target(libname + '_mingw', 150 command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], 151 input: version_map, 152 output: '@0@_mingw.map'.format(libname)) 153 154 if is_ms_linker 155 lk_args = ['-Wl,/def:' + def_file.full_path(), 156 '-Wl,/implib:lib\\' + implib] 157 else 158 if is_windows 159 lk_args = ['-Wl,--version-script=' + mingw_map.full_path()] 160 else 161 lk_args = ['-Wl,--version-script=' + version_map] 162 endif 163 endif 164 165 lk_deps = [version_map, def_file, mingw_map] 166 if not is_windows 167 # on unix systems check the output of the 168 # check-symbols.sh script, using it as a 169 # dependency of the .so build 170 lk_deps += custom_target(name + '.sym_chk', 171 command: [check_symbols, 172 version_map, '@INPUT@'], 173 capture: true, 174 input: static_lib, 175 output: name + '.sym_chk') 176 endif 177 178 shared_lib = shared_library(libname, 179 sources, 180 objects: objs, 181 c_args: cflags, 182 dependencies: shared_deps, 183 include_directories: includes, 184 link_args: lk_args, 185 link_depends: lk_deps, 186 version: abi_version, 187 soversion: so_version, 188 install: true) 189 shared_dep = declare_dependency(link_with: shared_lib, 190 include_directories: includes, 191 dependencies: shared_deps) 192 193 dpdk_libraries = [shared_lib] + dpdk_libraries 194 dpdk_static_libraries = [static_lib] + dpdk_static_libraries 195 endif # sources.length() > 0 196 197 set_variable('shared_rte_' + name, shared_dep) 198 set_variable('static_rte_' + name, static_dep) 199 message('lib/@0@: Defining dependency "@1@"'.format( 200 dir_name, name)) 201 endif # if build 202endforeach 203