From 1786d54f10f71e9660ef5ea33a1fcb922f38be30 Mon Sep 17 00:00:00 2001 From: Colin Sherratt Date: Thu, 20 Nov 2014 23:07:56 -0500 Subject: [PATCH] lipo for osx --- scripts/build.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/build.rs b/scripts/build.rs index d9b1998..bf2649e 100644 --- a/scripts/build.rs +++ b/scripts/build.rs @@ -1,4 +1,5 @@ use std::io::Command; +#[cfg(target_os = "linux")] use std::io::fs; #[cfg(target_os = "linux")] @@ -23,9 +24,13 @@ fn main() { .arg("build") .status() .ok().expect("Failed to build"); - fs::copy(&Path::new("modules/oculus_sdk_mac/LibOVR/Lib/MacOS/Release/libovr.a"), - &Path::new(env!("OUT_DIR")).join(Path::new("libovr.a"))) - .ok().expect("Failed to move file"); + Command::new("lipo") + .arg("modules/oculus_sdk_mac/LibOVR/Lib/MacOS/Release/libovr.a") + .arg("-thin") + .arg("x86_64") + .arg("-output") + .arg(Path::new(env!("OUT_DIR")).join(Path::new("libovr.a")).as_str().unwrap()) + .status() + .ok().expect("Failed to lipo library"); println!("cargo:rustc-flags=-L {} -l ovr:static", env!("OUT_DIR")); - } \ No newline at end of file