#Multiple Bevy dependencies in the same workspace

2 messages ยท Page 1 of 1 (latest)

fresh cove
#

Hi ๐Ÿ‘‹

Background:
I have the following workspace structure

root
โ”œโ”€ main 
|  โ”œโ”€ derive 
|  |  โ”œโ”€ core
|  โ”œโ”€ core

In which I've got some boilerplate I want to stamp out with a derive macro and to my understanding the proper way to represent the dependencies is just to take them in the derive crate (even though it could stamp out the code without a ref to the crate) so I've split out the stuff that I need in my derive to a core crate that can be shared. All of these crates use bevy.

Problem:
When referencing bevy from multiple crates in the same workspace with the dynamic_linking feature I get a build warning:

warning: output filename collision.
The lib target `bevy_dylib` in package `bevy_dylib v0.12.0` has the same output filename as the lib target `bevy_dylib` in package `bevy_dylib v0.12.0`.
Colliding filename is: <BLAH_BLAH>\target\debug\bevy_dylib.dll
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.

Ideally I'd like to keep using the dynlib feature to keep the compile times down, so what is my best course of action?

Thanks in advance,

ashen nymph
#

Don't know the answer to your question, but

You don't need bevy in your derive macro. Macro is syntax only with no runtime information. You typically only need syn, quote and proc_macro2. It is very rare you would ever reach for something like serde, let alone bevy.

You should organize your project as a workspace
https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html

and reference your macro crate like this in cargo.toml

your_crate_macro = { path = "../derive" }