use the nightly compiler on windows to build platforms

This commit is contained in:
Folkert 2022-11-10 18:48:54 +01:00
parent 2b6ddc990c
commit 5b952616a9
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 14 additions and 1 deletions

View file

@ -633,6 +633,12 @@ pub fn rebuild_host(
);
let mut cargo_cmd = cargo();
if cfg!(windows) {
// on windows, we need the `+nightly` toolchain so we can use `-Z export-executable-symbols`
cargo_cmd.arg("+nightly");
}
cargo_cmd.arg("build").current_dir(cargo_dir);
// Rust doesn't expose size without editing the cargo.toml. Instead just use release.
if matches!(opt_level, OptLevel::Optimize | OptLevel::Size) {

View file

@ -126,7 +126,14 @@ pub fn get_lib_path() -> Option<PathBuf> {
/// Gives a friendly error if cargo is not installed.
/// Also makes it easy to track where we use cargo in the codebase.
pub fn cargo() -> Command {
let command_str = "cargo";
let command_str = if cfg!(windows) {
// on windows, we need the version of cargo installed by rustup. The meaning of `cargo` is
// different within a process that runs rust. So we need to explicitly refer to where
// rustup put the binary
r"%HOMEPATH%\.cargo\bin\cargo.exe"
} else {
"cargo"
};
if check_command_available(command_str) {
Command::new(command_str)