From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>,
Laurent Vivier <laurent@vivier.eu>
Cc: "Markus Armbruster" <armbru@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [RFC PATCH-for-9.1] qapi: Do not generate commands/events/introspect code for user emulation
Date: Thu, 4 Apr 2024 21:55:43 +0200 [thread overview]
Message-ID: <20240404195543.9804-1-philmd@linaro.org> (raw)
User emulation requires the QAPI types. Due to the command
line processing, some visitor code is also used. The rest
is irrelevant (no QMP socket).
Add an option to the qapi-gen script to allow generating
the minimum when only user emulation is being built.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
RFC: Quick PoC for Markus. It is useful for user-only builds.
---
qapi/meson.build | 6 +++++-
scripts/qapi/main.py | 16 +++++++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/qapi/meson.build b/qapi/meson.build
index 375d564277..5e02621145 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -115,10 +115,14 @@ foreach module : qapi_all_modules
endif
endforeach
+qapi_gen_cmd = [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ]
+if not (have_system or have_tools)
+ qapi_gen_cmd += [ '--types-only' ]
+endif
qapi_files = custom_target('shared QAPI source files',
output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs,
input: [ files('qapi-schema.json') ],
- command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
+ command: qapi_gen_cmd,
depend_files: [ qapi_inputs, qapi_gen_depends ])
# Now go through all the outputs and add them to the right sourceset.
diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py
index 316736b6a2..925af5841b 100644
--- a/scripts/qapi/main.py
+++ b/scripts/qapi/main.py
@@ -33,7 +33,8 @@ def generate(schema_file: str,
prefix: str,
unmask: bool = False,
builtins: bool = False,
- gen_tracing: bool = False) -> None:
+ gen_tracing: bool = False,
+ gen_types_only: bool = False) -> None:
"""
Generate C code for the given schema into the target directory.
@@ -50,9 +51,10 @@ def generate(schema_file: str,
schema = QAPISchema(schema_file)
gen_types(schema, output_dir, prefix, builtins)
gen_visit(schema, output_dir, prefix, builtins)
- gen_commands(schema, output_dir, prefix, gen_tracing)
- gen_events(schema, output_dir, prefix)
- gen_introspect(schema, output_dir, prefix, unmask)
+ if not gen_types_only:
+ gen_commands(schema, output_dir, prefix, gen_tracing)
+ gen_events(schema, output_dir, prefix)
+ gen_introspect(schema, output_dir, prefix, unmask)
def main() -> int:
@@ -75,6 +77,9 @@ def main() -> int:
parser.add_argument('-u', '--unmask-non-abi-names', action='store_true',
dest='unmask',
help="expose non-ABI names in introspection")
+ parser.add_argument('-t', '--types-only', action='store_true',
+ dest='gen_types_only',
+ help="Only generate QAPI types")
# Option --suppress-tracing exists so we can avoid solving build system
# problems. TODO Drop it when we no longer need it.
@@ -96,7 +101,8 @@ def main() -> int:
prefix=args.prefix,
unmask=args.unmask,
builtins=args.builtins,
- gen_tracing=not args.suppress_tracing)
+ gen_tracing=not args.suppress_tracing,
+ gen_types_only=args.gen_types_only)
except QAPIError as err:
print(err, file=sys.stderr)
return 1
--
2.41.0
next reply other threads:[~2024-04-04 19:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 19:55 Philippe Mathieu-Daudé [this message]
2024-04-05 5:35 ` [RFC PATCH-for-9.1] qapi: Do not generate commands/events/introspect code for user emulation Markus Armbruster
2024-04-05 8:43 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240404195543.9804-1-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=laurent@vivier.eu \
--cc=michael.roth@amd.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).