Paolo Bonzini <pbonz...@redhat.com> writes:
> On 11/12/24 11:10, Junjie Mao wrote: >> diff --git a/meson.build b/meson.build >> index 1239f5c48c..8cea09ffe1 100644 >> --- a/meson.build >> +++ b/meson.build >> @@ -4,6 +4,7 @@ project('qemu', ['c'], meson_version: '>=1.5.0', >> version: files('VERSION')) >> meson.add_devenv({ 'MESON_BUILD_ROOT' : meson.project_build_root() }) >> +meson.add_devenv({ 'CARGO_TARGET_DIR' : meson.project_build_root() / >> 'cargo' }) > > I think I'd rather avoid using CARGO_TARGET_DIR, in case someone forgets > he/she > is in the devenv. > I should have dropped this line earlier. It was from my first attempt where I wanted to put the generated bindings directly to cargo OUT_DIR (so that file copy can be avoided). That didn't work because OUT_DIR contains hashes that are hard to predict. >> add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: >> true) >> add_test_setup('slow', exclude_suites: ['thorough'], env: >> ['G_TEST_SLOW=1', 'SPEED=slow']) >> @@ -4083,7 +4084,7 @@ if have_rust >> bindings_rs = rust.bindgen( >> input: 'rust/wrapper.h', >> dependencies: common_ss.all_dependencies(), >> - output: 'bindings.rs.inc', >> + output: 'bindings.inc.rs', > > Needs a comment, but I guess it's okay. > >> - println!("cargo:rustc-env=BINDINGS_RS_INC={}", file); >> + let out_dir = env::var("OUT_DIR").unwrap(); >> + let dest_path = format!("{}/bindings.inc.rs", out_dir); >> + copy(&file, Path::new(&dest_path))?; > > A symbolic link seems to work too. Thanks for the tip! Linux-based hosts should be fine. Should we test if symlinks also work on W32/W64 systems? > > Paolo -- Best Regards Junjie Mao