Add libvlc-sys crate
parent
97898ed074
commit
0417f9e2e8
|
@ -9,4 +9,5 @@
|
|||
|
||||
# Generated by Cargo
|
||||
/target/
|
||||
/libvlc-sys/target
|
||||
Cargo.lock
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "libvlc-sys"
|
||||
version = "0.1.0"
|
||||
authors = ["T. Okubo <t.okubo.rx78+devel@gmail.com>"]
|
||||
edition = "2018"
|
||||
build = "build.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.52"
|
|
@ -0,0 +1,24 @@
|
|||
use bindgen;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rustc-link-lib=libvlc");
|
||||
println!("cargo:rerun-if-changed=wrapper.h");
|
||||
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("wrapper.h")
|
||||
// For no_std
|
||||
.use_core()
|
||||
// Use libc
|
||||
.ctypes_prefix("libc")
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![no_std]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
|
@ -0,0 +1 @@
|
|||
#include <vlc/vlc.h>
|
Loading…
Reference in New Issue