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