Skip to content

Commit 35588b2

Browse files
authored
fix(cli.rs): check default arch at runtime, closes #3067 (#3078)
1 parent 7cc95e1 commit 35588b2

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

.changes/cli.rs-fix-windows-x86.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cli.rs": patch
3+
---
4+
5+
Fix `build` command when executed on a 32-bit Windows machine when pulling from the `binary-releases` repo.

examples/api/src-tauri/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/cli.rs/src/build.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,17 @@ pub fn command(options: Options) -> Result<()> {
174174
// move merge modules to the out dir so the bundler can load it
175175
#[cfg(windows)]
176176
{
177-
let arch = if let Some(t) = &options.target {
178-
if t.starts_with("x86_64") {
179-
"x86_64"
180-
} else if t.starts_with('i') {
181-
"x86"
182-
} else if t.starts_with("arm") {
183-
"arm"
184-
} else if t.starts_with("aarch64") {
185-
"aarch64"
186-
} else {
187-
panic!("Unexpected target triple {}", t)
188-
}
189-
} else if cfg!(target_arch = "x86") {
177+
let target = options.target.clone().unwrap_or_else(|| std::env::consts::ARCH.into());
178+
let arch = if target.starts_with("x86_64") {
179+
"x86_64"
180+
} else if target.starts_with('i') || target.starts_with("x86") {
190181
"x86"
182+
} else if target.starts_with("arm") {
183+
"arm"
184+
} else if target.starts_with("aarch64") {
185+
"aarch64"
191186
} else {
192-
"x86_64"
187+
panic!("Unexpected target architecture {}", target.split("_").next().unwrap())
193188
};
194189
let (filename, vcruntime_msm) = if arch == "x86" {
195190
let _ = std::fs::remove_file(out_dir.join("Microsoft_VC142_CRT_x64.msm"));

0 commit comments

Comments
 (0)