crypto/ccp: support device init
[dpdk.git] / lib / meson.build
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.
11 libraries = [ '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         'timer',   # eventdev depends on this
17         'acl', 'bbdev', 'bitratestats', 'cfgfile',
18         'cmdline', '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']
28
29 foreach l:libraries
30         build = true
31         name = l
32         version = 1
33         allow_experimental_apis = false
34         sources = []
35         headers = []
36         includes = []
37         cflags = machine_args
38         objs = [] # other object files to link against, used e.g. for
39                   # instruction-set optimized versions of code
40
41         # use "deps" for internal DPDK dependencies, and "ext_deps" for
42         # external package/library requirements
43         ext_deps = []
44         deps = ['eal']   # eal is standard dependency except for itself
45         if l == 'eal'
46                 deps = []
47         endif
48
49         dir_name = 'librte_' + l
50         subdir(dir_name)
51
52         if build
53                 dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
54                 install_headers(headers)
55
56                 libname = 'rte_' + name
57                 includes += include_directories(dir_name)
58
59                 if sources.length() == 0
60                         # if no C files, just set a dependency on header path
61                         shared_dep = declare_dependency(include_directories: includes)
62                         static_dep = shared_dep
63                 else
64                         shared_deps = ext_deps
65                         static_deps = ext_deps
66                         foreach d:deps
67                                 shared_deps += [get_variable('shared_rte_' + d)]
68                                 static_deps += [get_variable('static_rte_' + d)]
69                         endforeach
70
71                         if allow_experimental_apis
72                                 cflags += '-DALLOW_EXPERIMENTAL_API'
73                         endif
74
75                         if get_option('per_library_versions')
76                                 lib_version = '@0@.1'.format(version)
77                                 so_version = '@0@'.format(version)
78                         else
79                                 prj_ver = meson.project_version().split('.')
80                                 lib_version = '@0@.@1@'.format(
81                                                 prj_ver.get(0), prj_ver.get(1))
82                                 so_version = lib_version
83                         endif
84
85                         # first build static lib
86                         static_lib = static_library(libname,
87                                         sources,
88                                         objects: objs,
89                                         c_args: cflags,
90                                         dependencies: static_deps,
91                                         include_directories: includes,
92                                         install: true)
93                         static_dep = declare_dependency(link_with: static_lib,
94                                         include_directories: includes,
95                                         dependencies: static_deps)
96
97                         # then use pre-build objects to build shared lib
98                         sources = []
99                         objs += static_lib.extract_all_objects()
100                         version_map = '@0@/@1@/rte_@2@_version.map'.format(
101                                         meson.current_source_dir(), dir_name, name)
102                         shared_lib = shared_library(libname,
103                                         sources,
104                                         objects: objs,
105                                         c_args: cflags,
106                                         dependencies: shared_deps,
107                                         include_directories: includes,
108                                         link_args: '-Wl,--version-script=' + version_map,
109                                         link_depends: version_map,
110                                         version: lib_version,
111                                         soversion: so_version,
112                                         install: true)
113                         shared_dep = declare_dependency(link_with: shared_lib,
114                                         include_directories: includes,
115                                         dependencies: shared_deps)
116
117                         dpdk_libraries = [shared_lib] + dpdk_libraries
118                 endif # sources.length() > 0
119
120                 set_variable('shared_' + libname, shared_dep)
121                 set_variable('static_' + libname, static_dep)
122         endif # if build
123 endforeach