use std::path::PathBuf; use std::process::Command; fn main() { // Compile GResources glib_build_tools::compile_resources( &["data"], "data/resources.gresource.xml", "driftwood.gresource", ); // Compile GSettings schema for development builds let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap()); let schema_dir = out_dir.join("gschemas"); std::fs::create_dir_all(&schema_dir).expect("Failed to create schema dir"); std::fs::copy( "data/app.driftwood.Driftwood.gschema.xml", schema_dir.join("app.driftwood.Driftwood.gschema.xml"), ) .expect("Failed to copy schema"); let status = Command::new("glib-compile-schemas") .arg(&schema_dir) .status() .expect("Failed to run glib-compile-schemas"); if !status.success() { panic!("glib-compile-schemas failed"); } println!( "cargo::rustc-env=GSETTINGS_SCHEMA_DIR={}", schema_dir.display() ); // Set LOCALEDIR for i18n support (development builds use a local path) let locale_dir = out_dir.join("locale"); std::fs::create_dir_all(&locale_dir).ok(); println!( "cargo::rustc-env=LOCALEDIR={}", locale_dir.display() ); }