-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for generated sources, when building out of tree with non-cargo build systems #78913
Comments
What's wrong with the approach Cargo uses of setting the |
For one, I can't set env variables at compile time, ninja doesn't support them, and never will. I can't change that. But that wouldn't solve the problem that my hand written files live in a source tree (which in many cases is read only) and my generated files are in my build tree, which is the only writeable tree I have |
Why is that a problem? |
I've discussed this with @dcbaker and there was just a small missunderstanding on how all the
For 1. we could write a wrapper to inject arbitrary env variables, but this solution kind of sucks What rustc could help with is to have a stable interface to inject arbitrary data (something alike |
for 1 what would be really useful is an option like for 2 what I have in mind is that we have in our tree a lot of code generated from xml descriptions, but that code additionally needs a lot of handwritten code to be useful. so you'd have something like:
I'd really like to be able to have an option like (I don't really care what it looks like, but as a strawman): |
Please don't. Environment variables are an awful way of configuring anything. The compiler switch way is better in every way. |
I don't think this issue is really specific for what we need, I'm going to close this and open a different one. |
For build systems other than cargo, it is generally considered best practice to build out of tree (ie, generated files go into a directory that is not tracked by version control). With rustc this works great, except when you need to generate rust sources. In that case a build system (meson in this case, but cmake and gnu autotools would be affected too) will place the generated .rs file in the build tree, while the hard written sources are in the source tree. As far as I can find there is no way to tell rustc about this and get it to compile successfully, without resorting to ugly hacks like "copy all of the files from the source tree to the build tree." While this can work, it's rather ugly and error prone.
The text was updated successfully, but these errors were encountered: