diff --git a/Rust/MelonProxy/build.rs b/Rust/MelonProxy/build.rs index 8b5a8dc2..8f375488 100644 --- a/Rust/MelonProxy/build.rs +++ b/Rust/MelonProxy/build.rs @@ -1,5 +1,20 @@ -#[cfg(windows)] +use std::env; + fn main() { + let target_os = env::var("CARGO_CFG_TARGET_OS"); + + match target_os.as_ref().map(|x| &**x) { + Ok("linux") | Ok("android") => {}, + Ok("freebsd") | Ok("dragonfly") => {}, + Ok("openbsd") | Ok("bitrig") | Ok("netbsd") | Ok("macos") | Ok("ios") => {} + + Ok("windows") => link_exports(), + + tos => panic!("unknown target os {:?}!", tos) + } +} + +fn link_exports() { println!("cargo:warning=Linking Exports File.."); use std::path::Path; let lib_path = Path::new("deps").join("Exports.def"); @@ -8,9 +23,4 @@ fn main() { "cargo:rustc-cdylib-link-arg=/DEF:{}", absolute_path.display() ); -} - -#[cfg(not(windows))] -fn main() { - } \ No newline at end of file