|
|
|
@ -63,7 +63,9 @@ fn build_rocksdb() { |
|
|
|
|
|
|
|
|
|
if cfg!(feature = "lz4") { |
|
|
|
|
config.define("LZ4", Some("1")); |
|
|
|
|
config.include("lz4/lib/"); |
|
|
|
|
if let Some(path) = env::var_os("DEP_LZ4_INCLUDE") { |
|
|
|
|
config.include(path); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if cfg!(feature = "zstd") { |
|
|
|
@ -285,26 +287,6 @@ fn build_snappy() { |
|
|
|
|
config.compile("libsnappy.a"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn build_lz4() { |
|
|
|
|
let mut compiler = cc::Build::new(); |
|
|
|
|
|
|
|
|
|
compiler |
|
|
|
|
.file("lz4/lib/lz4.c") |
|
|
|
|
.file("lz4/lib/lz4frame.c") |
|
|
|
|
.file("lz4/lib/lz4hc.c") |
|
|
|
|
.file("lz4/lib/xxhash.c"); |
|
|
|
|
|
|
|
|
|
compiler.opt_level(3); |
|
|
|
|
|
|
|
|
|
let target = env::var("TARGET").unwrap(); |
|
|
|
|
|
|
|
|
|
if &target == "i686-pc-windows-gnu" { |
|
|
|
|
compiler.flag("-fno-tree-vectorize"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
compiler.compile("liblz4.a"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn try_to_find_and_link_lib(lib_name: &str) -> bool { |
|
|
|
|
if let Ok(v) = env::var(&format!("{}_COMPILE", lib_name)) { |
|
|
|
|
if v.to_lowercase() == "true" || v == "1" { |
|
|
|
@ -378,11 +360,6 @@ fn main() { |
|
|
|
|
fail_on_empty_directory("snappy"); |
|
|
|
|
build_snappy(); |
|
|
|
|
} |
|
|
|
|
if cfg!(feature = "lz4") && !try_to_find_and_link_lib("LZ4") { |
|
|
|
|
println!("cargo:rerun-if-changed=lz4/"); |
|
|
|
|
fail_on_empty_directory("lz4"); |
|
|
|
|
build_lz4(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Allow dependent crates to locate the sources and output directory of
|
|
|
|
|
// this crate. Notably, this allows a dependent crate to locate the RocksDB
|
|
|
|
|