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]
|
||||
cfg-if = "1"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
[target.'cfg(not(target_env = "musl"))'.dependencies]
|
||||
ureq = "2"
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
mod macos;
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
if #[cfg(not(target_env = "musl"))] {
|
||||
mod windows;
|
||||
pub use windows::setup;
|
||||
} else if #[cfg(target_os = "macos")] {
|
||||
mod macos;
|
||||
pub use macos::setup;
|
||||
} else {
|
||||
pub fn setup() { }
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
eprintln!("Cross compiling to windows-msvc is not supported from *-musl hosts")
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue