Skip to content

Commit

Permalink
chore: generate C bindings for minimap crate only into output dir
Browse files Browse the repository at this point in the history
In `minimap-sys` crate: this removes hardcoded `bindings.rs` in favor of always dynamically rebuilding them with `rust-bindgen`. The `vendored` feature of `minimap-sys` is removed and is always enabled now.

This is required to avoid clashes when compiling for different platforms and operating systems - the bindings are generated slightly differently on different setups.

It's a [best practice](https://rust-lang.github.io/rust-bindgen/tutorial-3.html) anyways.
  • Loading branch information
ivan-aksamentov committed Dec 23, 2024
1 parent 3b81b9e commit ea861d4
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 5,817 deletions.
9 changes: 1 addition & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ zstd = { version = "=0.13.2", features = ["zstdmt"] }


minimap2 = { path = "packages/minimap2", features = ["serde"] }
minimap2-sys = { path = "packages/minimap2-sys", features = ["simde", "static", "vendored", "stock-zlib"] }
#minimap2-sys = { path = "packages/minimap2-sys", features = ["simde", "vendored"] }
minimap2-sys = { path = "packages/minimap2-sys", features = ["simde", "static", "stock-zlib"] }


approx = "=0.5.1"
atty = "=0.2.14"
auto_ops = "=0.3.0"
bio = "=2.0.3"
bio-types = "=1.0.4"
chrono = { version = "=0.4.38", default-features = false, features = ["clock", "std", "wasmbind"] }
clap = { version = "=4.5.17", features = ["derive", "color", "unicode", "unstable-styles"] }
clap-markdown = "=0.1.4"
Expand All @@ -63,26 +61,21 @@ itertools = "=0.13.0"
lazy_static = "=1.5.0"
log = "=0.4.22"
maplit = "=1.0.2"
memoize = { version = "=0.4.2", features = ["full"] }
ndarray = { version = "=0.16.1", features = ["rayon", "serde", "blas", "approx"] }
ndarray-rand = "=0.15.0"
ndarray-stats = "=0.6.0"
noodles = { version = "=0.60.0", features = ["core", "sam"] }
num = "=0.4.3"
num-integer = "=0.1.46"
num-traits = "=0.2.19"
num_cpus = "=1.16.0"
ordered-float = { version = "=4.2.2", features = ["serde"] }
parking_lot = { version = "=0.12.3", features = ["deadlock_detection", "hardware-lock-elision", "serde", "arc_lock"] }
pretty_assertions = "=1.4.1"
pretty_dtoa = "=0.3.0"
rand = { version = "=0.8.5", features = ["serde1", "log"] }
rand_distr = { version = "=0.4.3", features = ["serde1", "std_math"] }
rand_isaac = { version = "=0.3.0", features = ["serde1"] }
rayon = "=1.10.0"
regex = "=1.11.0"
rstest = "=0.22.0"
rstest_reuse = "=0.7.0"
schemars = { version = "=1.0.0-alpha.15", features = ["chrono04", "either1", "enumset1", "indexmap2", "raw_value", "schemars_derive", "preserve_order"] }
serde = { version = "=1.0.210", features = ["derive"] }
serde-aux = "=4.5.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/minimap2-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ exclude = [
libz-sys = { version = "1.1.20", default-features = false }

[build-dependencies]
bindgen = { version = "0.70.1", features = ["which-rustfmt", "runtime"], optional = true }
bindgen = { version = "0.70.1", features = ["which-rustfmt", "runtime"] }
cc = { version = "1.1.21" }

[features]
default = ["libz-sys/libc"]
vendored = ["bindgen"]
sse2only = []
simde = []
noopt = []
Expand Down
8 changes: 0 additions & 8 deletions packages/minimap2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ fn sse2only(cc: &mut cc::Build) {
}
}

#[cfg(feature = "bindgen")]
fn gen_bindings() {
let out_path = PathBuf::from(env::var_os("OUT_DIR").unwrap());

Expand All @@ -226,15 +225,8 @@ fn gen_bindings() {
bigings
.write_to_file(out_path.join("bindings.rs"))
.expect("Unable to create bindings");

bigings
.write_to_file("src/bindings.rs")
.expect("Unable to create bindings");
}

#[cfg(not(feature = "bindgen"))]
fn gen_bindings() {}

fn main() {
compile();
gen_bindings();
Expand Down
Loading

0 comments on commit ea861d4

Please sign in to comment.