Skip to content

Commit

Permalink
Merge pull request #16 from LDeakin/snappy_support
Browse files Browse the repository at this point in the history
Add snappy codec support
  • Loading branch information
mulimoen authored Jun 22, 2024
2 parents 259b085 + 8fb18e2 commit 9c12026
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blosc-src"
version = "0.3.2"
version = "0.3.3"
authors = ["Magnus Ulimoen <[email protected]>"]
edition = "2021"
build = "build.rs"
Expand All @@ -22,6 +22,7 @@ readme = "README.md"
zlib = ["dep:libz-sys"]
zstd = ["dep:zstd-sys"]
lz4 = ["dep:lz4-sys"]
snappy = ["dep:snappy_src"]

[build-dependencies]
cc = "1.0"
Expand All @@ -30,3 +31,4 @@ cc = "1.0"
libz-sys = { version = "1.1.12", optional = true, default-features = false, features = ["static", "libc"] }
zstd-sys = { version = "2.0.9", optional = true }
lz4-sys = { version = "1.9.4", optional = true }
snappy_src = { version = "0.2.2", optional = true }
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The crate builds `c-blosc` from source using the `cc` crate. As such it is requi
* `zlib`
* `zstd`
* `lz4`
* `snappy`

When these are requested they will be built from source and available for use by `blosc`.

Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ fn main() {
build.include(&zstd_include_dir);
build.define("HAVE_ZSTD", None);
}
if cfg!(feature = "snappy") {
let snappy_include_dir = std::env::var_os("DEP_SNAPPY_INCLUDE").unwrap();
build.include(&snappy_include_dir);
build.define("HAVE_SNAPPY", None);
}

let linklib = if cfg!(target_env = "msvc") {
"libblosc"
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ extern crate zstd_sys;

#[cfg(feature = "lz4")]
extern crate lz4_sys;

#[cfg(feature = "snappy")]
extern crate snappy_src;

0 comments on commit 9c12026

Please sign in to comment.