Skip to content

Commit

Permalink
feat: switch to manual C bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
philpax committed Mar 16, 2023
1 parent 7674bef commit 8bf82b0
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 151 deletions.
122 changes: 0 additions & 122 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ggml-raw/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[build-dependencies.bindgen]
version = "^0.62.0"

[build-dependencies.cc]
version = "^1.0"

Expand Down
18 changes: 0 additions & 18 deletions ggml-raw/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::env;
use std::path::PathBuf;

fn main() {
// By default, this crate will attempt to compile ggml with the features of your host system if
Expand All @@ -14,7 +13,6 @@ fn main() {

// This is a very basic heuristic for applying compile flags.
// Feel free to update this to fit your operating system.

let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let is_release = env::var("PROFILE").unwrap() == "release";
let compiler = build.get_compiler();
Expand Down Expand Up @@ -59,22 +57,6 @@ fn main() {
build.define("NDEBUG", None);
}
build.compile("ggml");

let bindings = bindgen::Builder::default()
.header("ggml/ggml.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.allowlist_function("ggml_.*")
.allowlist_type("ggml_.*")
.allowlist_var("ggml_.*")
.allowlist_file("ggml_.*")
.generate()
.expect("Unable to generate bindings");

let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());

bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}

fn get_supported_target_features() -> std::collections::HashSet<String> {
Expand Down
Loading

0 comments on commit 8bf82b0

Please sign in to comment.