ristate/build.rs
Bryan Ndjeutcha 39a7f3e37b fixing #3
2021-11-20 18:10:11 -05:00

24 lines
714 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/"));
let protocol_file= protocol_name.replace("_", "-");
protocol_dir.push_str(&protocol_file);
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);
}