//! Embed the desktop icon for `cargo run` as well as Flatpak builds. //! `glib-compile-resources` is provided by the GLib development tools. use std::{env, path::PathBuf, process::Command}; fn main() { println!("cargo:rerun-if-changed=data/simpam.gresource.xml"); println!("cargo:rerun-if-changed=data/icons/hicolor/scalable/apps/at.criticalcare.SimPaM.svg"); let source_root = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR") .expect("Cargo must provide CARGO_MANIFEST_DIR")); let target = PathBuf::from(env::var_os("OUT_DIR") .expect("Cargo must provide OUT_DIR")).join("simpam.gresource"); let result = Command::new("glib-compile-resources") .arg(source_root.join("data/simpam.gresource.xml")) .arg(format!("--sourcedir={}", source_root.join("data").display())) .arg(format!("--target={}", target.display())) .status() .expect("glib-compile-resources is required (install glib2-devel on Fedora)"); assert!(result.success(), "failed to compile SimPaM icon resources"); }