Skip to content

Commit

Permalink
Generalized build target checks in windows-targets sub-crates (micr…
Browse files Browse the repository at this point in the history
  • Loading branch information
seritools authored and Guiguiprim committed Aug 6, 2024
1 parent 06cc1a1 commit bf2748b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 11 deletions.
5 changes: 4 additions & 1 deletion crates/targets/aarch64_gnullvm/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
fn main() {
let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
let target = std::env::var("TARGET").unwrap();
if target != "aarch64-pc-windows-gnullvm" {
if family != "windows" || arch != "aarch64" || env != "gnu" || !target.ends_with("-gnullvm") {
return;
}

Expand Down
6 changes: 4 additions & 2 deletions crates/targets/aarch64_msvc/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
fn main() {
let target = std::env::var("TARGET").unwrap();
if target != "aarch64-pc-windows-msvc" && target != "aarch64-uwp-windows-msvc" {
let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
if family != "windows" || arch != "aarch64" || env != "msvc" {
return;
}

Expand Down
6 changes: 4 additions & 2 deletions crates/targets/i686_gnu/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
fn main() {
let target = std::env::var("TARGET").unwrap();
if target != "i686-pc-windows-gnu" && target != "i686-uwp-windows-gnu" {
let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
if family != "windows" || arch != "x86" || env != "gnu" {
return;
}

Expand Down
6 changes: 4 additions & 2 deletions crates/targets/i686_msvc/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
fn main() {
let target = std::env::var("TARGET").unwrap();
if target != "i686-pc-windows-msvc" && target != "i686-uwp-windows-msvc" {
let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
if family != "windows" || arch != "x86" || env != "msvc" {
return;
}

Expand Down
5 changes: 4 additions & 1 deletion crates/targets/x86_64_gnu/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
fn main() {
let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
let target = std::env::var("TARGET").unwrap();
if target != "x86_64-pc-windows-gnu" && target != "x86_64-uwp-windows-gnu" {
if family != "windows" || arch != "x86_64" || env != "gnu" || !target.ends_with("-gnu") {
return;
}

Expand Down
5 changes: 4 additions & 1 deletion crates/targets/x86_64_gnullvm/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
fn main() {
let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
let target = std::env::var("TARGET").unwrap();
if target != "x86_64-pc-windows-gnullvm" {
if family != "windows" || arch != "x86_64" || env != "gnu" || !target.ends_with("-gnullvm") {
return;
}

Expand Down
6 changes: 4 additions & 2 deletions crates/targets/x86_64_msvc/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
fn main() {
let target = std::env::var("TARGET").unwrap();
if target != "x86_64-pc-windows-msvc" && target != "x86_64-uwp-windows-msvc" {
let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
if family != "windows" || arch != "x86_64" || env != "msvc" {
return;
}

Expand Down

0 comments on commit bf2748b

Please sign in to comment.