Allow rust_binding to build the C library
This commit is contained in:
parent
ad83caa6e5
commit
ce4a8c56ac
2 changed files with 10 additions and 1 deletions
|
@ -8,3 +8,4 @@ edition = "2018"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
bindgen = "0.42.2"
|
bindgen = "0.42.2"
|
||||||
|
cmake = "0.1"
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
|
use cmake::Config;
|
||||||
use bindgen;
|
use bindgen;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rustc-link-lib=UDPConnection");
|
let mut dst = Config::new("../c_impl")
|
||||||
|
.define("NDEBUG", "true")
|
||||||
|
.cflag("-O3")
|
||||||
|
.build();
|
||||||
|
dst.push("build");
|
||||||
|
|
||||||
|
println!("cargo:rustc-link-search=native={}", dst.display());
|
||||||
|
println!("cargo:rustc-link-lib=static=UDPConnection");
|
||||||
|
|
||||||
let bindings = bindgen::Builder::default()
|
let bindings = bindgen::Builder::default()
|
||||||
.header("wrapper.h")
|
.header("wrapper.h")
|
||||||
|
|
Loading…
Reference in a new issue