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