1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2017 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 'cmdline', # ethdev depends on cmdline for parsing functions 15 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core 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 'reorder', 'sched', 'security', 'vhost', 26 #ipsec lib depends on crypto and security 27 'ipsec', 28 # add pkt framework libs which use other libs from above 29 'port', 'table', 'pipeline', 30 # flow_classify lib depends on pkt framework table lib 31 'flow_classify', 'bpf', 'telemetry'] 32 33default_cflags = machine_args 34if cc.has_argument('-Wno-format-truncation') 35 default_cflags += '-Wno-format-truncation' 36endif 37 38enabled_libs = [] # used to print summary at the end 39 40# -D_GNU_SOURCE unconditionally 41default_cflags += '-D_GNU_SOURCE' 42 43foreach l:libraries 44 build = true 45 name = l 46 version = 1 47 allow_experimental_apis = false 48 sources = [] 49 headers = [] 50 includes = [] 51 cflags = default_cflags 52 objs = [] # other object files to link against, used e.g. for 53 # instruction-set optimized versions of code 54 55 # use "deps" for internal DPDK dependencies, and "ext_deps" for 56 # external package/library requirements 57 ext_deps = [] 58 deps = [] 59 # eal is standard dependency once built 60 if dpdk_conf.has('RTE_LIBRTE_EAL') 61 deps += ['eal'] 62 endif 63 64 dir_name = 'librte_' + l 65 subdir(dir_name) 66 67 if build 68 enabled_libs += name 69 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1) 70 install_headers(headers) 71 72 libname = 'rte_' + name 73 includes += include_directories(dir_name) 74 75 if sources.length() == 0 76 # if no C files, just set a dependency on header path 77 shared_dep = declare_dependency(include_directories: includes) 78 static_dep = shared_dep 79 else 80 shared_deps = ext_deps 81 static_deps = ext_deps 82 foreach d:deps 83 if not is_variable('shared_rte_' + d) 84 error('Missing dependency ' + d + 85 ' for library ' + libname) 86 endif 87 shared_deps += [get_variable('shared_rte_' + d)] 88 static_deps += [get_variable('static_rte_' + d)] 89 endforeach 90 91 if allow_experimental_apis 92 cflags += '-DALLOW_EXPERIMENTAL_API' 93 endif 94 95 if get_option('per_library_versions') 96 lib_version = '@[email protected]'.format(version) 97 so_version = '@0@'.format(version) 98 else 99 lib_version = major_version 100 so_version = major_version 101 endif 102 103 # first build static lib 104 static_lib = static_library(libname, 105 sources, 106 objects: objs, 107 c_args: cflags, 108 dependencies: static_deps, 109 include_directories: includes, 110 install: true) 111 static_dep = declare_dependency(link_with: static_lib, 112 include_directories: includes, 113 dependencies: static_deps) 114 115 # then use pre-build objects to build shared lib 116 sources = [] 117 objs += static_lib.extract_all_objects(recursive: false) 118 version_map = '@0@/@1@/rte_@2@_version.map'.format( 119 meson.current_source_dir(), dir_name, name) 120 shared_lib = shared_library(libname, 121 sources, 122 objects: objs, 123 c_args: cflags, 124 dependencies: shared_deps, 125 include_directories: includes, 126 link_args: '-Wl,--version-script=' + version_map, 127 link_depends: version_map, 128 version: lib_version, 129 soversion: so_version, 130 install: true) 131 shared_dep = declare_dependency(link_with: shared_lib, 132 include_directories: includes, 133 dependencies: shared_deps) 134 135 dpdk_libraries = [shared_lib] + dpdk_libraries 136 dpdk_static_libraries = [static_lib] + dpdk_static_libraries 137 endif # sources.length() > 0 138 139 set_variable('shared_' + libname, shared_dep) 140 set_variable('static_' + libname, static_dep) 141 endif # if build 142endforeach 143