Skip to content

Commit

Permalink
More flags from c-blosc2 and build wasm32 emscripten (#30)
Browse files Browse the repository at this point in the history
* Propagate flags from c-blosc2 - wasm32-emscripten CI job
* Add deactivate-zlib-optim for wasm32 compat
* Use forked wasm32 support branch
* CI updates
* Use c-blosc2 git tip f8723dc w/ wasm32 support

Blosc/c-blosc2@f8723dc
  • Loading branch information
milesgranger authored Sep 17, 2024
1 parent 181a4f2 commit 97a31e5
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 13 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@ jobs:
- name: Test
run: cross test --target ${{ matrix.target }} --no-default-features --features static --release

test-wasm32-emscripten:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build: [static, shared]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-emscripten

- name: Install Emscripten
uses: mymindstorm/setup-emsdk@v14

- name: Build
run: cargo build --target wasm32-unknown-emscripten --no-default-features --features deactivate-zlib-optim --features ${{ matrix.build }}

test-native:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
18 changes: 12 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blosc2-rs"
version = "0.3.0+2.15.1"
version = "0.3.1+2.15.1"
description = "Blosc2"
license = "MIT"
edition = "2021"
Expand All @@ -11,13 +11,19 @@ name = "blosc2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["shared"]
use-system-blosc2 = ["blosc2-sys/use-system-blosc2"]
regenerate-bindings = ["blosc2-sys/regenerate-bindings"]
static = ["blosc2-sys/static"]
shared = ["blosc2-sys/shared"]
use-system-blosc2 = ["blosc2-sys/use-system-blosc2"]
regenerate-bindings = ["blosc2-sys/regenerate-bindings"]
static = ["blosc2-sys/static"]
shared = ["blosc2-sys/shared"]
deactivate-zlib = ["blosc2-sys/deactivate-zlib"]
prefer-external-zlib = ["blosc2-sys/prefer-external-zlib"]
deactivate-zstd = ["blosc2-sys/deactivate-zstd"]
prefer-external-zstd = ["blosc2-sys/prefer-external-zstd"]
prefer-external-lz4 = ["blosc2-sys/prefer-external-lz4"]
deactivate-zlib-optim = ["blosc2-sys/deactivate-zlib-optim"]

[dependencies]
blosc2-sys = { path = "blosc2-sys", version = "0.3.0+2.15.1" }
blosc2-sys = { path = "blosc2-sys", version = "0.3.1+2.15.1" }
parking_lot = "^0.12"

[dev-dependencies]
Expand Down
20 changes: 15 additions & 5 deletions blosc2-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blosc2-sys"
version = "0.3.0+2.15.1"
version = "0.3.1+2.15.1"
edition = "2021"
description = "Bindings to C Blosc2"
license = "MIT"
Expand All @@ -22,11 +22,21 @@ libc = "^0.2"

[features]
default = []
static = []
shared = []
use-system-blosc2 = ["dep:pkg-config"]
static = []
shared = []

# Regenerate the bindings to c-blosc2 header, will require bindgen crate
use-system-blosc2 = ["dep:pkg-config"]
deactivate-zlib-optim = []

deactivate-zlib = []
prefer-external-zlib = []

deactivate-zstd = []
prefer-external-zstd = []

prefer-external-lz4 = []

# Regenerate the bindings to c-blosc2 header
regenerate-bindings = ["bindgen"]

[build-dependencies]
Expand Down
20 changes: 19 additions & 1 deletion blosc2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::PathBuf;
const VENDORED_BLOSC2_VERSION: &'static str = "2.15.1";

fn main() {
println!("cargo::rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=build.rs");

// build blosc2 from source
#[cfg(not(feature = "use-system-blosc2"))]
Expand Down Expand Up @@ -41,6 +41,24 @@ fn main() {
.define("CMAKE_C_FLAGS", cmake_c_flags)
.always_configure(true);

if cfg!(feature = "deactivate-zlib-optim") {
cmake_conf.define("WITH_ZLIB_OPTIM", "OFF");
}
if cfg!(feature = "deactivate-zlib") {
cmake_conf.define("DEACTIVATE_ZLIB", "ON");
}
if cfg!(feature = "prefer-external-zlib") {
cmake_conf.define("PREFER_EXTERNAL_ZLIB", "ON");
}
if cfg!(feature = "deactivate-zstd") {
cmake_conf.define("DEACTIVATE_ZSTD", "ON");
}
if cfg!(feature = "prefer-external-zstd") {
cmake_conf.define("PREFER_EXTERNAL_ZSTD", "ON");
}
if cfg!(feature = "prefer-external-lz4") {
cmake_conf.define("PREFER_EXTERNAL_LZ4", "ON");
}
if cfg!(feature = "static") {
cmake_conf.define("BUILD_STATIC", "ON");
}
Expand Down
2 changes: 1 addition & 1 deletion blosc2-sys/c-blosc2
Submodule c-blosc2 updated 60 files
+9 −0 CMakeLists.txt
+6 −0 RELEASE_NOTES.md
+1 −1 blosc/shuffle.c
+0 −1 contrib/README.txt
+0 −178 contrib/bitshuffle_neon/Test/bitshuffle_bitunshuffle_test1.c
+0 −410 contrib/bitshuffle_neon/Test/bitshuffle_bitunshuffle_test16.c
+0 −213 contrib/bitshuffle_neon/Test/bitshuffle_bitunshuffle_test2.c
+0 −276 contrib/bitshuffle_neon/Test/bitshuffle_bitunshuffle_test4.c
+0 −278 contrib/bitshuffle_neon/Test/bitshuffle_bitunshuffle_test8.c
+0 −166 contrib/bitshuffle_neon/bitshuffle16_neon/bitshuffle16_neon.c
+0 −322 contrib/bitshuffle_neon/bitshuffle16_neon/bitshuffle16_neon_bucle.c
+0 −44 contrib/bitshuffle_neon/bitshuffle1_neon/bitshuffle1_neon.c
+0 −159 contrib/bitshuffle_neon/bitshuffle1_neon/bitshuffle1_neon_bucle.c
+0 −63 contrib/bitshuffle_neon/bitshuffle2_neon/bitshuffle2_neon.c
+ contrib/bitshuffle_neon/bitshuffle2_neon/bitshuffle2_neon_bucle
+0 −209 contrib/bitshuffle_neon/bitshuffle2_neon/bitshuffle2_neon_bucle.c
+0 −95 contrib/bitshuffle_neon/bitshuffle4_neon/bitshuffle4_neon.c
+0 −238 contrib/bitshuffle_neon/bitshuffle4_neon/bitshuffle4_neon_bucle.c
+0 −98 contrib/bitshuffle_neon/bitshuffle8_neon/bitshuffle8_neon.c
+0 −247 contrib/bitshuffle_neon/bitshuffle8_neon/bitshuffle8_neon_bucle.c
+0 −157 contrib/bitshuffle_neon/bitunshuffle16_neon/bitunshuffle16_neon.c
+0 −479 contrib/bitshuffle_neon/bitunshuffle16_neon/bitunshuffle16_neon_bucle.c
+0 −42 contrib/bitshuffle_neon/bitunshuffle1_neon/bitunshuffle1_neon.c
+0 −127 contrib/bitshuffle_neon/bitunshuffle1_neon/bitunshuffle1_neon_bucle.c
+0 −62 contrib/bitshuffle_neon/bitunshuffle2_neon/bitunshuffle2_neon.c
+0 −205 contrib/bitshuffle_neon/bitunshuffle2_neon/bitunshuffle2_neon_bucle.c
+0 −94 contrib/bitshuffle_neon/bitunshuffle4_neon/bitunshuffle4_neon.c
+0 −349 contrib/bitshuffle_neon/bitunshuffle4_neon/bitunshuffle4_neon_bucle.c
+0 −93 contrib/bitshuffle_neon/bitunshuffle8_neon/bitunshuffle8_neon.c
+0 −337 contrib/bitshuffle_neon/bitunshuffle8_neon/bitunshuffle8_neon_bucle.c
+0 −192 contrib/shuffle_neon/Test/shuffle_unshuffle_test16.c
+0 −65 contrib/shuffle_neon/Test/shuffle_unshuffle_test2.c
+0 −73 contrib/shuffle_neon/Test/shuffle_unshuffle_test4.c
+0 −120 contrib/shuffle_neon/Test/shuffle_unshuffle_test8.c
+0 −58 contrib/shuffle_neon/shuffle16_neon/shuffle16_neon.c
+0 −162 contrib/shuffle_neon/shuffle16_neon/shuffle16_neon_bucle.c
+0 −81 contrib/shuffle_neon/shuffle16_neon/shuffle16_neon_vtbx.c
+0 −180 contrib/shuffle_neon/shuffle16_neon/shuffle16_neon_vtbx_bucle.c
+0 −18 contrib/shuffle_neon/shuffle2_neon/shuffle2_neon.c
+0 −72 contrib/shuffle_neon/shuffle2_neon/shuffle2_neon_bucle.c
+0 −20 contrib/shuffle_neon/shuffle4_neon/shuffle4_neon.c
+0 −89 contrib/shuffle_neon/shuffle4_neon/shuffle4_neon_bucle.c
+0 −38 contrib/shuffle_neon/shuffle8_neon/shuffle8_neon.c
+0 −115 contrib/shuffle_neon/shuffle8_neon/shuffle8_neon_bucle.c
+0 −60 contrib/shuffle_neon/shuffle8_neon/shuffle8_neon_opt.c
+0 −161 contrib/shuffle_neon/shuffle8_neon/shuffle8_neon_opt_bucle.c
+0 −46 contrib/shuffle_neon/shuffle8_neon/shuffle8_neon_vtbx.c
+0 −137 contrib/shuffle_neon/shuffle8_neon/shuffle8_neon_vtbx_bucle.c
+0 −58 contrib/shuffle_neon/unshuffle16_neon/unshuffle16_neon.c
+0 −161 contrib/shuffle_neon/unshuffle16_neon/unshuffle16_neon_bucle.c
+0 −80 contrib/shuffle_neon/unshuffle16_neon/unshuffle16_neon_vtbx.c
+0 −164 contrib/shuffle_neon/unshuffle16_neon/unshuffle16_neon_vtbx_bucle.c
+0 −18 contrib/shuffle_neon/unshuffle2_neon/unshuffle2_neon.c
+0 −70 contrib/shuffle_neon/unshuffle2_neon/unshuffle2_neon_bucle.c
+0 −20 contrib/shuffle_neon/unshuffle4_neon/unshuffle4_neon.c
+0 −39 contrib/shuffle_neon/unshuffle8_neon/unshuffle8_neon.c
+0 −141 contrib/shuffle_neon/unshuffle8_neon/unshuffle8_neon_bucle.c
+0 −60 contrib/shuffle_neon/unshuffle8_neon/unshuffle8_neon_vtbx.c
+0 −127 contrib/shuffle_neon/unshuffle8_neon/unshuffle8_neon_vtbx_bucle.c
+2 −2 include/blosc2.h

0 comments on commit 97a31e5

Please sign in to comment.