qemu/subprojects/packagefiles/foreign-0.3-rs/meson.build
Paolo Bonzini bfe0f6b02a subprojects: add the foreign crate
This is a cleaned up and separated version of the patches at
https://lore.kernel.org/all/20240701145853.1394967-4-pbonzini@redhat.com/
https://lore.kernel.org/all/20240701145853.1394967-5-pbonzini@redhat.com/

Its first user will be the Error bindings; for example a QEMU Error ** can be
converted to a Rust Option using

     unsafe { Option::<Error>::from_foreign(c_error) }

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-05 20:24:51 +02:00

26 lines
598 B
Meson

project('foreign-0.3-rs', 'rust',
meson_version: '>=1.5.0',
version: '0.2.0',
license: 'MIT OR Apache-2.0',
default_options: [])
subproject('libc-0.2-rs', required: true)
libc_rs = dependency('libc-0.2-rs')
_foreign_rs = static_library(
'foreign',
files('src/lib.rs'),
gnu_symbol_visibility: 'hidden',
override_options: ['rust_std=2021', 'build.rust_std=2021'],
rust_abi: 'rust',
rust_args: [
'--cap-lints', 'allow',
],
dependencies: [libc_rs],
)
foreign_dep = declare_dependency(
link_with: _foreign_rs,
)
meson.override_dependency('foreign-0.3-rs', foreign_dep)