cosmic-comp/build.rs

29 lines
944 B
Rust
Raw Normal View History

// SPDX-License-Identifier: GPL-3.0-only
2022-03-16 20:19:12 +01:00
extern crate wayland_scanner;
2022-03-22 12:37:46 +01:00
use std::{env, path::PathBuf, process::Command};
use wayland_scanner::{generate_code, Side};
fn main() {
if let Some(output) = Command::new("git")
.args(&["rev-parse", "HEAD"])
.output()
.ok()
{
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
}
2022-03-16 20:19:12 +01:00
let dest = PathBuf::from(&env::var("OUT_DIR").unwrap());
// Location of the xml file, relative to the `Cargo.toml`
let drm_protocol_file = "resources/wayland-drm.xml";
2022-04-27 21:32:48 +02:00
let ext_workspace_protocol_file = "resources/ext-workspace-unstable-v1.xml";
2022-03-16 20:19:12 +01:00
// Target directory for the generate files
2022-03-22 12:37:46 +01:00
generate_code(drm_protocol_file, &dest.join("wl_drm.rs"), Side::Server);
2022-05-03 13:37:51 +02:00
generate_code(
ext_workspace_protocol_file,
&dest.join("ext_workspace.rs"),
Side::Server,
);
}