Description
See #78913 for more background.
I'm a meson developer, working to make rust work better with meson. I know that cargo is the official build system for rust, but for me and the projects I work on cargo is unacceptable, we have a massive C/C++ codebase already using meson, with interest in migrating some (but not all) of our code to rust. Mostly things work fine, but one problem we do have is including generated code.
Cargo handles generated code by setting an OUT_DIR
environment variable, this works for cargo because it has a number of unique design decisions compared to most build systems. For Cmake and meson and particular this is problematic because we generate a declarative build system which the user invokes, visual-studio, ninja, make, etc; so there are separate "configure" and "build" stages. For ninja in particular environment variables are problematic because it's made an explicit design choice not to support them. As such, we have no way to set environment variables at build time without resorting to something ugly like wrapping rustc in a script to proxy the variables.
What would be nice is the ability to pass environment variables to rustc directly, much like --cfg
, something like --env "OUT_DIR=/some/dir"
. This would allow us to make include()
work like cargo, but without needing to resort to wrapping rustc and making things slower than they need to be.