diff options
author | Malte Voos <git@mal.tc> | 2025-10-01 00:20:10 +0200 |
---|---|---|
committer | Malte Voos <git@mal.tc> | 2025-10-01 00:20:10 +0200 |
commit | 338babaad2189f7ff1ee088994c8c20a0646ff4d (patch) | |
tree | 29fb2620f748d32a42c1d1eb3346771600a8d75b /build.rs | |
download | lleap-338babaad2189f7ff1ee088994c8c20a0646ff4d.tar.gz lleap-338babaad2189f7ff1ee088994c8c20a0646ff4d.zip |
init
Diffstat (limited to 'build.rs')
-rw-r--r-- | build.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..9e7d61e --- /dev/null +++ b/build.rs @@ -0,0 +1,33 @@ +use std::env; +use std::path::Path; +use std::process::Command; + +fn main() { + // Tell cargo to rerun this build script if the schema file changes + println!("cargo:rerun-if-changed=data/tc.mal.lleap.gschema.xml"); + + let out_dir = env::var("OUT_DIR").unwrap(); + let schema_dir = Path::new(&out_dir).join("glib-2.0").join("schemas"); + + // Create the schema directory + std::fs::create_dir_all(&schema_dir).unwrap(); + + // Copy the schema file to the output directory + std::fs::copy( + "data/tc.mal.lleap.gschema.xml", + schema_dir.join("tc.mal.lleap.gschema.xml"), + ) + .unwrap(); + + // Compile the schema using glib-compile-schemas + Command::new("glib-compile-schemas") + .arg(&schema_dir) + .output() + .unwrap(); + + // Set environment variable for the schema directory + println!( + "cargo:rustc-env=GSETTINGS_SCHEMA_DIR={}", + schema_dir.display() + ); +} |