xref: /openbmc/qemu/qapi/meson.build (revision db1015e9)
1util_ss.add(files(
2  'opts-visitor.c',
3  'qapi-clone-visitor.c',
4  'qapi-dealloc-visitor.c',
5  'qapi-util.c',
6  'qapi-visit-core.c',
7  'qmp-dispatch.c',
8  'qmp-event.c',
9  'qmp-registry.c',
10  'qobject-input-visitor.c',
11  'qobject-output-visitor.c',
12  'string-input-visitor.c',
13  'string-output-visitor.c',
14))
15
16qapi_all_modules = [
17  'audio',
18  'authz',
19  'block-core',
20  'block',
21  'char',
22  'common',
23  'control',
24  'crypto',
25  'dump',
26  'error',
27  'introspect',
28  'job',
29  'machine',
30  'machine-target',
31  'migration',
32  'misc',
33  'misc-target',
34  'net',
35  'pragma',
36  'qdev',
37  'qom',
38  'rdma',
39  'rocker',
40  'run-state',
41  'sockets',
42  'tpm',
43  'trace',
44  'transaction',
45  'ui',
46]
47
48qapi_storage_daemon_modules = [
49  'block-core',
50  'char',
51  'common',
52  'control',
53  'crypto',
54  'introspect',
55  'job',
56  'qom',
57  'sockets',
58  'pragma',
59  'transaction',
60]
61
62qapi_nonmodule_outputs = [
63  'qapi-introspect.c', 'qapi-introspect.h',
64  'qapi-types.c', 'qapi-types.h',
65  'qapi-visit.h', 'qapi-visit.c',
66  'qapi-commands.h', 'qapi-commands.c',
67  'qapi-init-commands.h', 'qapi-init-commands.c',
68  'qapi-events.h', 'qapi-events.c',
69  'qapi-emit-events.c', 'qapi-emit-events.h',
70]
71
72# First build all sources
73qapi_util_outputs = [
74  'qapi-builtin-types.c', 'qapi-builtin-visit.c',
75  'qapi-builtin-types.h', 'qapi-builtin-visit.h',
76]
77
78qapi_inputs = []
79qapi_specific_outputs = []
80foreach module : qapi_all_modules
81  qapi_inputs += [ files(module + '.json') ]
82  qapi_module_outputs = [
83    'qapi-types-@0@.c'.format(module),
84    'qapi-types-@0@.h'.format(module),
85    'qapi-visit-@0@.c'.format(module),
86    'qapi-visit-@0@.h'.format(module),
87    'qapi-events-@0@.c'.format(module),
88    'qapi-events-@0@.h'.format(module),
89    'qapi-commands-@0@.c'.format(module),
90    'qapi-commands-@0@.h'.format(module),
91  ]
92  if module.endswith('-target')
93    qapi_specific_outputs += qapi_module_outputs
94  else
95    qapi_util_outputs += qapi_module_outputs
96  endif
97endforeach
98
99qapi_files = custom_target('shared QAPI source files',
100  output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs + ['qapi-doc.texi'],
101  input: [ files('qapi-schema.json') ],
102  command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
103  depend_files: [ qapi_inputs, qapi_gen_depends ])
104
105# Now go through all the outputs and add them to the right sourceset.
106# These loops must be synchronized with the output of the above custom target.
107
108i = 0
109foreach output : qapi_util_outputs
110  if output.endswith('.h')
111    genh += qapi_files[i]
112  endif
113  util_ss.add(qapi_files[i])
114  i = i + 1
115endforeach
116
117foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
118  if output.endswith('.h')
119    genh += qapi_files[i]
120  endif
121  specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i])
122  i = i + 1
123endforeach
124
125qapi_doc_texi = qapi_files[i]
126