Merge pull request #519 from c-nixon/check-CARGO_CFG_TARGET_OS-in-build
This commit is contained in:
commit
e4753b7c1d
2 changed files with 20 additions and 8 deletions
|
@ -12,5 +12,5 @@ version = "1.0.1"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(not(target_env = "musl"))'.dependencies]
|
||||||
ureq = "2"
|
ureq = "2"
|
||||||
|
|
|
@ -1,11 +1,23 @@
|
||||||
cfg_if::cfg_if! {
|
|
||||||
if #[cfg(windows)] {
|
|
||||||
mod windows;
|
|
||||||
pub use windows::setup;
|
|
||||||
} else if #[cfg(target_os = "macos")] {
|
|
||||||
mod macos;
|
mod macos;
|
||||||
pub use macos::setup;
|
|
||||||
|
cfg_if::cfg_if! {
|
||||||
|
if #[cfg(not(target_env = "musl"))] {
|
||||||
|
mod windows;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn setup() {
|
||||||
|
match std::env::var("CARGO_CFG_TARGET_OS").as_deref() {
|
||||||
|
Ok("macos") => macos::setup(),
|
||||||
|
Ok("windows") => {
|
||||||
|
cfg_if::cfg_if! {
|
||||||
|
if #[cfg(not(target_env = "musl"))] {
|
||||||
|
windows::setup()
|
||||||
} else {
|
} else {
|
||||||
pub fn setup() { }
|
eprintln!("Cross compiling to windows-msvc is not supported from *-musl hosts")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue