How do you build mixed C++/Rust projects?


#1

I’d love to improve (in the long term) the integration of IntelliJ Rust and CLion, but I need to now how mixed C++/Rust project work. Does anybody use https://github.com/SiegeLord/RustCMake?


#2

I know that @emoon enjoys tundra and made sure it has Rust support.


#3

Yeah so Tundra has basic support for Rust now which I’m using for ProDBG. It works fairly good but I wasn’t as straightforward as I would have hoped for to implement the Cargo side. The issue is that you can’t really tell Cargo to “link with these libs” from the outside. The way I do is is to spawn Cargo like this

set LIBS_TO_LINK_WITH="foo bar" && cargo build

Also the cmd line needs to be slightly different on Windows which I also handle. Then I have a build.rs script that pretty much loops over some of the input env settings and then propagate them to be linked with the executable.

So while a bit annoying it actually works good in practice. I also make sure to output the cargo targets into separate directories which means I have have several cargo instances building at the same time which is a pretty good time saver for me as as plugins are independent and can build in parallel.