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