olm: Add inital bindgen generated olm-sys bindings.
This commit is contained in:
parent
69a18e9d3a
commit
e3d89f01f6
4 changed files with 41 additions and 0 deletions
14
nio-olm/nio-olm-sys/Cargo.toml
Normal file
14
nio-olm/nio-olm-sys/Cargo.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "nio-olm-sys"
|
||||
version = "3.1.4-beta"
|
||||
authors = ["Damir Jelić <poljar@termina.org.uk>"]
|
||||
description = "Low level bindings for the Olm C library"
|
||||
license = "ISC"
|
||||
edition = "2018"
|
||||
build = "build.rs"
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.51.1"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2.65"
|
21
nio-olm/nio-olm-sys/build.rs
Normal file
21
nio-olm/nio-olm-sys/build.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use bindgen::Bindings;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn build(file: &str) -> Result<Bindings, ()> {
|
||||
println!("cargo:rustc-link-lib=olm");
|
||||
|
||||
bindgen::Builder::default()
|
||||
.rustfmt_bindings(true)
|
||||
.header(file)
|
||||
.generate()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let bindings = build("src/wrapper.h").expect("Unable to build 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!");
|
||||
}
|
5
nio-olm/nio-olm-sys/src/lib.rs
Normal file
5
nio-olm/nio-olm-sys/src/lib.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
1
nio-olm/nio-olm-sys/src/wrapper.h
Normal file
1
nio-olm/nio-olm-sys/src/wrapper.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <olm/olm.h>
|
Loading…
Reference in a new issue