Private
Public Access
1
0
Files
Kordophone/kpcli/build.rs

29 lines
892 B
Rust
Raw Normal View History

2025-02-12 00:10:33 -08:00
const KORDOPHONE_XML: &str = "../kordophoned/include/net.buzzert.kordophonecd.Server.xml";
#[cfg(not(target_os = "linux"))]
fn main() {
// No D-Bus codegen on non-Linux platforms
}
#[cfg(target_os = "linux")]
2025-02-12 00:10:33 -08:00
fn main() {
let out_dir = std::env::var("OUT_DIR").unwrap();
let out_path = std::path::Path::new(&out_dir).join("kordophone-client.rs");
let opts = dbus_codegen::GenOpts {
connectiontype: dbus_codegen::ConnectionType::Blocking,
methodtype: None,
..Default::default()
};
let xml = std::fs::read_to_string(KORDOPHONE_XML)
.expect("Error reading server dbus interface");
2025-02-12 00:10:33 -08:00
let output = dbus_codegen::generate(&xml, &opts)
.expect("Error generating client dbus interface");
2025-02-12 00:10:33 -08:00
2025-06-06 16:39:31 -07:00
std::fs::write(out_path, output).expect("Error writing client dbus code");
2025-02-12 00:10:33 -08:00
println!("cargo:rerun-if-changed={}", KORDOPHONE_XML);
2025-06-06 16:39:31 -07:00
}