Check compile target at runtime in build
This commit is contained in:
parent
81af1674a8
commit
03e6048dc9
2 changed files with 8 additions and 12 deletions
|
@ -10,7 +10,4 @@ repository = "https://github.com/napi-rs/napi-rs"
|
|||
version = "1.0.1"
|
||||
|
||||
[dependencies]
|
||||
cfg-if = "1"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
ureq = "2"
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
cfg_if::cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
mod windows;
|
||||
pub use windows::setup;
|
||||
} else if #[cfg(target_os = "macos")] {
|
||||
mod macos;
|
||||
pub use macos::setup;
|
||||
} else {
|
||||
pub fn setup() { }
|
||||
mod macos;
|
||||
mod windows;
|
||||
|
||||
pub fn setup() {
|
||||
match std::env::var("CARGO_CFG_TARGET_OS").as_deref() {
|
||||
Ok("macos") => macos::setup(),
|
||||
Ok("windows") => windows::setup(),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue