15a5110d2SManos Pitsidianakis_qemu_api_rs = static_library( 25a5110d2SManos Pitsidianakis 'qemu_api', 35a5110d2SManos Pitsidianakis structured_sources( 45a5110d2SManos Pitsidianakis [ 55a5110d2SManos Pitsidianakis 'src/lib.rs', 6*718e255fSPaolo Bonzini 'src/c_str.rs', 75a5110d2SManos Pitsidianakis 'src/definitions.rs', 85a5110d2SManos Pitsidianakis 'src/device_class.rs', 90a65e412SManos Pitsidianakis 'src/vmstate.rs', 106e50bde1SPaolo Bonzini 'src/zeroable.rs', 115a5110d2SManos Pitsidianakis ], 125a5110d2SManos Pitsidianakis {'.' : bindings_rs}, 135a5110d2SManos Pitsidianakis ), 145a5110d2SManos Pitsidianakis override_options: ['rust_std=2021', 'build.rust_std=2021'], 155a5110d2SManos Pitsidianakis rust_abi: 'rust', 167b72c7ddSPaolo Bonzini rust_args: [ 175a5110d2SManos Pitsidianakis '--cfg', 'MESON', 185a5110d2SManos Pitsidianakis # '--cfg', 'feature="allocator"', 195a5110d2SManos Pitsidianakis ], 205a5110d2SManos Pitsidianakis) 215a5110d2SManos Pitsidianakis 22*718e255fSPaolo Bonzinirust.test('rust-qemu-api-tests', _qemu_api_rs, 23*718e255fSPaolo Bonzini suite: ['unit', 'rust']) 24*718e255fSPaolo Bonzini 255a5110d2SManos Pitsidianakisqemu_api = declare_dependency( 265a5110d2SManos Pitsidianakis link_with: _qemu_api_rs, 27cde3c425SPaolo Bonzini dependencies: qemu_api_macros, 285a5110d2SManos Pitsidianakis) 29cde3c425SPaolo Bonzini 30cde3c425SPaolo Bonzini# Rust executables do not support objects, so add an intermediate step. 31cde3c425SPaolo Bonzinirust_qemu_api_objs = static_library( 32cde3c425SPaolo Bonzini 'rust_qemu_api_objs', 33cde3c425SPaolo Bonzini objects: [libqom.extract_all_objects(recursive: false), 34cde3c425SPaolo Bonzini libhwcore.extract_all_objects(recursive: false)]) 35cde3c425SPaolo Bonzini 36cde3c425SPaolo Bonzinitest('rust-qemu-api-integration', 37cde3c425SPaolo Bonzini executable( 38cde3c425SPaolo Bonzini 'rust-qemu-api-integration', 39cde3c425SPaolo Bonzini 'tests/tests.rs', 40cde3c425SPaolo Bonzini override_options: ['rust_std=2021', 'build.rust_std=2021'], 41cde3c425SPaolo Bonzini rust_args: ['--test'], 42cde3c425SPaolo Bonzini install: false, 43cde3c425SPaolo Bonzini dependencies: [qemu_api, qemu_api_macros], 44cde3c425SPaolo Bonzini link_whole: [rust_qemu_api_objs, libqemuutil]), 45cde3c425SPaolo Bonzini args: [ 46cde3c425SPaolo Bonzini '--test', 47cde3c425SPaolo Bonzini '--format', 'pretty', 48cde3c425SPaolo Bonzini ], 49cde3c425SPaolo Bonzini protocol: 'rust', 50cde3c425SPaolo Bonzini suite: ['unit', 'rust']) 51