Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chdb-rust"
version = "1.1.0"
version = "1.2.0"
edition = "2021"
authors = ["Auxten"]
description = "chDB FFI bindings for Rust(Experimental)"
Expand Down
14 changes: 7 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,41 @@ fn find_libchdb_or_download(out_dir: &Path) -> Result<(PathBuf, PathBuf), Box<dy
if let Some((lib_dir, header_path)) = find_existing_libchdb() {
return Ok((lib_dir, header_path));
}

println!("cargo:warning=libchdb not found locally, attempting to download...");
download_libchdb_to_out_dir(out_dir)?;
let lib_dir = out_dir.to_path_buf();
let header_path = out_dir.join("chdb.h");

if !header_path.exists() {
return Err("Header file not found after download".into());
}

Ok((lib_dir, header_path))
}

fn find_existing_libchdb() -> Option<(PathBuf, PathBuf)> {
if Path::new("./libchdb.so").exists() && Path::new("./chdb.h").exists() {
return Some((PathBuf::from("."), PathBuf::from("./chdb.h")));
}

// Check system installation
let system_lib_path = Path::new("/usr/local/lib");
let system_header_path = Path::new("/usr/local/include/chdb.h");

if system_header_path.exists() {
if system_lib_path.join("libchdb.so").exists() ||
system_lib_path.join("libchdb.dylib").exists() {
return Some((system_lib_path.to_path_buf(), system_header_path.to_path_buf()));
}
}

None
}

fn download_libchdb_to_out_dir(out_dir: &Path) -> Result<(), Box<dyn std::error::Error>> {
let platform = get_platform_string()?;
let version = "v3.6.0";
let version = "v3.7.2";
let url = format!(
"https://github.com/chdb-io/chdb/releases/download/{}/{}",
version, platform
Expand Down