2024-11-05 08:27:13 +00:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2024-10-29 10:46:58 +00:00
|
|
|
fn main() {
|
2024-11-05 08:27:13 +00:00
|
|
|
std::env::var("MESON_BUILD_ROOT").expect("build this through meson please!!");
|
|
|
|
let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
|
|
|
|
|
|
|
// compile blueprints
|
|
|
|
{
|
|
|
|
let mut command = std::process::Command::new("blueprint-compiler");
|
|
|
|
|
|
|
|
command
|
|
|
|
.arg("batch-compile")
|
|
|
|
.arg(out_path.join("resources"))
|
|
|
|
.arg("resources");
|
|
|
|
|
|
|
|
for source in [
|
|
|
|
"play_queue.blp",
|
|
|
|
"play_queue_song.blp",
|
|
|
|
"playbar.blp",
|
|
|
|
"setup.blp",
|
|
|
|
"window.blp",
|
|
|
|
] {
|
|
|
|
command.arg(format!("resources/{source}"));
|
|
|
|
}
|
|
|
|
|
|
|
|
let output = command.output().unwrap();
|
|
|
|
assert!(
|
|
|
|
output.status.success(),
|
2024-11-05 08:37:29 +00:00
|
|
|
"blueprint-compiler failed with exit status {} and stdout:\n{}",
|
2024-11-05 08:27:13 +00:00
|
|
|
output.status,
|
2024-11-05 08:37:29 +00:00
|
|
|
String::from_utf8_lossy(&output.stdout)
|
2024-11-05 08:27:13 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
println!("cargo::rerun-if-changed=resources");
|
|
|
|
}
|
|
|
|
|
2024-10-29 10:46:58 +00:00
|
|
|
glib_build_tools::compile_resources(
|
2024-11-05 08:27:13 +00:00
|
|
|
&[PathBuf::from("resources"), out_path.join("resources")],
|
2024-10-29 10:46:58 +00:00
|
|
|
"resources/audrey.gresource.xml",
|
|
|
|
"audrey.gresource",
|
|
|
|
);
|
2024-10-30 08:00:49 +00:00
|
|
|
|
|
|
|
// TODO: consider using meson to pass include paths
|
2024-11-05 08:27:13 +00:00
|
|
|
println!("cargo::rustc-link-lib=mpv");
|
2024-10-30 08:00:49 +00:00
|
|
|
let bindings = bindgen::Builder::default()
|
|
|
|
.header("src/mpv/wrapper.h")
|
|
|
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
|
|
|
.generate()
|
|
|
|
.expect("could not generate bindings for mpv");
|
|
|
|
bindings
|
|
|
|
.write_to_file(out_path.join("mpv_ffi.rs"))
|
|
|
|
.expect("could not write mpv bindings");
|
2024-10-29 10:46:58 +00:00
|
|
|
}
|