Skip to content

Instantly share code, notes, and snippets.

@pmsanford
Created November 29, 2014 02:25
Show Gist options
  • Save pmsanford/87519ed32adbeca72595 to your computer and use it in GitHub Desktop.
Save pmsanford/87519ed32adbeca72595 to your computer and use it in GitHub Desktop.
use std::os;
use std::io::fs;
use std::io::fs::PathExtensions;
const LIB_PATH_REL: &'static str = "../libs/libtcod";
fn main() {
let out_dir = os::getenv("OUT_DIR").unwrap();
let dst = Path::new(out_dir.clone());
let src = Path::new(LIB_PATH_REL);
println!("cargo:rustc-flags=-l tcod:dylib -L {}", out_dir);
let files = fs::readdir(&src).unwrap();
for entry in files.iter() {
if entry.is_file() &&
entry.filename().unwrap().ends_with("dylib".as_bytes()) {
let dst_file = dst.join(entry.filename().unwrap());
match fs::copy(entry, &dst_file) {
Err(why) => panic!(why),
Ok(_) => {}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment