ristate/build.rs
2021-11-20 18:13:23 -05:00

23 lines
676 B
Rust

extern crate wayland_scanner;
use std::path::Path;
use wayland_scanner::{generate_code, Side};
pub fn main() {
generate("river_status_unstable_v1");
}
fn generate(protocol_name: &str) {
let out_dir = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/src/wayland/"));
let mut protocol_dir = String::from(concat!(env!("CARGO_MANIFEST_DIR"), "/protocol/"));
protocol_dir.push_str(&protocol_name.replace("_", "-"));
protocol_dir.push_str(".xml");
let protocol = Path::new(&protocol_dir);
let mut protocol_file = protocol_name.to_string();
protocol_file.push_str(".rs");
generate_code(protocol, out_dir.join(protocol_file), Side::Client);
}