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