Unverified Commit bac3ef61 authored by David Wong's avatar David Wong Committed by GitHub

Making static linking of libstdc++ a feature (#463)

Closes https://github.com/tikv/rust-rocksdb/issues/461Signed-off-by: 's avatarDavid Wong <davidwg@calibra.com>
parent c79d2c2a
......@@ -18,6 +18,7 @@ tempfile = "3.1"
[features]
default = []
static_libcpp = []
encryption = ["openssl-sys"]
jemalloc = ["jemalloc-sys"]
# portable doesn't require static link, though it's meaningless
......
......@@ -111,10 +111,13 @@ fn link_cpp(build: &mut Build) {
return;
}
// remove lib prefix and .a postfix.
println!(
"cargo:rustc-link-lib=static={}",
&stdlib[3..stdlib.len() - 2]
);
let libname = &stdlib[3..stdlib.len() - 2];
// optional static linking
if cfg!(feature = "static_libcpp") {
println!("cargo:rustc-link-lib=static={}", &libname);
} else {
println!("cargo:rustc-link-lib=dylib={}", &libname);
}
println!(
"cargo:rustc-link-search=native={}",
path.parent().unwrap().display()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment