Open AngelicosPhosphoros opened 3 years ago
Instead of passing the --target to cargo you can put this in your .cargo/config.toml:
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
@GuilhermeWerner
rustflags
in config.toml
have same effect as setting RUSTFLAGS
environment variable so it is unrelated.
This feature makes Visual C++ runtime to be linked output binaries statically. I found a workaround but maybe there is some better way?
I build on Windows with: MS Visual Studio 2019 Vulkan SDK 1.2.162.1 rustc 1.48.0 (7eac88abb 2020-11-16)
Code (build.rs):
Cargo.toml:
I run build in Powershell with commands:
I expect build to compile but got this (this is only a part, a lot of omitted):
I currently use a hack with specifying target explicitely. It makes cargo send custom compiler flags only to the final binary compilations and ignore build scripts: