neovim-gtk/build.rs

35 lines
1.1 KiB
Rust
Raw Normal View History

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()
2016-05-03 17:25:52 +00:00
.entry("Left", "\"Left\"")
.entry("Right", "\"Right\"")
.entry("Up", "\"Up\"")
.entry("Down", "\"Down\"")
2016-04-03 10:06:35 +00:00
.entry("BackSpace", "\"BS\"")
2016-04-02 20:00:18 +00:00
.entry("Return", "\"CR\"")
2016-04-03 10:06:35 +00:00
.entry("Escape", "\"Esc\"")
.entry("Delete", "\"Del\"")
.entry("Page_Up", "\"PageUp\"")
.entry("Page_Down", "\"PageDown\"")
.entry("Enter", "\"CR\"")
.entry("Tab", "\"Tab\"")
2016-04-03 10:06:35 +00:00
.entry("ISO_Left_Tab", "\"Tab\"")
2016-04-02 20:00:18 +00:00
.build(&mut file)
.unwrap();
write!(&mut file, ";\n").unwrap();
2016-03-16 14:39:53 +00:00
}