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