Revert "use cargo to compile blueprints"
This reverts commit 630b44b352
.
This commit is contained in:
parent
4e434a7929
commit
02e3415e72
4 changed files with 31 additions and 71 deletions
42
build.rs
42
build.rs
|
@ -1,53 +1,21 @@
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
std::env::var("MESON_BUILD_ROOT").expect("build this through meson please!!");
|
let meson_build_root =
|
||||||
let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
std::env::var("MESON_BUILD_ROOT").expect("build this through meson please!!");
|
||||||
|
|
||||||
// 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(),
|
|
||||||
"blueprint-compiler failed with exit status {} and stdout:\n{}",
|
|
||||||
output.status,
|
|
||||||
String::from_utf8_lossy(&output.stdout)
|
|
||||||
);
|
|
||||||
|
|
||||||
println!("cargo::rerun-if-changed=resources");
|
|
||||||
}
|
|
||||||
|
|
||||||
glib_build_tools::compile_resources(
|
glib_build_tools::compile_resources(
|
||||||
&[PathBuf::from("resources"), out_path.join("resources")],
|
&["resources", &format!("{meson_build_root}/resources")],
|
||||||
"resources/audrey.gresource.xml",
|
"resources/audrey.gresource.xml",
|
||||||
"audrey.gresource",
|
"audrey.gresource",
|
||||||
);
|
);
|
||||||
println!("cargo::rerun-if-changed=resources/audrey.gresource.xml");
|
println!("cargo::rerun-if-changed=resources/audrey.gresource.xml");
|
||||||
|
|
||||||
// TODO: consider using meson to pass include paths
|
// TODO: consider using meson to pass include paths
|
||||||
println!("cargo::rustc-link-lib=mpv");
|
println!("cargo:rustc-link-lib=mpv");
|
||||||
let bindings = bindgen::Builder::default()
|
let bindings = bindgen::Builder::default()
|
||||||
.header("src/mpv/wrapper.h")
|
.header("src/mpv/wrapper.h")
|
||||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||||
.generate()
|
.generate()
|
||||||
.expect("could not generate bindings for mpv");
|
.expect("could not generate bindings for mpv");
|
||||||
|
let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
||||||
bindings
|
bindings
|
||||||
.write_to_file(out_path.join("mpv_ffi.rs"))
|
.write_to_file(out_path.join("mpv_ffi.rs"))
|
||||||
.expect("could not write mpv bindings");
|
.expect("could not write mpv bindings");
|
||||||
|
|
|
@ -38,6 +38,7 @@ add_project_arguments(
|
||||||
|
|
||||||
subdir('data')
|
subdir('data')
|
||||||
subdir('po')
|
subdir('po')
|
||||||
|
subdir('resources')
|
||||||
subdir('src')
|
subdir('src')
|
||||||
|
|
||||||
if get_option('buildtype') == 'debug'
|
if get_option('buildtype') == 'debug'
|
||||||
|
@ -59,6 +60,7 @@ custom_target(
|
||||||
'cargo-build',
|
'cargo-build',
|
||||||
build_by_default: true,
|
build_by_default: true,
|
||||||
build_always_stale: true,
|
build_always_stale: true,
|
||||||
|
depends: blueprints,
|
||||||
input: config_rs,
|
input: config_rs,
|
||||||
console: true,
|
console: true,
|
||||||
# means nothing (always stale and uncopied), we can't cp since env: drops the /bin/sh wrapper
|
# means nothing (always stale and uncopied), we can't cp since env: drops the /bin/sh wrapper
|
||||||
|
|
24
resources/meson.build
Normal file
24
resources/meson.build
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
blueprints = custom_target(
|
||||||
|
'blueprints',
|
||||||
|
input: files(
|
||||||
|
'play_queue.blp',
|
||||||
|
'play_queue_song.blp',
|
||||||
|
'playbar.blp',
|
||||||
|
'setup.blp',
|
||||||
|
'window.blp',
|
||||||
|
),
|
||||||
|
output: [
|
||||||
|
'play_queue.ui',
|
||||||
|
'play_queue_song.ui',
|
||||||
|
'playbar.ui',
|
||||||
|
'setup.ui',
|
||||||
|
'window.ui',
|
||||||
|
],
|
||||||
|
command: [
|
||||||
|
find_program('blueprint-compiler'),
|
||||||
|
'batch-compile',
|
||||||
|
'@OUTDIR@',
|
||||||
|
'@CURRENT_SOURCE_DIR@',
|
||||||
|
'@INPUT@',
|
||||||
|
],
|
||||||
|
)
|
|
@ -1,34 +0,0 @@
|
||||||
use std::future::Future;
|
|
||||||
use std::task::Waker;
|
|
||||||
|
|
||||||
pub struct WaitEvent<'a>(&'a Handle);
|
|
||||||
|
|
||||||
impl Future for WaitEvent {
|
|
||||||
type Output = Event;
|
|
||||||
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
|
||||||
// set wakeup before polling, don't miss any wakeup events
|
|
||||||
{
|
|
||||||
let waker = self.0.wakeup.lock();
|
|
||||||
match waker.as_mut() {
|
|
||||||
None => *waker = cx.waker().clone(),
|
|
||||||
Some(waker) if !cx.waker().will_wake(waker) => *waker = cx.waker().clone,
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match self.0.wait_event_timeout(0.0) {
|
|
||||||
Some(event) => Poll::Ready(event),
|
|
||||||
None => Poll::Pending,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) extern "C" fn callback(d: *mut c_void) {
|
|
||||||
let d = d as *const Mutex<Option<Waker>>;
|
|
||||||
let waker = unsafe { &*d };
|
|
||||||
let waker = waker.lock().unwrap();
|
|
||||||
if let Some(waker) = waker.take() {
|
|
||||||
waker.wake();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue