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