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