diff --git a/Cargo.toml b/Cargo.toml index b5eccc6..a279902 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ libc = "0.2" linkme = "0.3" [build-dependencies] -bindgen = "0.70" +bindgen = "0.72" [lib] crate-type = ["rlib"] diff --git a/build.rs b/build.rs index c41652a..77122d9 100644 --- a/build.rs +++ b/build.rs @@ -34,12 +34,23 @@ fn main() { let output_dir = env::var("OUT_DIR").expect("Can not find out directory"); - let build = bindgen::Builder::default(); - - let bindings = build + let mut build = bindgen::Builder::default() .header("src/mr.h") .size_t_is_usize(true) - .layout_tests(false) + .layout_tests(false); + + if std::env::consts::OS == "macos" { + if let Ok(output) = Command::new("xcrun").args(["--show-sdk-path"]).output() { + if let Ok(sysroot) = String::from_utf8(output.stdout) { + let sysroot = sysroot.trim(); + if !sysroot.is_empty() { + build = build.clang_arg(format!("-isysroot{sysroot}")); + } + } + } + } + + let bindings = build .generate() .expect("error generating bindings"); diff --git a/src/cluster.h b/src/cluster.h index e2c3995..97331b8 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -35,6 +35,7 @@ int MR_IsClusterInitialize(); size_t MR_ClusterGetSize(); + int MR_ClusterInit(RedisModuleCtx* rctx, char *password); size_t MR_ClusterGetSlotByKey(const char* key, size_t len);