Over the last months the Rust/cargo support in meson improved a lot.

It's now ready to build and install a GTK4 Rust application with around 70 dependencies without having to write almost any custom build glue for the dependencies.

https://github.com/sdroege/mandelbrot#meson-build

The application in question is just a small experiment of mine for rayon and GTK4 input handling / rendering. The more or less same should work for other GTK4 applications at this point.

All this still depends on two unmerged meson PRs, but it's a huge step forward from the situation just a few months ago.

Thanks to the hard work of @xclaesse and dcbaker!

I hope in the future this will allow GNOME applications written in Rust to have a less strange and fragile build setup than what they have right now with mixing cargo and meson.

#rustlang #rust #gtk #gnome #meson #mesonbuild

GitHub - sdroege/mandelbrot: GTK/Rust based viewer for the Mandelbrot set

GTK/Rust based viewer for the Mandelbrot set. Contribute to sdroege/mandelbrot development by creating an account on GitHub.

GitHub
@slomo @xclaesse does meson use cargo under the hood or does it use rustc directly?
@zenmaya @xclaesse It calls rustc directly but has some degree of support for parsing Cargo.toml and running build.rs. This way you can use Rust dependencies nicely in a multi-language project, or in a project that consists of more than just an executable (e.g. data files), which is the only thing cargo really supports.
@slomo @zenmaya @xclaesse There is `build.rs` support after all? What is the extent of the support?

@krh @zenmaya @xclaesse For now it works if the build.rs has no dependencies, and it's all best-effort. Things relying on build.rs might or might not work. If they don't you can provide a meson.build snippet to extend the autogenerated one, see the two examples in subprojects/packagefiles in my repository.

Ideally most these things should be replaced by proper cargo features instead of hacks like build.rs, but I don't see that happening anytime soon so here we are applying more duct tape 🤷​