rust_binding now builds C lib Release/Debug

This commit is contained in:
Stephen Seo 2019-04-22 18:18:03 +09:00
parent b703247aed
commit 5dd42a6e23

View file

@ -5,11 +5,17 @@ use std::env;
use std::path::PathBuf; use std::path::PathBuf;
fn main() { fn main() {
let mut dst = Config::new("../c_impl") let mut config = Config::new("../c_impl");
.define("NDEBUG", "true") let mut dst: PathBuf;
.cflag("-O3") if env::var("PROFILE").unwrap().eq("release") {
.build(); config.define("CMAKE_BUILD_TYPE", "Release");
dst.push("build"); dst = config.build();
dst.push("lib");
} else {
config.define("CMAKE_BUILD_TYPE", "Debug");
dst = config.build();
dst.push("build");
}
println!("cargo:rustc-link-search=native={}", dst.display()); println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=static=UDPConnection"); println!("cargo:rustc-link-lib=static=UDPConnection");