Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 1 | util_ss.add(files( |
| 2 | 'opts-visitor.c', |
| 3 | 'qapi-clone-visitor.c', |
| 4 | 'qapi-dealloc-visitor.c', |
Paolo Bonzini | 18fa3eb | 2021-07-18 08:49:22 +0200 | [diff] [blame] | 5 | 'qapi-forward-visitor.c', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 6 | 'qapi-util.c', |
| 7 | 'qapi-visit-core.c', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 8 | 'qobject-input-visitor.c', |
| 9 | 'qobject-output-visitor.c', |
| 10 | 'string-input-visitor.c', |
| 11 | 'string-output-visitor.c', |
| 12 | )) |
Daniel P. Berrangé | f9429c6 | 2021-10-08 15:09:00 +0100 | [diff] [blame] | 13 | if have_system |
| 14 | util_ss.add(files('qapi-type-helpers.c')) |
| 15 | endif |
Philippe Mathieu-Daudé | 1935e0e | 2021-01-22 21:44:39 +0100 | [diff] [blame] | 16 | if have_system or have_tools |
| 17 | util_ss.add(files( |
| 18 | 'qmp-dispatch.c', |
| 19 | 'qmp-event.c', |
| 20 | 'qmp-registry.c', |
| 21 | )) |
| 22 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 23 | |
| 24 | qapi_all_modules = [ |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 25 | 'authz', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 26 | 'block', |
Kevin Wolf | 5daa6bf | 2020-09-24 17:26:48 +0200 | [diff] [blame] | 27 | 'block-core', |
| 28 | 'block-export', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 29 | 'char', |
| 30 | 'common', |
Markus Armbruster | 6dd7547 | 2021-03-18 16:55:10 +0100 | [diff] [blame] | 31 | 'compat', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 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', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 45 | 'qom', |
Pavel Dovgalyuk | 43d7e1d | 2020-10-03 20:13:14 +0300 | [diff] [blame] | 46 | 'replay', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 47 | 'run-state', |
| 48 | 'sockets', |
Mark Kanda | b9f88dc | 2022-02-15 09:04:31 -0600 | [diff] [blame] | 49 | 'stats', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 50 | 'trace', |
| 51 | 'transaction', |
Lukas Straub | 5018605 | 2020-12-28 16:08:41 +0100 | [diff] [blame] | 52 | 'yank', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 53 | ] |
Philippe Mathieu-Daudé | 9b45a02 | 2021-01-22 21:44:38 +0100 | [diff] [blame] | 54 | if have_system |
| 55 | qapi_all_modules += [ |
Philippe Mathieu-Daudé | 7fdb383 | 2021-01-22 21:44:40 +0100 | [diff] [blame] | 56 | 'acpi', |
| 57 | 'audio', |
Philippe Mathieu-Daudé | 9b45a02 | 2021-01-22 21:44:38 +0100 | [diff] [blame] | 58 | 'qdev', |
Philippe Mathieu-Daudé | 7fdb383 | 2021-01-22 21:44:40 +0100 | [diff] [blame] | 59 | 'pci', |
| 60 | 'rdma', |
| 61 | 'rocker', |
| 62 | 'tpm', |
Philippe Mathieu-Daudé | 9b45a02 | 2021-01-22 21:44:38 +0100 | [diff] [blame] | 63 | ] |
| 64 | endif |
Philippe Mathieu-Daudé | c2651c0 | 2021-01-22 21:44:41 +0100 | [diff] [blame] | 65 | if have_system or have_tools |
| 66 | qapi_all_modules += [ |
| 67 | 'ui', |
| 68 | ] |
| 69 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 70 | |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 71 | qapi_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 |
| 82 | qapi_util_outputs = [ |
| 83 | 'qapi-builtin-types.c', 'qapi-builtin-visit.c', |
| 84 | 'qapi-builtin-types.h', 'qapi-builtin-visit.h', |
| 85 | ] |
| 86 | |
| 87 | qapi_inputs = [] |
| 88 | qapi_specific_outputs = [] |
| 89 | foreach 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), |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 96 | ] |
Philippe Mathieu-Daudé | a0e6180 | 2021-02-24 18:16:42 +0100 | [diff] [blame] | 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), |
Vladimir Sementsov-Ogievskiy | b83a80e | 2022-01-26 17:11:27 +0100 | [diff] [blame] | 103 | 'qapi-commands-@0@.trace-events'.format(module), |
Philippe Mathieu-Daudé | a0e6180 | 2021-02-24 18:16:42 +0100 | [diff] [blame] | 104 | ] |
| 105 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 106 | if module.endswith('-target') |
| 107 | qapi_specific_outputs += qapi_module_outputs |
| 108 | else |
| 109 | qapi_util_outputs += qapi_module_outputs |
| 110 | endif |
| 111 | endforeach |
| 112 | |
| 113 | qapi_files = custom_target('shared QAPI source files', |
Peter Maydell | 4ac2ee1 | 2020-09-25 17:23:04 +0100 | [diff] [blame] | 114 | output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs, |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 115 | input: [ files('qapi-schema.json') ], |
Vladimir Sementsov-Ogievskiy | 761a1a4 | 2022-01-26 17:11:30 +0100 | [diff] [blame] | 116 | command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ], |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 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 | |
| 122 | i = 0 |
| 123 | foreach output : qapi_util_outputs |
| 124 | if output.endswith('.h') |
| 125 | genh += qapi_files[i] |
| 126 | endif |
Vladimir Sementsov-Ogievskiy | b83a80e | 2022-01-26 17:11:27 +0100 | [diff] [blame] | 127 | if output.endswith('.trace-events') |
| 128 | qapi_trace_events += qapi_files[i] |
| 129 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 130 | util_ss.add(qapi_files[i]) |
| 131 | i = i + 1 |
| 132 | endforeach |
| 133 | |
Marc-André Lureau | 5242523 | 2019-08-15 12:01:26 +0400 | [diff] [blame] | 134 | foreach output : qapi_specific_outputs + qapi_nonmodule_outputs |
| 135 | if output.endswith('.h') |
| 136 | genh += qapi_files[i] |
| 137 | endif |
Vladimir Sementsov-Ogievskiy | b83a80e | 2022-01-26 17:11:27 +0100 | [diff] [blame] | 138 | if output.endswith('.trace-events') |
| 139 | qapi_trace_events += qapi_files[i] |
| 140 | endif |
Marc-André Lureau | 5242523 | 2019-08-15 12:01:26 +0400 | [diff] [blame] | 141 | specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i]) |
| 142 | i = i + 1 |
| 143 | endforeach |