Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snappy codec support #16

Merged
merged 1 commit into from
Jun 22, 2024
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
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;