[rust-dev] Compiling Rust programs with the Meson build system

Jussi Pakkanen jpakkane at gmail.com
Wed Jun 18 15:17:42 PDT 2014


I'm working on a build system called Meson (
https://jpakkane.github.io/meson/) and I figured I'd add native Rust
support. Here's what a build definition for a simple Rust application ended
up looking:


project('rustproject', 'rust')
executable('rustprog', 'prog.rs')


This gives you all the features you'd expect such as different build types
(debug/release/etc), accurate dependency tracking via --dep-info, unit
tests, install targets and so on. Shared library support is there, but I
need to first fix one issue before it will actually work. This has to do
with the fact that you can't know beforehand what the output file name will
be (if you set it manually with -o, rustc will not link against it).

If you want to try it our yourself, here's the steps:

- check out Meson's git trunk: https://github.com/jpakkane/meson
- cd into it, mkdir buildtest
- ./meson.py test\ cases/rust/1\ basic buildtest
- cd buildtest
- ninja (or ninja-build if you are on Fedora)

Test 2 does not work because of the above mentioned issue, so you probably
don't want to run it.

Feel free to try it out. If you have any questions I'm happy to answer them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140619/e55db565/attachment.html>

More information about the Rust-dev mailing list