build suil with symbols; pass features correctly

This commit is contained in:
🪞👃🪞 2024-07-24 16:33:44 +03:00
parent cb181b0d86
commit b1d8fc62a9
4 changed files with 57 additions and 26 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
target target
perf.data* perf.data*
flamegraph*.svg flamegraph*.svg
vgcore*

View file

@ -10,28 +10,20 @@ pub struct Instance(*mut self::bound::SuilInstance);
impl Host { impl Host {
pub fn new () -> Self { pub fn new () -> Self {
Self(unsafe { Self(unsafe {
let argv = &mut [] as *mut *mut *mut i8; let mut argv = [];
bound::suil_init(&mut 0, argv, 0); bound::suil_init(
&mut 0,
&mut argv as *mut *mut *mut i8,
0
);
bound::suil_host_new( bound::suil_host_new(
Some(Self::write), Some(write),
Some(Self::index), Some(index),
Some(Self::subscribe), None,
Some(Self::unsubscribe), None,
) )
}) })
} }
unsafe extern "C" fn write (
_: *mut c_void, _: u32, _: u32, _: u32, _: *const c_void
) {}
unsafe extern "C" fn index (
_: *mut c_void, _: *const i8
) -> u32 {0}
unsafe extern "C" fn subscribe (
_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
) -> u32 {0}
unsafe extern "C" fn unsubscribe (
_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
) -> u32 {0}
fn set_touch_func (&self) { fn set_touch_func (&self) {
unimplemented!(); unimplemented!();
} }
@ -68,6 +60,33 @@ impl Host {
} }
} }
unsafe extern "C" fn write (
_: *mut c_void, _: u32, _: u32, _: u32, _: *const c_void
) {
panic!("write")
}
unsafe extern "C" fn index (
_: *mut c_void, _: *const i8
) -> u32 {
panic!("index");
0
}
//unsafe extern "C" fn subscribe (
//_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
//) -> u32 {
//panic!("subscribe");
//0
//}
//unsafe extern "C" fn unsubscribe (
//_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
//) -> u32 {
//panic!("unsubscribe");
//0
//}
impl Drop for Host { impl Drop for Host {
fn drop (&mut self) -> () { fn drop (&mut self) -> () {
unsafe { unsafe {

View file

@ -2,21 +2,26 @@ use crate::*;
use std::sync::Arc; use std::sync::Arc;
#[test] #[test]
fn panics () { fn test_lv2_ui () {
let host = Host::new(); let host = Host::new();
let mut plugin = plugin::LV2Plugin::new("file:///home/user/.lv2/Odin2.lv2").unwrap(); let mut plugin = plugin::LV2Plugin::new("file:///home/user/.lv2/Odin2.lv2").unwrap();
for ui in plugin.plugin.raw().uis().unwrap().iter() {
println!("{:?}", ui.uri());
println!("{:?}", ui.classes());
}
let mut features = [];
std::mem::forget(features);
let instance = Arc::new(host.instance( let instance = Arc::new(host.instance(
&mut plugin, &mut plugin.instance.raw(),
"", "http://lv2plug.in/ns/extensions/ui#X11UI",
"https://thewavewarden.com/odin2", "https://thewavewarden.com/odin2",
"https://thewavewarden.com/odin2#ParentUI", "https://thewavewarden.com/odin2#ParentUI",
"", "/home/user/.lv2/Odin2.lv2",
"",
"/home/user/.lv2/Odin2.lv2/Odin2.so", "/home/user/.lv2/Odin2.lv2/Odin2.so",
&[], "/home/user/.lv2/Odin2.lv2/Odin2.so",
&features,
).unwrap()); ).unwrap());
self::ui::UI::run(&instance).join(); self::ui::UI::run(&instance).join();
panic!();
} }
mod ui { mod ui {

View file

@ -1,5 +1,11 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
{pkgs?import<nixpkgs>{}}:pkgs.mkShell{ {pkgs?import<nixpkgs>{}}:let
suil = pkgs.enableDebugging (pkgs.suil.overrideAttrs (a: b: {
dontStrip = true; separateDebugInfo = true;
}));
in pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
freetype freetype