qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC v3 25/32] qga/rust: build a qga-cabi-rs executable (ABI from Rust)


From: marcandre . lureau
Subject: [RFC v3 25/32] qga/rust: build a qga-cabi-rs executable (ABI from Rust)
Date: Tue, 7 Sep 2021 16:19:36 +0400

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qga/Cargo.toml   |  5 +++++
 qga/meson.build  | 15 +++++++++++++++
 qga/qapi-cabi.rs |  6 ++++++
 3 files changed, 26 insertions(+)
 create mode 100644 qga/qapi-cabi.rs

diff --git a/qga/Cargo.toml b/qga/Cargo.toml
index 807acc947e..d262b847fa 100644
--- a/qga/Cargo.toml
+++ b/qga/Cargo.toml
@@ -10,3 +10,8 @@ common = { path = "../rust/common" }
 [lib]
 path = "lib.rs"
 crate-type = ["staticlib"]
+
+[[bin]]
+name = "qapi-cabi-rs"
+path = "qapi-cabi.rs"
+doc = false
diff --git a/qga/meson.build b/qga/meson.build
index 88d59bef0c..fd840f5c73 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -81,6 +81,21 @@ if with_rust
   qga_rs = declare_dependency(
     link_args: '@' + cargo_qga[0].full_path(),
     sources: cargo_qga)
+
+  cargo_qga_cabi = custom_target('qga-qapi-cabi-rs',
+                                 output: ['qapi-cabi-rs' + exe_suffix],
+                                 build_always_stale: true,
+                                 depends: [qapi_gen_rs_files],
+                                 command: [cargo_wrapper,
+                                           meson.current_build_dir(),
+                                           meson.current_source_dir(),
+                                           meson.build_root(),
+                                           rs_build_type,
+                                           rust_target_triple,
+                                           'build-bin',
+                                           'qapi-cabi-rs',
+                                           '--', '--cfg', 'QAPI_CABI'])
+
 endif
 
 qga = executable('qemu-ga', qga_ss.sources(),
diff --git a/qga/qapi-cabi.rs b/qga/qapi-cabi.rs
new file mode 100644
index 0000000000..d98a819ef7
--- /dev/null
+++ b/qga/qapi-cabi.rs
@@ -0,0 +1,6 @@
+pub use common::{err, Error, Result};
+mod qapi_ffi;
+
+fn main() {
+    qapi_ffi::cabi()
+}
-- 
2.33.0.113.g6c40894d24




reply via email to

[Prev in Thread] Current Thread [Next in Thread]