compress/isal: add skeleton ISA-L compression PMD
[dpdk.git] / drivers / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
3
4 # Defines the order in which the drivers are buit.
5 driver_classes = ['common',
6                'bus',
7                'mempool', # depends on common and bus.
8                'net',     # depends on common, bus and mempool.
9                'crypto',  # depends on common, bus and mempool (net in future).
10                'compress', # depends on common, bus, mempool.
11                'event',   # depends on common, bus, mempool and net.
12                'raw']     # depends on common, bus, mempool, net and event.
13
14 foreach class:driver_classes
15         drivers = []
16         std_deps = []
17         config_flag_fmt = '' # format string used to set the value in dpdk_conf
18         driver_name_fmt = '' # format string for driver name, used to name
19                              # the library, the dependency and to find the
20                              # version file for linking
21
22         subdir(class)
23
24         foreach drv:drivers
25                 drv_path = join_paths(class, drv)
26
27                 # set up empty variables used for build
28                 build = true # set to false to disable, e.g. missing deps
29                 name = drv
30                 version = 1
31                 allow_experimental_apis = false
32                 sources = []
33                 objs = []
34                 cflags = machine_args
35                 includes = [include_directories(drv_path)]
36                 # set up internal deps. Drivers can append/override as necessary
37                 deps = std_deps
38                 # ext_deps: Stores external library dependency got
39                 # using dependency() or cc.find_library(). For most cases, we
40                 # probably also need to specify the "-l" flags in
41                 # pkgconfig_extra_libs variable too, so that it can be reflected
42                 # in the pkgconfig output for static builds
43                 ext_deps = []
44                 pkgconfig_extra_libs = []
45
46                 # pull in driver directory which should assign to each of the above
47                 subdir(drv_path)
48
49                 if build
50                         dpdk_conf.set(config_flag_fmt.format(name.to_upper()),1)
51                         lib_name = driver_name_fmt.format(name)
52
53                         if allow_experimental_apis
54                                 cflags += '-DALLOW_EXPERIMENTAL_API'
55                         endif
56
57                         # get dependency objs from strings
58                         shared_objs = []
59                         static_objs = []
60                         foreach d:deps
61                                 shared_objs += [get_variable('shared_rte_' + d)]
62                                 static_objs += [get_variable('static_rte_' + d)]
63                         endforeach
64                         shared_objs += ext_deps
65                         static_objs += ext_deps
66                         dpdk_extra_ldflags += pkgconfig_extra_libs
67
68                         # generate pmdinfo sources by building a temporary
69                         # lib and then running pmdinfogen on the contents of
70                         # that lib. The final lib reuses the object files and
71                         # adds in the new source file.
72                         out_filename = lib_name + '.pmd.c'
73                         tmp_lib = static_library('tmp_' + lib_name,
74                                         sources,
75                                         include_directories: includes,
76                                         dependencies: static_objs,
77                                         c_args: cflags)
78                         objs += tmp_lib.extract_all_objects()
79                         sources = custom_target(out_filename,
80                                         command: [pmdinfo, tmp_lib.full_path(),
81                                                 '@OUTPUT@', pmdinfogen],
82                                         output: out_filename,
83                                         depends: [pmdinfogen, tmp_lib])
84
85                         if get_option('per_library_versions')
86                                 lib_version = '@0@.1'.format(version)
87                                 so_version = '@0@'.format(version)
88                         else
89                                 pver = meson.project_version().split('.')
90                                 lib_version = '@0@.@1@'.format(pver.get(0),
91                                                 pver.get(1))
92                                 so_version = lib_version
93                         endif
94
95                         # now build the static driver
96                         static_lib = static_library(lib_name,
97                                 sources,
98                                 objects: objs,
99                                 include_directories: includes,
100                                 dependencies: static_objs,
101                                 c_args: cflags,
102                                 install: true)
103
104                         # now build the shared driver
105                         version_map = '@0@/@1@/@2@_version.map'.format(
106                                         meson.current_source_dir(),
107                                         drv_path, lib_name)
108                         shared_lib = shared_library(lib_name,
109                                 sources,
110                                 objects: objs,
111                                 include_directories: includes,
112                                 dependencies: shared_objs,
113                                 c_args: cflags,
114                                 link_args: '-Wl,--version-script=' + version_map,
115                                 link_depends: version_map,
116                                 version: lib_version,
117                                 soversion: so_version,
118                                 install: true,
119                                 install_dir: driver_install_path)
120
121                         # create a dependency object and add it to the global dictionary so
122                         # testpmd or other built-in apps can find it if necessary
123                         shared_dep = declare_dependency(link_with: shared_lib,
124                                         include_directories: includes,
125                                         dependencies: shared_objs)
126                         static_dep = declare_dependency(link_with: static_lib,
127                                         include_directories: includes,
128                                         dependencies: static_objs)
129
130                         dpdk_drivers += static_lib
131
132                         set_variable('shared_@0@'.format(lib_name), shared_dep)
133                         set_variable('static_@0@'.format(lib_name), static_dep)
134                 endif # build
135         endforeach
136 endforeach