-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Structured inputs for Rust (and more languages in the future, probably) #8775
Structured inputs for Rust (and more languages in the future, probably) #8775
Conversation
The build level shouldn't be deal with interpreter objects, by the time they leave the intpreter they should be in the Meson middle layer representaiton
Currently it's useless, but it can be passed in and assigned.
This allows for generating structured inputs for Rust targets, including CustomTargets, ConfigurationFiles, and static files that need to be copied/moved.
instead of opencoding what should be there in the rust compile rule
Rust is the only language the currently requires structured inputs, so it's the only one I'm implementing.
This is hardly complete, but it's a start.
This pull request introduces 2 alerts when merging 9a0dd4c into be015a3 - view on LGTM.com new alerts:
|
This is unacceptable as a syntax. It is completely unreadable with the magic dictionaries and all. |
This pull request introduces 2 alerts when merging f396f76 into be015a3 - view on LGTM.com new alerts:
|
Then do you have another idea on what the syntax should be, @jpakkane? |
@jpakkane, how would you feel about a new function instead?: sources = structured_source(
foo_gen_pyx, 'foo_static.pyx',
sub : bar_gen_pyx, 'bar_static.pyx',
...
)
target = py.module('foo', sources) |
Sure, something like that makes a lot more sense as it is its own isolated thing. |
This is going to need enough rework that I'm just giong to open a new PR for this. |
The fixed issue has most of the background on this, so I'm not going to repeat it, go look at #8725 for more info.
The goal of this series is to make it possible to use generated files with languages that do all of their compilation in one go (Rust, Cython, Zig), and rely on the layout of those files on disk for imports (Rust, Cython, Zig). For those languages we don't generate a single .o for each source file, the compilers and/or languages simply don't make that possible. Instead, we generate a singlle compilation target for all of those sources.
To that end this series introduces a new concept, the "structured input". This input is a dictionary mapping an arbitrary "root" to a directory tree (at the moment the target's private directory is used as the root), like so:
Meson will ensure that at the root of the tree is main.rs, then a root/foo/mod.rs exists, as does root/bar/generated_mod.rs, it will do this before compiling mian.rs If necessary it will copy files (at build time) into the build tree. It does this at build time to avoid reconfiguring on file changes, and to ensure that the tree is always accurate. This is unnecessary if there are no generated sources, and simply passing
executable('exe', 'main.rs')
has not been changed.Fixes #8725