-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Add bevy_dylib to force dynamic linking of bevy #808
Conversation
Ah, the docs live in a separate repo: https://github.com/bevyengine/bevy-website/blob/master/content/learn/book/getting-started/setup/_index.md Should I make a PR or should I wait for this PR to be merged? |
Feel free to make a pr whenever. We'll hold off on merging it until the next release (which will be in about a month) so there's no real time pressure. |
ea6bef1
to
68e72ba
Compare
First: this is super awesome ❤️ I have a proposal for a slight tweak to the crate structure, which allows for a better/clearer UX:
This allows consumers of the I implemented this on my branch here: https://github.com/cart/bevy/tree/bevy_dylib There are two downsides / caveats:
If we can fix (1) and you don't find any "gotchas" in this approach, I think I'll just push the changes to this pr's branch. Thoughts? |
I think I can fix (1) by making our proc_macro import inference a little smarter. I think using |
That approach looks better indeed. |
Wow this plays nicely with the new ECS changes on master. The same example that could iterative compile (with dynamic linking) in |
This easily improve compilation time by 2x
Hold up, whats up with all the refactoring when |
Cargo passes |
But, that one of the 5 ways that the documentation says will work to change a crate type into
The first 3 which are essentially the same thing, just overriding each other. Cargo shouldn't pass Also the work done above has the added disadvantage of having to duplicate the module level documentation per crate. It doesn't concatenate I had found out. So I am not exactly too certain why bevy needs to have it as a feature when you can tell the compiler directly. |
These only control if the C standard library is statically linked or dynamically. Dynamically is the default for pretty much everything except musl.
You can't edit the Cargo.toml of dependencies.
The problem is that while you can tell it the compilet directly, you can't tell it cargo directly. When you use cargo, you can't override the crate type of arbitrary crates from your project. You can only set the crate type of your own project, which has to be an executable if you want to actually run your game. |
Just read that from: https://doc.rust-lang.org/beta/rust-by-example/attribute/crate.html. Weird that in their other reference seems to say otherwise. Anyways, yeah, makes sense. |
This easily improve compilation time by 2x.
Fixes #791
TODO
bevy_dylib
in docs.Tip: You may want to review with
git show --color-moved=dimmed-zebra
to show moved code grey instead of red+green.