Move raw FFI bindings generation to separate crates. This makes it possible to reuse bindgen declarations for a header file in its dependencies (this was not the case before this change), while keeping multiple -sys crates to avoid rebuilding all the code whenever something changes. Because the -sys crates are generated in dependency order, this also enforces that the crates are organized in something that resembles the dependencies between C headers. The meson.build for rust-safe crates becomes simpler, and it should be possible in the future to let Meson's cargo support handle most of it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> [General cleanup and Python script. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
26 lines
796 B
Meson
26 lines
796 B
Meson
_bql_cfg = run_command(rustc_args,
|
|
'--config-headers', config_host_h, '--features', files('Cargo.toml'),
|
|
capture: true, check: true).stdout().strip().splitlines()
|
|
|
|
if get_option('debug_mutex')
|
|
_bql_cfg += ['--cfg', 'feature="debug_cell"']
|
|
endif
|
|
|
|
_bql_rs = static_library(
|
|
'bql',
|
|
'src/lib.rs',
|
|
rust_args: _bql_cfg,
|
|
dependencies: [glib_sys_rs, util_sys_rs],
|
|
)
|
|
|
|
bql_rs = declare_dependency(link_with: [_bql_rs],
|
|
dependencies: [qemuutil])
|
|
|
|
# Doctests are essentially integration tests, so they need the same dependencies.
|
|
# Note that running them requires the object files for C code, so place them
|
|
# in a separate suite that is run by the "build" CI jobs rather than "check".
|
|
rust.doctest('rust-bql-rs-doctests',
|
|
_bql_rs,
|
|
dependencies: bql_rs,
|
|
suite: ['doc', 'rust'])
|