95e82f9b38
A working native Rust compiler is always needed in order to compile Rust code, even when cross compiling, in order to build the procedural macros that QEMU uses. Right now, the check is done in rust/qemu-api-macros/meson.build, but this has two disadvantages. First, it makes the build fail when the Meson "rust" option is set to "auto" (instead, Rust support should be disabled). Second, add_languages() is one of the few functions that are executed even by "meson introspect", except that "meson introspect" executes both branches of "if" statements! Therefore, "meson introspect" tries to look for a Rust compiler even if the option is disabled---and then fails because the compiler is required by rust/qemu-api-macros/meson.build. This is visible for example if the compilation host has a stale scripts/meson-buildoptions.sh and no rustc installed. Both issues can be fixed by moving the check to the main meson.build, together with the check for the cross compiler. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24 lines
588 B
Meson
24 lines
588 B
Meson
quote_dep = dependency('quote-1-rs', native: true)
|
|
syn_dep = dependency('syn-2-rs', native: true)
|
|
proc_macro2_dep = dependency('proc-macro2-1-rs', native: true)
|
|
|
|
_qemu_api_macros_rs = import('rust').proc_macro(
|
|
'qemu_api_macros',
|
|
files('src/lib.rs'),
|
|
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
|
rust_args: [
|
|
'--cfg', 'use_fallback',
|
|
'--cfg', 'feature="syn-error"',
|
|
'--cfg', 'feature="proc-macro"',
|
|
],
|
|
dependencies: [
|
|
proc_macro2_dep,
|
|
quote_dep,
|
|
syn_dep,
|
|
],
|
|
)
|
|
|
|
qemu_api_macros = declare_dependency(
|
|
link_with: _qemu_api_macros_rs,
|
|
)
|