mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
rust: allow using build-root bindings.rs from cargo
Right now, using cargo with QEMU requires copying by hand the bindings.rs to the source tree. Instead, we can use an include file to escape the cage of cargo's mandated source directory structure. By running cargo within meson's "devenv" and adding a MESON_BUILD_ROOT environment variable, it is easy for build.rs to find the file. However, the file must be symlinked into cargo's output directory for rust-analyzer to find it. Suggested-by: Junjie Mao <junjie.mao@hotmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
8c28667503
commit
cb7ada5409
8 changed files with 63 additions and 35 deletions
29
rust/qemu-api/src/bindings.rs
Normal file
29
rust/qemu-api/src/bindings.rs
Normal file
|
@ -0,0 +1,29 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#![allow(
|
||||
dead_code,
|
||||
improper_ctypes_definitions,
|
||||
improper_ctypes,
|
||||
non_camel_case_types,
|
||||
non_snake_case,
|
||||
non_upper_case_globals,
|
||||
unsafe_op_in_unsafe_fn,
|
||||
clippy::missing_const_for_fn,
|
||||
clippy::too_many_arguments,
|
||||
clippy::approx_constant,
|
||||
clippy::use_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::missing_safety_doc
|
||||
)]
|
||||
|
||||
#[cfg(MESON)]
|
||||
include!("bindings.inc.rs");
|
||||
|
||||
#[cfg(not(MESON))]
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.inc.rs"));
|
||||
|
||||
unsafe impl Send for Property {}
|
||||
unsafe impl Sync for Property {}
|
||||
unsafe impl Sync for TypeInfo {}
|
||||
unsafe impl Sync for VMStateDescription {}
|
||||
unsafe impl Sync for VMStateField {}
|
||||
unsafe impl Sync for VMStateInfo {}
|
|
@ -4,31 +4,9 @@
|
|||
|
||||
#![cfg_attr(not(MESON), doc = include_str!("../README.md"))]
|
||||
|
||||
#[allow(
|
||||
dead_code,
|
||||
improper_ctypes_definitions,
|
||||
improper_ctypes,
|
||||
non_camel_case_types,
|
||||
non_snake_case,
|
||||
non_upper_case_globals,
|
||||
unsafe_op_in_unsafe_fn,
|
||||
clippy::missing_const_for_fn,
|
||||
clippy::too_many_arguments,
|
||||
clippy::approx_constant,
|
||||
clippy::use_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::missing_safety_doc,
|
||||
)]
|
||||
#[rustfmt::skip]
|
||||
pub mod bindings;
|
||||
|
||||
unsafe impl Send for bindings::Property {}
|
||||
unsafe impl Sync for bindings::Property {}
|
||||
unsafe impl Sync for bindings::TypeInfo {}
|
||||
unsafe impl Sync for bindings::VMStateDescription {}
|
||||
unsafe impl Sync for bindings::VMStateField {}
|
||||
unsafe impl Sync for bindings::VMStateInfo {}
|
||||
|
||||
pub mod c_str;
|
||||
pub mod definitions;
|
||||
pub mod device_class;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue