rust: build: move rustc_args.py invocation to qemu-api crate

Only qemu-api needs access to the symbols in config-host.h.  Remove
the temptation to use them elsewhere by limiting the --cfg arguments to
the qemu-api crate.

Per-crate invocation of the script will also be needed to add --check-cfg
options for each crate's features (when more complex, build-time
configurable devices are added in the future).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2024-11-12 11:54:11 +01:00
parent cb7ada5409
commit f3a6e9bc47
2 changed files with 29 additions and 32 deletions

View file

@ -1,4 +1,7 @@
_qemu_api_cfg = []
_qemu_api_cfg = run_command(rustc_args,
'--config-headers', config_host_h,
capture: true, check: true).stdout().strip().split()
# _qemu_api_cfg += ['--cfg', 'feature="allocator"']
if rustc.version().version_compare('>=1.77.0')
_qemu_api_cfg += ['--cfg', 'has_offset_of']