Skip to content

Commit 5aad810

Browse files
committed
Fix cross compiling for Windows
1 parent 8c595fd commit 5aad810

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

crates/lib/build.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
use std::env;
2+
13
fn main() {
2-
#[cfg(unix)]
3-
let dist_url = option_env!("PKGX_DIST_URL").unwrap_or("https://dist.pkgx.dev");
4-
#[cfg(windows)]
5-
let dist_url = option_env!("PKGX_DIST_URL").unwrap_or("https://dist.pkgx.dev/v2");
4+
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
5+
6+
let dist_url = if target_os == "windows" {
7+
option_env!("PKGX_DIST_URL").unwrap_or("https://dist.pkgx.dev/v2")
8+
} else {
9+
option_env!("PKGX_DIST_URL").unwrap_or("https://dist.pkgx.dev")
10+
};
11+
612
let default_pantry_tarball_filename = "pantry.tgz";
713
let pantry_url =
814
option_env!("PKGX_PANTRY_TARBALL_FILENAME").unwrap_or(default_pantry_tarball_filename);

0 commit comments

Comments
 (0)