mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 22:50:19 +00:00
fc0f15f11e
# Objective The description of NixOS dependencies is extremely long and spends entire paragraphs just for simple line changes. With this PR it should be much simpler. ## Solution - Linking Vulkan in `build.rs` is less effective than adding it in LD_LIBRARY_PATH, so I removed the former (related to #1992); - I put a simple comment explaining the line in the list of dependencies, instead of making entire paragraphs; - Clang is not in an absolute path in `.cargo/config_fast_builds` anymore, so that there is no need to specify it in `docs/linux_dependencies.md` (didn't test if this breaks other distros, though I doubt it. Also, maybe it could also be done on Darwin for consistency?); - Also added optional wayland dependencies. A few notes: - The x11 libraries will be linked only during the compilation phase. This means that if you use the `x11` feature without these libraries in the environment (for example because you forget to enter the nix shell before compiling), the program will still compile successfully but won't run. You'll have to `cargo clean` and recompile with the x11 libraries in the environment. I don't know if this is important enough to be added to the documentation, but it's not specified anywhere, though I don't think it's specific to NixOS; - The wayland dependencies need to be put in LD_LIBRARY_PATH only in certain conditions (IIRC, only if using the `dynamic` feature) and the text doesn't specify it. Because putting them there doesn't increase the number of dependencies (they are already in buildInputs) or alter the performance, I doubt anyone will care; - Should I comment out what isn't needed by default? - ~I removed `cargo` from buildInputs. Ignoring the fact that it should be in nativeBuildInputs, having it in `shell.nix` allows to use stable Rust in case it's not in the system environment, but maybe the user wanted to use the version that was already in the system environment and will be caught by surprise. In my opinion, if someone is looking at a Bevy's documentation on NixOS, that user will either have Rust already in the system environment (eg. via rustup) or is capable to add the toolchain they want on shell.nix by themselves. This isn't exactly the place to explain how this works.~ ~EDIT: I replaced `cargo` with Rust from the [Oxalica overlay](https://github.com/oxalica/rust-overlay) in order to have the latest nightly.~ EDIT: Removed `cargo` from dependencies. See comments for details.
25 lines
1.1 KiB
Text
25 lines
1.1 KiB
Text
# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below.
|
|
|
|
# NOTE: For maximum performance, build using a nightly compiler
|
|
# If you are using rust stable, remove the "-Zshare-generics=y" below.
|
|
|
|
[target.x86_64-unknown-linux-gnu]
|
|
linker = "clang"
|
|
rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]
|
|
|
|
# NOTE: you must manually install https://github.com/michaeleisel/zld on mac. you can easily do this with the "brew" package manager:
|
|
# `brew install michaeleisel/zld/zld`
|
|
[target.x86_64-apple-darwin]
|
|
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Zshare-generics=y"]
|
|
|
|
[target.aarch64-apple-darwin]
|
|
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Zshare-generics=y"]
|
|
|
|
[target.x86_64-pc-windows-msvc]
|
|
linker = "rust-lld.exe"
|
|
rustflags = ["-Zshare-generics=n"]
|
|
|
|
# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
|
|
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
|
|
#[profile.dev]
|
|
#debug = 1
|