diff --git a/rust_binding/Cargo.toml b/rust_binding/Cargo.toml index ab94e15..b2d5560 100644 --- a/rust_binding/Cargo.toml +++ b/rust_binding/Cargo.toml @@ -8,3 +8,4 @@ edition = "2018" [build-dependencies] bindgen = "0.42.2" +cmake = "0.1" diff --git a/rust_binding/build.rs b/rust_binding/build.rs index 436f988..745ee57 100644 --- a/rust_binding/build.rs +++ b/rust_binding/build.rs @@ -1,10 +1,18 @@ +use cmake::Config; use bindgen; use std::env; use std::path::PathBuf; 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() .header("wrapper.h")