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