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