On Thu, 20 Jun 2024 at 14:35, Manos Pitsidianakis <manos.pitsidiana...@linaro.org> wrote: > > On Thu, 20 Jun 2024 15:32, Alex Bennée <alex.ben...@linaro.org> wrote: > >Manos Pitsidianakis <manos.pitsidiana...@linaro.org> writes: > > > >> Add mechanism to generate rust hw targets that depend on a custom > >> bindgen target for rust bindings to C. > >> > >> This way bindings will be created before the rust crate is compiled. > >> > >> The bindings will end up in BUILDDIR/{target}-generated.rs and have the > >> same name > >> as a target: > >> > >> ninja aarch64-softmmu-generated.rs > >> > ><snip> > >> + > >> + > >> +rust_targets = {} > >> + > >> +cargo_wrapper = [ > >> + find_program(meson.global_source_root() / 'scripts/cargo_wrapper.py'), > >> + '--config-headers', meson.project_build_root() / 'config-host.h', > >> + '--meson-build-root', meson.project_build_root(), > >> + '--meson-build-dir', meson.current_build_dir(), > >> + '--meson-source-dir', meson.current_source_dir(), > >> +] > > > >I'm unclear what the difference between meson-build-root and > >meson-build-dir is? > > Build-dir is the subdir of the current subdir(...) meson.build file > > So if we are building under qemu/build, meson_build_root is qemu/build > and meson_build_dir is qemu/build/rust > > > > >We also end up defining crate-dir and outdir. Aren't these all > >derivable from whatever module we are building? > > Crate dir is the source directory (i.e. qemu/rust/pl011) that contains > the crate's manifest file Cargo.toml. > > Outdir is where to put the final build artifact for meson to find. We > could derive that from the build directories and package names somehow > but I chose to be explicit instead of doing indirect logic to make the > process less magic. > > I know it's a lot so I'm open to simplifications. The only problem is > that all of these directories, except the crate source code, are defined > from meson and can change with any refactor we do from the meson side of > things.
Expanding the help text for these command-line options would make it easier to understand. It would be great to include an example path too. Stefan