olm: Add inital bindgen generated olm-sys bindings.

master
Damir Jelić 2019-10-24 22:38:36 +02:00
parent 69a18e9d3a
commit e3d89f01f6
4 changed files with 41 additions and 0 deletions

View 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"

View 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!");
}

View 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"));

View File

@ -0,0 +1 @@
#include <olm/olm.h>