fix(cli.rs): check default arch at runtime, closes #3067 (#3078)

This commit is contained in:
Lucas Fernandes Nogueira
2021-12-27 10:49:59 -03:00
committed by GitHub
parent 7cc95e10ec
commit 35588b2e04
3 changed files with 19 additions and 19 deletions

View File

@@ -0,0 +1,5 @@
---
"cli.rs": patch
---
Fix `build` command when executed on a 32-bit Windows machine when pulling from the `binary-releases` repo.

View File

@@ -345,9 +345,9 @@ dependencies = [
[[package]]
name = "clap"
version = "3.0.0-rc.0"
version = "3.0.0-rc.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79b70f999da60e6619a29b131739d2211ed4d4301f40372e94a8081422e9d6c7"
checksum = "967965e82fc46fee1a88147a7a977a66d615ed5f83eb95b18577b342c08f90ff"
dependencies = [
"atty",
"bitflags",
@@ -1821,9 +1821,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.8.0"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
[[package]]
name = "open"

View File

@@ -174,22 +174,17 @@ pub fn command(options: Options) -> Result<()> {
// move merge modules to the out dir so the bundler can load it
#[cfg(windows)]
{
let arch = if let Some(t) = &options.target {
if t.starts_with("x86_64") {
"x86_64"
} else if t.starts_with('i') {
"x86"
} else if t.starts_with("arm") {
"arm"
} else if t.starts_with("aarch64") {
"aarch64"
} else {
panic!("Unexpected target triple {}", t)
}
} else if cfg!(target_arch = "x86") {
"x86"
} else {
let target = options.target.clone().unwrap_or_else(|| std::env::consts::ARCH.into());
let arch = if target.starts_with("x86_64") {
"x86_64"
} else if target.starts_with('i') || target.starts_with("x86") {
"x86"
} else if target.starts_with("arm") {
"arm"
} else if target.starts_with("aarch64") {
"aarch64"
} else {
panic!("Unexpected target architecture {}", target.split("_").next().unwrap())
};
let (filename, vcruntime_msm) = if arch == "x86" {
let _ = std::fs::remove_file(out_dir.join("Microsoft_VC142_CRT_x64.msm"));