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