2016-04-02 20:00:18 +00:00
|
|
|
extern crate phf_codegen;
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
use std::fs::File;
|
|
|
|
use std::io::{BufWriter, Write};
|
|
|
|
use std::path::Path;
|
|
|
|
|
2016-03-16 14:39:53 +00:00
|
|
|
fn main() {
|
2016-03-24 09:21:27 +00:00
|
|
|
if cfg!(target_os = "windows") {
|
2016-03-19 08:47:23 +00:00
|
|
|
println!("cargo:rustc-link-search=native=C:\\msys64\\mingw64\\lib");
|
|
|
|
}
|
2016-04-02 20:00:18 +00:00
|
|
|
|
|
|
|
let path = Path::new(&env::var("OUT_DIR").unwrap()).join("key_map_table.rs");
|
|
|
|
let mut file = BufWriter::new(File::create(&path).unwrap());
|
|
|
|
|
|
|
|
write!(&mut file, "static KEYVAL_MAP: phf::Map<&'static str, &'static str> = ").unwrap();
|
|
|
|
phf_codegen::Map::new()
|
|
|
|
.entry("Enter", "\"CR\"")
|
|
|
|
.entry("Return", "\"CR\"")
|
|
|
|
.build(&mut file)
|
|
|
|
.unwrap();
|
|
|
|
write!(&mut file, ";\n").unwrap();
|
2016-03-16 14:39:53 +00:00
|
|
|
}
|