Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

Commit 3d96d68

Browse files
authored
Merge pull request #19 from paritytech/andre/support-windows-build-static-crt
Fix build issues on Windows and ARM
2 parents 86460c5 + d031a8d commit 3d96d68

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

rocksdb-sys/build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,22 @@ fn main() {
1818

1919
println!("cargo:rustc-link-lib=dylib={}", "rpcrt4");
2020
println!("cargo:rustc-link-lib=dylib={}", "shlwapi");
21+
22+
let features = env::var("CARGO_CFG_TARGET_FEATURE").unwrap_or_default();
23+
if features.contains("crt-static") {
24+
cfg.define("WITH_MD_LIBRARY", "OFF");
25+
}
2126
} else {
2227
cfg.define("SNAPPY_INCLUDE_DIR", snappy)
2328
.define("SNAPPY_LIBRARIES", "/dev/null");
2429
}
2530

31+
// NOTE: the cfg! macro doesn't work when cross-compiling, it would return values for the host
32+
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
33+
if target_arch == "arm" || target_arch == "aarch64" {
34+
cfg.define("PORTABLE", "ON");
35+
}
36+
2637
let out = cfg.build();
2738

2839
let mut build = out.join("build");

0 commit comments

Comments
 (0)