rust: build: restrict --cfg generation to only required symbols

Parse the Cargo.toml file, looking for the unexpected_cfgs
configuration.  When generating --cfg options from the
config-host.h file, only use those that are included in the
configuration.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2024-11-06 11:25:55 +01:00
parent f3a6e9bc47
commit 1de82059aa
2 changed files with 46 additions and 17 deletions

View file

@ -1,5 +1,5 @@
_qemu_api_cfg = run_command(rustc_args,
'--config-headers', config_host_h,
'--config-headers', config_host_h, files('Cargo.toml'),
capture: true, check: true).stdout().strip().split()
# _qemu_api_cfg += ['--cfg', 'feature="allocator"']