Abort on non mac/ios platforms

This commit is contained in:
maik 2019-06-21 10:13:17 +02:00
parent 2e58d5252c
commit 02ac66792c

View file

@ -16,10 +16,17 @@ fn is_external_enabled() -> bool {
.is_some() .is_some()
} }
fn main() { fn main() {
if !(cfg!(target = "macos") || cfg!(target = "ios")) {
panic!("ash-molten can only be built on macOS or of iOS");
}
// The 'external' feature was not enabled. Molten will be built automaticaly. // The 'external' feature was not enabled. Molten will be built automaticaly.
if !is_external_enabled() { if !is_external_enabled() {
std::process::Command::new("bash").arg("build_molten.sh").status().expect("Unable to build molten"); std::process::Command::new("bash")
let project_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()).join("native"); .arg("build_molten.sh")
.status()
.expect("Unable to build molten");
let project_dir =
PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()).join("native");
println!("cargo:rustc-link-search=native={}", project_dir.display()); println!("cargo:rustc-link-search=native={}", project_dir.display());
} }
println!("cargo:rustc-link-lib=framework=Metal"); println!("cargo:rustc-link-lib=framework=Metal");