Skip to content

Commit

Permalink
fix(cli.rs): check default arch at runtime, closes #3067 (#3078)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Dec 27, 2021
1 parent 7cc95e1 commit 35588b2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changes/cli.rs-fix-windows-x86.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 4 additions & 4 deletions examples/api/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 9 additions & 14 deletions tooling/cli.rs/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
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 {
"x86_64"
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"));
Expand Down

0 comments on commit 35588b2

Please sign in to comment.