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