]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/meson.build
Merge tag 'pull-riscv-to-apply-20230306' of https://gitlab.com/palmer-dabbelt/qemu...
[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',
34 'dump',
35 'error',
36 'introspect',
37 'job',
38 'machine',
39 'machine-target',
40 'migration',
41 'misc',
42 'misc-target',
43 'net',
44 'pragma',
a81df1b6 45 'qom',
43d7e1d7 46 'replay',
a81df1b6
PB
47 'run-state',
48 'sockets',
b9f88dc0 49 'stats',
a81df1b6
PB
50 'trace',
51 'transaction',
a5ebce38 52 'virtio',
50186051 53 'yank',
a81df1b6 54]
9b45a025
PMD
55if have_system
56 qapi_all_modules += [
7fdb383d
PMD
57 'acpi',
58 'audio',
9b45a025 59 'qdev',
7fdb383d
PMD
60 'pci',
61 'rdma',
62 'rocker',
63 'tpm',
9b45a025
PMD
64 ]
65endif
c2651c0e
PMD
66if have_system or have_tools
67 qapi_all_modules += [
68 'ui',
69 ]
70endif
a81df1b6 71
a81df1b6
PB
72qapi_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
83qapi_util_outputs = [
84 'qapi-builtin-types.c', 'qapi-builtin-visit.c',
85 'qapi-builtin-types.h', 'qapi-builtin-visit.h',
86]
87
88qapi_inputs = []
89qapi_specific_outputs = []
90foreach 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),
a81df1b6 97 ]
a0e61807
PMD
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),
b83a80e8 104 'qapi-commands-@0@.trace-events'.format(module),
a0e61807
PMD
105 ]
106 endif
a81df1b6
PB
107 if module.endswith('-target')
108 qapi_specific_outputs += qapi_module_outputs
109 else
110 qapi_util_outputs += qapi_module_outputs
111 endif
112endforeach
113
114qapi_files = custom_target('shared QAPI source files',
4ac2ee19 115 output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs,
a81df1b6 116 input: [ files('qapi-schema.json') ],
761a1a48 117 command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
a81df1b6
PB
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
123i = 0
124foreach output : qapi_util_outputs
125 if output.endswith('.h')
126 genh += qapi_files[i]
127 endif
b83a80e8
VSO
128 if output.endswith('.trace-events')
129 qapi_trace_events += qapi_files[i]
130 endif
a81df1b6
PB
131 util_ss.add(qapi_files[i])
132 i = i + 1
133endforeach
134
5242523b
MAL
135foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
136 if output.endswith('.h')
137 genh += qapi_files[i]
138 endif
b83a80e8
VSO
139 if output.endswith('.trace-events')
140 qapi_trace_events += qapi_files[i]
141 endif
5242523b
MAL
142 specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i])
143 i = i + 1
144endforeach