xref: /openbmc/qemu/rust/qemu-api/meson.build (revision 6e50bde1)
1_qemu_api_rs = static_library(
2  'qemu_api',
3  structured_sources(
4    [
5      'src/lib.rs',
6      'src/definitions.rs',
7      'src/device_class.rs',
8      'src/zeroable.rs',
9    ],
10    {'.' : bindings_rs},
11  ),
12  override_options: ['rust_std=2021', 'build.rust_std=2021'],
13  rust_abi: 'rust',
14  rust_args: [
15    '--cfg', 'MESON',
16    # '--cfg', 'feature="allocator"',
17  ],
18)
19
20qemu_api = declare_dependency(
21  link_with: _qemu_api_rs,
22  dependencies: qemu_api_macros,
23)
24
25# Rust executables do not support objects, so add an intermediate step.
26rust_qemu_api_objs = static_library(
27    'rust_qemu_api_objs',
28    objects: [libqom.extract_all_objects(recursive: false),
29              libhwcore.extract_all_objects(recursive: false)])
30
31test('rust-qemu-api-integration',
32    executable(
33        'rust-qemu-api-integration',
34        'tests/tests.rs',
35        override_options: ['rust_std=2021', 'build.rust_std=2021'],
36        rust_args: ['--test'],
37        install: false,
38        dependencies: [qemu_api, qemu_api_macros],
39        link_whole: [rust_qemu_api_objs, libqemuutil]),
40    args: [
41        '--test',
42        '--format', 'pretty',
43    ],
44    protocol: 'rust',
45    suite: ['unit', 'rust'])
46