Rust, just like C++, generates a lot of output files when you build an executable. Particularly, when writing my programs with WinSafe, I use the library straight from a sibling directory, so I can test any changes right away – the side effect is that all those output artifacts are generated repeatedly for each new program.
So I’ve just tested the target-dir
global option for Cargo, which will use a single target
directory for all projects. This would, in theory, prevent the constant rebuilding of WinSafe artifacts.
Since the output dir changed, I had to also change the deploy.sh
scripts to point to the new location. Other than that, everything seemed to work as intended, and I’m pretty satisfied with the results.
This is now my global ~/.cargo/config.toml
file:
# https://github.com/rust-lang/cargo/issues/3381#issuecomment-710388554 [net] git-fetch-with-cli = true # https://redd.it/1dua24f # https://blog.rust-lang.org/2023/11/09/parallel-rustc.html [build] target-dir = "D:\\Stuff\\Core\\rs\\_target" #rustflags = ["-Z", "threads=8"] # Change default toolchain: # rustup show # rustup default nightly-x86_64-pc-windows-msvc # rustup default stable-x86_64-pc-windows-msvc
As an extra benefit, when I want to clean the target directory, now I just need to delete the single _target
one.
No comments:
Post a Comment