neovim-gtk/build.rs

49 lines
1.5 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()
2017-04-23 09:45:51 +00:00
.entry("F1", "\"F1\"")
.entry("F2", "\"F2\"")
.entry("F3", "\"F3\"")
.entry("F4", "\"F4\"")
.entry("F5", "\"F5\"")
.entry("F6", "\"F6\"")
.entry("F7", "\"F7\"")
.entry("F8", "\"F8\"")
.entry("F9", "\"F9\"")
.entry("F10", "\"F10\"")
.entry("F11", "\"F11\"")
.entry("F12", "\"F12\"")
2016-05-03 17:25:52 +00:00
.entry("Left", "\"Left\"")
.entry("Right", "\"Right\"")
.entry("Up", "\"Up\"")
.entry("Down", "\"Down\"")
2017-09-26 13:04:14 +00:00
.entry("Home", "\"Home\"")
.entry("End", "\"End\"")
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
}