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 |
Thomas Huth | e009113 | 2022-11-10 09:36:26 +0100 | [diff] [blame] | 16 | if have_system or have_tools or have_ga |
Philippe Mathieu-Daudé | 1935e0e | 2021-01-22 21:44:39 +0100 | [diff] [blame] | 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', |
Jonathan Cameron | 415442a | 2023-03-02 13:37:09 +0000 | [diff] [blame] | 34 | 'cxl', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 35 | 'dump', |
Andrew Melnychenko | e88899f | 2024-03-12 18:57:57 +0800 | [diff] [blame] | 36 | 'ebpf', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 37 | 'error', |
| 38 | 'introspect', |
| 39 | 'job', |
Pierre Morel | 5de1aff | 2023-10-16 20:39:06 +0200 | [diff] [blame] | 40 | 'machine-common', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 41 | 'machine', |
| 42 | 'machine-target', |
| 43 | 'migration', |
| 44 | 'misc', |
| 45 | 'misc-target', |
| 46 | 'net', |
| 47 | 'pragma', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 48 | 'qom', |
Pavel Dovgalyuk | 43d7e1d | 2020-10-03 20:13:14 +0300 | [diff] [blame] | 49 | 'replay', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 50 | 'run-state', |
| 51 | 'sockets', |
Mark Kanda | b9f88dc | 2022-02-15 09:04:31 -0600 | [diff] [blame] | 52 | 'stats', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 53 | 'trace', |
| 54 | 'transaction', |
Avihai Horon | a0359b5 | 2024-05-15 16:21:35 +0300 | [diff] [blame] | 55 | 'vfio', |
Laurent Vivier | a5ebce3 | 2022-08-11 08:24:39 -0400 | [diff] [blame] | 56 | 'virtio', |
Lukas Straub | 5018605 | 2020-12-28 16:08:41 +0100 | [diff] [blame] | 57 | 'yank', |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 58 | ] |
Philippe Mathieu-Daudé | 9b45a02 | 2021-01-22 21:44:38 +0100 | [diff] [blame] | 59 | if have_system |
| 60 | qapi_all_modules += [ |
Philippe Mathieu-Daudé | 7fdb383 | 2021-01-22 21:44:40 +0100 | [diff] [blame] | 61 | 'acpi', |
| 62 | 'audio', |
zhenwei pi | 14c9fd1 | 2023-03-01 18:58:36 +0800 | [diff] [blame] | 63 | 'cryptodev', |
Philippe Mathieu-Daudé | 9b45a02 | 2021-01-22 21:44:38 +0100 | [diff] [blame] | 64 | 'qdev', |
Philippe Mathieu-Daudé | 7fdb383 | 2021-01-22 21:44:40 +0100 | [diff] [blame] | 65 | 'pci', |
Philippe Mathieu-Daudé | 7fdb383 | 2021-01-22 21:44:40 +0100 | [diff] [blame] | 66 | 'rocker', |
| 67 | 'tpm', |
Philippe Mathieu-Daudé | 9b45a02 | 2021-01-22 21:44:38 +0100 | [diff] [blame] | 68 | ] |
| 69 | endif |
Philippe Mathieu-Daudé | c2651c0 | 2021-01-22 21:44:41 +0100 | [diff] [blame] | 70 | if have_system or have_tools |
| 71 | qapi_all_modules += [ |
| 72 | 'ui', |
| 73 | ] |
| 74 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 75 | |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 76 | qapi_nonmodule_outputs = [ |
| 77 | 'qapi-introspect.c', 'qapi-introspect.h', |
| 78 | 'qapi-types.c', 'qapi-types.h', |
| 79 | 'qapi-visit.h', 'qapi-visit.c', |
| 80 | 'qapi-commands.h', 'qapi-commands.c', |
| 81 | 'qapi-init-commands.h', 'qapi-init-commands.c', |
| 82 | 'qapi-events.h', 'qapi-events.c', |
| 83 | 'qapi-emit-events.c', 'qapi-emit-events.h', |
| 84 | ] |
| 85 | |
| 86 | # First build all sources |
| 87 | qapi_util_outputs = [ |
| 88 | 'qapi-builtin-types.c', 'qapi-builtin-visit.c', |
| 89 | 'qapi-builtin-types.h', 'qapi-builtin-visit.h', |
| 90 | ] |
| 91 | |
| 92 | qapi_inputs = [] |
| 93 | qapi_specific_outputs = [] |
| 94 | foreach module : qapi_all_modules |
| 95 | qapi_inputs += [ files(module + '.json') ] |
| 96 | qapi_module_outputs = [ |
| 97 | 'qapi-types-@0@.c'.format(module), |
| 98 | 'qapi-types-@0@.h'.format(module), |
| 99 | 'qapi-visit-@0@.c'.format(module), |
| 100 | 'qapi-visit-@0@.h'.format(module), |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 101 | ] |
Philippe Mathieu-Daudé | a0e6180 | 2021-02-24 18:16:42 +0100 | [diff] [blame] | 102 | if have_system or have_tools |
| 103 | qapi_module_outputs += [ |
| 104 | 'qapi-events-@0@.c'.format(module), |
| 105 | 'qapi-events-@0@.h'.format(module), |
| 106 | 'qapi-commands-@0@.c'.format(module), |
| 107 | 'qapi-commands-@0@.h'.format(module), |
Vladimir Sementsov-Ogievskiy | b83a80e | 2022-01-26 17:11:27 +0100 | [diff] [blame] | 108 | 'qapi-commands-@0@.trace-events'.format(module), |
Philippe Mathieu-Daudé | a0e6180 | 2021-02-24 18:16:42 +0100 | [diff] [blame] | 109 | ] |
| 110 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 111 | if module.endswith('-target') |
| 112 | qapi_specific_outputs += qapi_module_outputs |
| 113 | else |
| 114 | qapi_util_outputs += qapi_module_outputs |
| 115 | endif |
| 116 | endforeach |
| 117 | |
| 118 | qapi_files = custom_target('shared QAPI source files', |
Peter Maydell | 4ac2ee1 | 2020-09-25 17:23:04 +0100 | [diff] [blame] | 119 | output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs, |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 120 | input: [ files('qapi-schema.json') ], |
Vladimir Sementsov-Ogievskiy | 761a1a4 | 2022-01-26 17:11:30 +0100 | [diff] [blame] | 121 | command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ], |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 122 | depend_files: [ qapi_inputs, qapi_gen_depends ]) |
| 123 | |
| 124 | # Now go through all the outputs and add them to the right sourceset. |
| 125 | # These loops must be synchronized with the output of the above custom target. |
| 126 | |
| 127 | i = 0 |
| 128 | foreach output : qapi_util_outputs |
| 129 | if output.endswith('.h') |
| 130 | genh += qapi_files[i] |
| 131 | endif |
Vladimir Sementsov-Ogievskiy | b83a80e | 2022-01-26 17:11:27 +0100 | [diff] [blame] | 132 | if output.endswith('.trace-events') |
| 133 | qapi_trace_events += qapi_files[i] |
| 134 | endif |
Paolo Bonzini | a81df1b | 2020-08-19 08:44:56 -0400 | [diff] [blame] | 135 | util_ss.add(qapi_files[i]) |
| 136 | i = i + 1 |
| 137 | endforeach |
| 138 | |
Marc-André Lureau | 5242523 | 2019-08-15 12:01:26 +0400 | [diff] [blame] | 139 | foreach output : qapi_specific_outputs + qapi_nonmodule_outputs |
| 140 | if output.endswith('.h') |
| 141 | genh += qapi_files[i] |
| 142 | endif |
Vladimir Sementsov-Ogievskiy | b83a80e | 2022-01-26 17:11:27 +0100 | [diff] [blame] | 143 | if output.endswith('.trace-events') |
| 144 | qapi_trace_events += qapi_files[i] |
| 145 | endif |
Philippe Mathieu-Daudé | c7b6494 | 2023-06-13 15:33:46 +0200 | [diff] [blame] | 146 | specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: qapi_files[i]) |
Marc-André Lureau | 5242523 | 2019-08-15 12:01:26 +0400 | [diff] [blame] | 147 | i = i + 1 |
| 148 | endforeach |