summary refs log tree commit diff
path: root/build.rs
blob: 875e8c60360c4535ba2ffa8546958445d730a400 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::env;
use std::path::Path;
use std::process::Command;

fn main() {
    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");

    std::fs::create_dir_all(&schema_dir).unwrap();

    std::fs::copy(
        "data/tc.mal.lleap.gschema.xml",
        schema_dir.join("tc.mal.lleap.gschema.xml"),
    )
    .unwrap();

    Command::new("glib-compile-schemas")
        .arg(&schema_dir)
        .output()
        .unwrap();

    println!(
        "cargo:rustc-env=GSETTINGS_SCHEMA_DIR={}",
        schema_dir.display()
    );
}