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 35 36# -D_GNU_SOURCE unconditionally 37default_cflags += '-D_GNU_SOURCE' 38 39foreach l:libraries 40 build = true 41 name = l 42 version = 1 43 allow_experimental_apis = false 44 sources = [] 45 headers = [] 46 includes = [] 47 cflags = default_cflags 48 objs = [] # other object files to link against, used e.g. for 49 # instruction-set optimized versions of code 50 51 # use "deps" for internal DPDK dependencies, and "ext_deps" for 52 # external package/library requirements 53 ext_deps = [] 54 deps = [] 55 # eal is standard dependency once built 56 if dpdk_conf.has('RTE_LIBRTE_EAL') 57 deps += ['eal'] 58 endif 59 60 dir_name = 'librte_' + l 61 subdir(dir_name) 62 63 if build 64 enabled_libs += name 65 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1) 66 install_headers(headers) 67 68 libname = 'rte_' + name 69 includes += include_directories(dir_name) 70 71 if sources.length() == 0 72 # if no C files, just set a dependency on header path 73 shared_dep = declare_dependency(include_directories: includes) 74 static_dep = shared_dep 75 else 76 shared_deps = ext_deps 77 static_deps = ext_deps 78 foreach d:deps 79 if not is_variable('shared_rte_' + d) 80 error('Missing dependency ' + d + 81 ' for library ' + lib_name) 82 endif 83 shared_deps += [get_variable('shared_rte_' + d)] 84 static_deps += [get_variable('static_rte_' + d)] 85 endforeach 86 87 if allow_experimental_apis 88 cflags += '-DALLOW_EXPERIMENTAL_API' 89 endif 90 91 if get_option('per_library_versions') 92 lib_version = '@[email protected]'.format(version) 93 so_version = '@0@'.format(version) 94 else 95 prj_ver = meson.project_version().split('.') 96 lib_version = '@0@.@1@'.format( 97 prj_ver.get(0), prj_ver.get(1)) 98 so_version = lib_version 99 endif 100 101 # first build static lib 102 static_lib = static_library(libname, 103 sources, 104 objects: objs, 105 c_args: cflags, 106 dependencies: static_deps, 107 include_directories: includes, 108 install: true) 109 static_dep = declare_dependency(link_with: static_lib, 110 include_directories: includes, 111 dependencies: static_deps) 112 113 # then use pre-build objects to build shared lib 114 sources = [] 115 objs += static_lib.extract_all_objects(recursive: false) 116 version_map = '@0@/@1@/rte_@2@_version.map'.format( 117 meson.current_source_dir(), dir_name, name) 118 shared_lib = shared_library(libname, 119 sources, 120 objects: objs, 121 c_args: cflags, 122 dependencies: shared_deps, 123 include_directories: includes, 124 link_args: '-Wl,--version-script=' + version_map, 125 link_depends: version_map, 126 version: lib_version, 127 soversion: so_version, 128 install: true) 129 shared_dep = declare_dependency(link_with: shared_lib, 130 include_directories: includes, 131 dependencies: shared_deps) 132 133 dpdk_libraries = [shared_lib] + dpdk_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