From: Stephen Seo Date: Mon, 22 Apr 2019 08:54:37 +0000 (+0900) Subject: Allow rust_binding to build the C library X-Git-Tag: 1.0~204 X-Git-Url: https://git.seodisparate.com/stephenseo/js/darkmode.js?a=commitdiff_plain;h=ce4a8c56acc8ae0d24f954eae37751eba95ec01d;p=UDPConnection Allow rust_binding to build the C library --- 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")