From: bors Date: Tue, 3 Apr 2018 18:52:50 +0000 (+0000) Subject: Auto merge of #5203 - matklad:out-dir, r=alexcrichton X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~103 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f0828058aed46283b02180cb7cb982d52c6c2770;p=cargo.git Auto merge of #5203 - matklad:out-dir, r=alexcrichton cargo build --out-dir This is intended to fix https://github.com/rust-lang/cargo/issues/4875. Very much work in progress, just to figure out how exactly `--out-dir` should work :) The path of least resistance for implementing `out-dir` would be to just link everything from `target/debug` to the `out-dir`. However, the problem with this approach is that we link *too much* to the `target/debug`. For example, if you run `cargo build --bin foo`, you'll find not only the `foo` itself there, but also rlibs from the same workspace. I think it's rather important not to copy extra stuff to out-dir, so it is implemented as a completely new parameter, which is threaded through various config structs and applies *only* to the top-level units (i.e, to the stuff user explicitly requested to compile on the command line). I also plan to add platform specific tests here, to check that we get .pdb on windows and .dSYM on macs for various crate-types. Because, in general, a single target may produce multiple files, `out-dir` has to be a directory, you can't directly specify the output *file*. Note that artifacts are still generated to the `target` dir as well. Also cc @nirbheek, I hope that this might be useful for Meson integration, because `--out-dir` should be more straightforward to use than `--message-format=json`. The end result, for `cargo build --bin rustraytracer --out-dir out` on windows looks like this: ![image](https://user-images.githubusercontent.com/1711539/37605115-941c0b22-2ba3-11e8-9685-9756a10fdfac.png) Note how we have fewer files in the `out` :) r? @alexcrichton --- f0828058aed46283b02180cb7cb982d52c6c2770