Revisão | b83a80e831137d57eadd3b91b74d06bf9d4a3f36 (tree) |
---|---|
Hora | 2022-01-27 19:26:40 |
Autor | Vladimir Sementsov-Ogievskiy <vsementsov@virt...> |
Commiter | Markus Armbruster |
meson: generate trace events for qmp commands
1. Use --gen-trace when generate qmp commands
2. Add corresponding .trace-events files as outputs in qapi_files
3. Define global qapi_trace_events list of .trace-events file targets,
4. In trace/meson.build use the new array as an additional source of
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220126161130.3240892-5-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
@@ -41,6 +41,7 @@ qemu_icondir = get_option('datadir') / 'icons' | ||
41 | 41 | |
42 | 42 | config_host_data = configuration_data() |
43 | 43 | genh = [] |
44 | +qapi_trace_events = [] | |
44 | 45 | |
45 | 46 | target_dirs = config_host['TARGET_DIRS'].split() |
46 | 47 | have_linux_user = false |
@@ -2557,6 +2558,8 @@ if 'CONFIG_VHOST_USER' in config_host | ||
2557 | 2558 | vhost_user = libvhost_user.get_variable('vhost_user_dep') |
2558 | 2559 | endif |
2559 | 2560 | |
2561 | +# NOTE: the trace/ subdirectory needs the qapi_trace_events variable | |
2562 | +# that is filled in by qapi/. | |
2560 | 2563 | subdir('qapi') |
2561 | 2564 | subdir('qobject') |
2562 | 2565 | subdir('stubs') |
@@ -114,6 +114,7 @@ foreach module : qapi_all_modules | ||
114 | 114 | 'qapi-events-@0@.h'.format(module), |
115 | 115 | 'qapi-commands-@0@.c'.format(module), |
116 | 116 | 'qapi-commands-@0@.h'.format(module), |
117 | + 'qapi-commands-@0@.trace-events'.format(module), | |
117 | 118 | ] |
118 | 119 | endif |
119 | 120 | if module.endswith('-target') |
@@ -126,7 +127,7 @@ endforeach | ||
126 | 127 | qapi_files = custom_target('shared QAPI source files', |
127 | 128 | output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs, |
128 | 129 | input: [ files('qapi-schema.json') ], |
129 | - command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ], | |
130 | + command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@', '--gen-trace' ], | |
130 | 131 | depend_files: [ qapi_inputs, qapi_gen_depends ]) |
131 | 132 | |
132 | 133 | # Now go through all the outputs and add them to the right sourceset. |
@@ -137,6 +138,9 @@ foreach output : qapi_util_outputs | ||
137 | 138 | if output.endswith('.h') |
138 | 139 | genh += qapi_files[i] |
139 | 140 | endif |
141 | + if output.endswith('.trace-events') | |
142 | + qapi_trace_events += qapi_files[i] | |
143 | + endif | |
140 | 144 | util_ss.add(qapi_files[i]) |
141 | 145 | i = i + 1 |
142 | 146 | endforeach |
@@ -145,6 +149,9 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs | ||
145 | 149 | if output.endswith('.h') |
146 | 150 | genh += qapi_files[i] |
147 | 151 | endif |
152 | + if output.endswith('.trace-events') | |
153 | + qapi_trace_events += qapi_files[i] | |
154 | + endif | |
148 | 155 | specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i]) |
149 | 156 | i = i + 1 |
150 | 157 | endforeach |
@@ -2,10 +2,15 @@ | ||
2 | 2 | specific_ss.add(files('control-target.c')) |
3 | 3 | |
4 | 4 | trace_events_files = [] |
5 | -foreach dir : [ '.' ] + trace_events_subdirs | |
6 | - trace_events_file = meson.project_source_root() / dir / 'trace-events' | |
5 | +foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events | |
6 | + if item in qapi_trace_events | |
7 | + trace_events_file = item | |
8 | + group_name = item.full_path().split('/')[-1].underscorify() | |
9 | + else | |
10 | + trace_events_file = meson.project_source_root() / item / 'trace-events' | |
11 | + group_name = item == '.' ? 'root' : item.underscorify() | |
12 | + endif | |
7 | 13 | trace_events_files += [ trace_events_file ] |
8 | - group_name = dir == '.' ? 'root' : dir.underscorify() | |
9 | 14 | group = '--group=' + group_name |
10 | 15 | fmt = '@0@-' + group_name + '.@1@' |
11 | 16 |