Hi, Im using bevy
to create my game, and using dynamic_linking
features for fast compilation in development.
but, when I want to build my game in release mode. I want to disable this dynamic_linking
feature.
How can I achieve that via cargo.toml configuration?
alice
July 19, 2024, 1:01pm
2
You can't do that.
Here's something you can do instead. Define a feature in your Cargo.toml
for dynamic linking:
[features]
dynamic_linking = ["bevy/dynamic_linking"]
Then you build with these commands:
cargo build --features dynamic_linking
cargo build --release
Alternatively, you can also list the feature as default:
[features]
default = ["dynamic_linking"]
dynamic_linking = ["bevy/dynamic_linking"]
Then the commands become:
cargo build
cargo build --release --no-default-features
1 Like
Thank you so much!
So, do I still need to add dynamic_linking feature to bevy? like this:
[dependencies]
bevy = { version = "0.14.0", features = ["dynamic_linking"] }
[features]
dynamic_linking = ["bevy/dynamic_linking"]
Or, just simply like this:
[dependencies]
bevy = "0.14.0"
[features]
dynamic_linking = ["bevy/dynamic_linking"]
alice
July 19, 2024, 1:09pm
4
This is correct:
[dependencies]
bevy = "0.14.0"
[features]
dynamic_linking = ["bevy/dynamic_linking"]
1 Like
alice
July 19, 2024, 1:12pm
5
Note that you don't have to call your feature dynamic_linking
. This would also work:
[dependencies]
bevy = "0.14.0"
[features]
fast_build = ["bevy/dynamic_linking"]
cargo build --features fast_build
cargo build --release
2 Likes
For anyone's information:
You could add cargo config file to set some aliases, like this:
create .cargo/config.toml
in your working directory.
add following content in that file:
[alias]
b = "build --features fast_build"
r = "run --features fast_build"
br = "build --release"
rr = "run --release"
then you can run cargo b
for cargo build --features fast_build
, and etc.
3 Likes
system
Closed
October 18, 2024, 7:41am
7
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.