3 # Copyright(c) 2017 Intel Corporation.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in
14 # the documentation and/or other materials provided with the
16 # * Neither the name of Intel Corporation nor the names of its
17 # contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 # process all libraries equally, as far as possible
34 # "core" libs first, then others alphebetically as far as possible
35 # NOTE: for speed of meson runs, the dependencies in the subdirectories
36 # sometimes skip deps that would be implied by others, e.g. if mempool is
37 # given as a dep, no need to mention ring. This is especially true for the
38 # core libs which are widely reused, so their deps are kept to a minimum.
39 libraries = [ 'compat', # just a header, used for versioning
40 'eal', 'ring', 'mempool', 'mbuf', 'net', 'ether', 'pci', # core
41 'metrics', # bitrate/latency stats depends on this
42 'hash', # efd depends on this
43 'kvargs', # cryptodev depends on this
44 'acl', 'bbdev', 'bitratestats', 'cfgfile',
45 'cmdline', 'cryptodev',
46 'distributor', 'efd', 'eventdev',
47 'gro', 'gso', 'ip_frag', 'jobstats',
48 'kni', 'latencystats', 'lpm', 'member',
49 'meter', 'power', 'pdump',
50 'reorder', 'sched', 'security', 'timer', 'vhost',
51 # add pkt framework libs which use other libs from above
52 'port', 'table', 'pipeline',
53 # flow_classify lib depends on pkt framework table lib
60 allow_experimental_apis = false
65 objs = [] # other object files to link against, used e.g. for
66 # instruction-set optimized versions of code
68 # use "deps" for internal DPDK dependencies, and "ext_deps" for
69 # external package/library requirements
71 deps = ['eal'] # eal is standard dependency except for itself
76 dir_name = 'librte_' + l
80 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
81 install_headers(headers)
83 libname = 'rte_' + name
84 includes += include_directories(dir_name)
86 if sources.length() == 0
87 # if no C files, just set a dependency on header path
88 shared_dep = declare_dependency(include_directories: includes)
89 static_dep = shared_dep
91 shared_deps = ext_deps
92 static_deps = ext_deps
94 shared_deps += [get_variable('shared_rte_' + d)]
95 static_deps += [get_variable('static_rte_' + d)]
98 if allow_experimental_apis
99 cflags += '-DALLOW_EXPERIMENTAL_API'
102 if get_option('per_library_versions')
103 lib_version = '@0@.1'.format(version)
104 so_version = '@0@'.format(version)
106 prj_ver = meson.project_version().split('.')
107 lib_version = '@0@.@1@'.format(
108 prj_ver.get(0), prj_ver.get(1))
109 so_version = lib_version
112 # first build static lib
113 static_lib = static_library(libname,
117 dependencies: static_deps,
118 include_directories: includes,
120 static_dep = declare_dependency(link_with: static_lib,
121 include_directories: includes,
122 dependencies: static_deps)
124 # then use pre-build objects to build shared lib
126 objs += static_lib.extract_all_objects()
127 version_map = '@0@/@1@/rte_@2@_version.map'.format(
128 meson.current_source_dir(), dir_name, name)
129 shared_lib = shared_library(libname,
133 dependencies: shared_deps,
134 include_directories: includes,
135 link_args: '-Wl,--version-script=' + version_map,
136 link_depends: version_map,
137 version: lib_version,
138 soversion: so_version,
140 shared_dep = declare_dependency(link_with: shared_lib,
141 include_directories: includes,
142 dependencies: shared_deps)
144 dpdk_libraries = [shared_lib] + dpdk_libraries
145 endif # sources.length() > 0
147 set_variable('shared_' + libname, shared_dep)
148 set_variable('static_' + libname, static_dep)