native build on Windows

main
Ziyang Hu 2 years ago
parent 1beda859a0
commit 1429755717

2
.gitignore vendored

@ -27,7 +27,7 @@ compile_commands.json
CTestTestfile.cmake CTestTestfile.cmake
_deps _deps
_test* _test*
*.dll
*.db *.db
cozorocks/deps/ cozorocks/deps/
.DS_Store .DS_Store

@ -1,19 +1,32 @@
use std::env::var; use std::env::var;
fn main() { fn main() {
cxx_build::bridge("src/bridge/mod.rs") let target = var("TARGET").unwrap();
.files(["bridge/status.cpp", "bridge/db.cpp", "bridge/tx.cpp"])
let mut builder = cxx_build::bridge("src/bridge/mod.rs");
builder.files(["bridge/status.cpp", "bridge/db.cpp", "bridge/tx.cpp"])
.include("deps/include") .include("deps/include")
.include("bridge") .include("bridge");
.flag_if_supported("-std=c++17") if target.contains("msvc") {
.compile("cozorocks"); builder.flag_if_supported("-std:c++17");
} else {
builder.flag_if_supported("-std=c++17");
};
builder.compile("cozorocks");
let manifest_dir = var("CARGO_MANIFEST_DIR").unwrap(); let manifest_dir = var("CARGO_MANIFEST_DIR").unwrap();
println!("cargo:rustc-link-search={}/deps/lib/", manifest_dir); println!("cargo:rustc-link-search={}/deps/lib/", manifest_dir);
println!("cargo:rustc-link-lib=rocksdb"); println!("cargo:rustc-link-lib=rocksdb");
println!("cargo:rustc-link-lib=z"); println!("cargo:rustc-link-lib=z");
println!("cargo:rustc-link-lib=bz2");
if target.contains("msvc") {
println!("cargo:rustc-link-lib=rpcrt4");
println!("cargo:rustc-link-lib=shlwapi");
} else {
println!("cargo:rustc-link-lib=bz2");
}
println!("cargo:rustc-link-lib=lz4"); println!("cargo:rustc-link-lib=lz4");
println!("cargo:rustc-link-lib=snappy"); println!("cargo:rustc-link-lib=snappy");
println!("cargo:rustc-link-lib=zstd"); println!("cargo:rustc-link-lib=zstd");

@ -1 +1 @@
Subproject commit e072c129d57a0883370034cecf6774c745c40f76 Subproject commit d52b520d5168de6be5f1494b2035b61ff0958c11
Loading…
Cancel
Save