#![feature(os, io, path)]
use std::os;
use std::old_io::fs::PathExtensions;
enum Platform {
Windows,
Mac,
Linux
}
fn get_platform() -> Platform {
match os::getenv("TARGET").unwrap().split('-').nth(2).unwrap() {
"win32" | "windows" => Platform::Windows,
"darwin" => Platform::Mac,
"linux" => Platform::Linux,
other => panic!("Sorry, platform \"{}\" is not supported by CEF.", other)
}
}
fn main() {
let dll_name = match get_platform() {
Platform::Mac => return, Platform::Windows => "libcef",
Platform::Linux => panic!(
"Sorry, Linux is not supported until bindings for CEF for that platform are generated.")
};
let dll_file_name = os::dll_filename(dll_name);
let cef_dir = Path::new(os::getenv("CEF_PATH")
.expect("CEF_PATH needs to point to the directory containing the CEF DLL."));
let cef_path = cef_dir.join(dll_file_name.clone());
if !cef_path.exists() {
panic!("Unable to find {} in {}", dll_file_name, cef_dir.as_str().unwrap());
}
println!("cargo:rustc-flags=-l {} -L {}", dll_name, cef_dir.as_str().unwrap());
}