Debian Codegraph @

src/libmbim-glib/generated/meson.build

raw
1 # SPDX-License-Identifier: GPL-2.0-or-later
2 # Copyright (C) 2021 IƱigo Martinez <[email protected]>
3
4 generated_inc = include_directories('.')
5
6 gen_sources = []
7 gen_headers = []
8 gen_sections = []
9 gen_sections_deps = []
10
11 # Error types
12 enum_types = 'mbim-error-types'
13
14 gen_headers += custom_target(
15 enum_types + '.h',
16 input: mbim_errors_header,
17 output: enum_types + '.h',
18 command: [
19 python,
20 mbim_mkenums,
21 '--fhead', '#ifndef __LIBMBIM_GLIB_ERROR_TYPES_H__\n#define __LIBMBIM_GLIB_ERROR_TYPES_H__\n#include "mbim-errors.h"\n',
22 '--template', files(templates_dir / enum_types + '.h.template'),
23 '--ftail', '#endif /* __LIBMBIM_GLIB_ERROR_TYPES_H__ */\n',
24 '@INPUT@'],
25 capture: true,
26 install: true,
27 install_dir: mbim_glib_pkgincludedir,
28 )
29
30 gen_sources += custom_target(
31 enum_types + '.c',
32 input: mbim_errors_header,
33 output: enum_types + '.c',
34 command: [
35 python,
36 mbim_mkenums,
37 '--fhead', '#include "mbim-errors.h"\n#include "mbim-error-types.h"\n',
38 '--template', files(templates_dir / enum_types + '.c.template'),
39 '@INPUT@'],
40 capture: true,
41 )
42
43 enum_types = 'mbim-error-quarks'
44
45 gen_sources += custom_target(
46 enum_types + '.c',
47 input: mbim_errors_header,
48 output: enum_types + '.c',
49 command: [
50 python,
51 mbim_mkenums,
52 '--fhead', '#include "mbim-errors.h"\n#include "mbim-error-types.h"\n',
53 '--template', files(templates_dir / enum_types + '.c.template'),
54 '@INPUT@'],
55 capture: true,
56 )
57
58 # Enum types
59 enum_types = 'mbim-enum-types'
60
61 gen_headers += custom_target(
62 enum_types + '.h',
63 input: mbim_enums_headers,
64 output: enum_types + '.h',
65 command: [
66 python,
67 mbim_mkenums,
68 '--enums-only',
69 '--fhead', '#ifndef __LIBMBIM_GLIB_ENUM_TYPES_H__\n#define __LIBMBIM_GLIB_ENUM_TYPES_H__\n#include "mbim-uuid.h"\n#include "mbim-cid.h"\n#include "mbim-message.h"\n#include "mbim-enums.h"\n#include "mbim-tlv.h"\n',
70 '--template', files(templates_dir / enum_types + '.h.template'),
71 '--ftail', '#endif /* __LIBMBIM_GLIB_ENUM_TYPES_H__ */\n',
72 '@INPUT@'],
73 capture: true,
74 install: true,
75 install_dir: mbim_glib_pkgincludedir,
76 )
77
78 gen_sources += custom_target(
79 enum_types + '.c',
80 input: mbim_enums_headers,
81 output: enum_types + '.c',
82 command: [
83 python,
84 mbim_mkenums,
85 '--enums-only',
86 '--fhead', '#include "mbim-enum-types.h"\n',
87 '--template', files(templates_dir / enum_types + '.c.template'),
88 '@INPUT@'],
89 capture: true,
90 )
91
92 # Flag types
93 enum_types = 'mbim-flag-types'
94
95 gen_headers += custom_target(
96 enum_types + '.h',
97 input: mbim_enums_headers,
98 output: enum_types + '.h',
99 command: [
100 python,
101 mbim_mkenums,
102 '--flags-only',
103 '--fhead', '#ifndef __LIBMBIM_GLIB_FLAG_TYPES_H__\n#define __LIBMBIM_GLIB_FLAG_TYPES_H__\n#include "mbim-uuid.h"\n#include "mbim-cid.h"\n#include "mbim-message.h"\n#include "mbim-enums.h"\n#include "mbim-tlv.h"\n',
104 '--template', files(templates_dir / enum_types + '.h.template'),
105 '--ftail', '#endif /* __LIBMBIM_GLIB_FLAG_TYPES_H__ */\n',
106 '@INPUT@'],
107 capture: true,
108 install: true,
109 install_dir: mbim_glib_pkgincludedir,
110 )
111
112 gen_sources += custom_target(
113 enum_types + '.c',
114 input: mbim_enums_headers,
115 output: enum_types + '.c',
116 command: [
117 python,
118 mbim_mkenums,
119 '--flags-only',
120 '--fhead', '#include "mbim-flag-types.h"\n',
121 '--template', files(templates_dir / enum_types + '.c.template'),
122 '@INPUT@'],
123 capture: true,
124 )
125
126 services_data = [
127 ['atds'],
128 ['auth'],
129 ['basic-connect', 'ms-basic-connect-v2', 'ms-basic-connect-v3'],
130 ['dss'],
131 ['intel-firmware-update', 'intel-firmware-update-v2'],
132 ['intel-thermal-rf'],
133 ['ms-basic-connect-extensions', 'ms-basic-connect-extensions-v2', 'ms-basic-connect-extensions-v3'],
134 ['ms-uicc-low-level-access'],
135 ['ms-firmware-id'],
136 ['ms-host-shutdown'],
137 ['ms-sar'],
138 ['ms-voice-extensions'],
139 ['phonebook'],
140 ['proxy-control'],
141 ['qdu'],
142 ['quectel'],
143 ['qmi'],
144 ['sms'],
145 ['stk'],
146 ['ussd'],
147 ['intel-mutual-authentication'],
148 ['intel-tools'],
149 ['google'],
150 ['fibocom'],
151 ['compal'],
152 ['intel-at-tunnel'],
153 ]
154
155 foreach service_data: services_data
156 service = service_data[0]
157 name = 'mbim-' + service
158
159 input = []
160 foreach service_file: service_data
161 input += data_dir / 'mbim-service-@[email protected]'.format(service_file)
162 endforeach
163
164 generated = custom_target(
165 name,
166 input: input,
167 output: [name + '.c', name + '.h', name + '.sections'],
168 command: [mbim_codegen, '--output', '@OUTDIR@' / name, '@INPUT@'],
169 install: true,
170 install_dir: [false, mbim_glib_pkgincludedir, false],
171 )
172
173 gen_sources += generated[0]
174 gen_headers += generated[1]
175
176 # FIXME: the third target generated by custom target can't by used because is not a known
177 # source file, to the path has to be used. the first workaround is to use the
178 # build paths to point to the files, and the second workaround is to use
179 # custom target objects to force its building.
180 gen_sections += [meson.current_build_dir() / name + '.sections']
181 gen_sections_deps += [generated]
182 endforeach
183
184 c_flags = [
185 '-DLIBMBIM_GLIB_COMPILATION',
186 '-DG_LOG_DOMAIN="Mbim"',
187 '-Wno-unused-function',
188 ]
189
190 libmbim_glib_generated = static_library(
191 'mbim-glib-generated',
192 sources: gen_sources + gen_headers,
193 include_directories: libmbim_glib_inc,
194 dependencies: glib_deps,
195 c_args: c_flags,
196 )
197
198 generated_dep = declare_dependency(
199 sources: gen_headers,
200 include_directories: [libmbim_glib_inc, generated_inc],
201 dependencies: glib_deps,
202 )