bindgen isn't even close to working; std::string is hard

This commit is contained in:
Chris West (Faux) 2017-07-12 20:01:29 +01:00
commit 39d8438d3a
6 changed files with 53 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/target/
**/*.rs.bk
Cargo.lock
.idea
*.iml

9
Cargo.toml Normal file
View File

@ -0,0 +1,9 @@
[package]
name = "apt-native"
version = "0.1.0"
authors = ["Chris West (Faux) <git@goeswhere.com>"]
[dependencies]
[build-dependencies]
bindgen = "0.26.3"

20
build.rs Normal file
View File

@ -0,0 +1,20 @@
extern crate bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
// command to cargo:
println!("cargo:rustc-link-lib=apt-pkg");
let bindings = bindgen::Builder::default()
.header("wrapper.hpp")
.whitelisted_type("URI")
.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!");
}

10
src/lib.rs Normal file
View File

@ -0,0 +1,10 @@
mod raw;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
}
}

5
src/raw.rs Normal file
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"));

4
wrapper.hpp Normal file
View File

@ -0,0 +1,4 @@
#define APT_8_CLEANER_HEADERS
#define APT_9_CLEANER_HEADERS
#define APT_10_CLEANER_HEADERS
#include <apt-pkg/strutl.h>