1util_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)) 13if have_system 14 util_ss.add(files('qapi-type-helpers.c')) 15endif 16if have_system or have_tools 17 util_ss.add(files( 18 'qmp-dispatch.c', 19 'qmp-event.c', 20 'qmp-registry.c', 21 )) 22endif 23 24qapi_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 'yank', 53] 54if have_system 55 qapi_all_modules += [ 56 'acpi', 57 'audio', 58 'qdev', 59 'pci', 60 'rdma', 61 'rocker', 62 'tpm', 63 ] 64endif 65if have_system or have_tools 66 qapi_all_modules += [ 67 'ui', 68 ] 69endif 70 71qapi_nonmodule_outputs = [ 72 'qapi-introspect.c', 'qapi-introspect.h', 73 'qapi-types.c', 'qapi-types.h', 74 'qapi-visit.h', 'qapi-visit.c', 75 'qapi-commands.h', 'qapi-commands.c', 76 'qapi-init-commands.h', 'qapi-init-commands.c', 77 'qapi-events.h', 'qapi-events.c', 78 'qapi-emit-events.c', 'qapi-emit-events.h', 79] 80 81# First build all sources 82qapi_util_outputs = [ 83 'qapi-builtin-types.c', 'qapi-builtin-visit.c', 84 'qapi-builtin-types.h', 'qapi-builtin-visit.h', 85] 86 87qapi_inputs = [] 88qapi_specific_outputs = [] 89foreach module : qapi_all_modules 90 qapi_inputs += [ files(module + '.json') ] 91 qapi_module_outputs = [ 92 'qapi-types-@0@.c'.format(module), 93 'qapi-types-@0@.h'.format(module), 94 'qapi-visit-@0@.c'.format(module), 95 'qapi-visit-@0@.h'.format(module), 96 ] 97 if have_system or have_tools 98 qapi_module_outputs += [ 99 'qapi-events-@0@.c'.format(module), 100 'qapi-events-@0@.h'.format(module), 101 'qapi-commands-@0@.c'.format(module), 102 'qapi-commands-@0@.h'.format(module), 103 'qapi-commands-@0@.trace-events'.format(module), 104 ] 105 endif 106 if module.endswith('-target') 107 qapi_specific_outputs += qapi_module_outputs 108 else 109 qapi_util_outputs += qapi_module_outputs 110 endif 111endforeach 112 113qapi_files = custom_target('shared QAPI source files', 114 output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs, 115 input: [ files('qapi-schema.json') ], 116 command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ], 117 depend_files: [ qapi_inputs, qapi_gen_depends ]) 118 119# Now go through all the outputs and add them to the right sourceset. 120# These loops must be synchronized with the output of the above custom target. 121 122i = 0 123foreach output : qapi_util_outputs 124 if output.endswith('.h') 125 genh += qapi_files[i] 126 endif 127 if output.endswith('.trace-events') 128 qapi_trace_events += qapi_files[i] 129 endif 130 util_ss.add(qapi_files[i]) 131 i = i + 1 132endforeach 133 134foreach output : qapi_specific_outputs + qapi_nonmodule_outputs 135 if output.endswith('.h') 136 genh += qapi_files[i] 137 endif 138 if output.endswith('.trace-events') 139 qapi_trace_events += qapi_files[i] 140 endif 141 specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i]) 142 i = i + 1 143endforeach 144