Skip to content

Commit

Permalink
Merge b9938b2 into 75432ed
Browse files Browse the repository at this point in the history
  • Loading branch information
roee88 authored Aug 8, 2021
2 parents 75432ed + b9938b2 commit df7d0c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,14 @@ jobs:
rustup override set ${{ matrix.rust }}
rustup component add rustfmt
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi
- name: Build arrow crate
run: |
export CARGO_HOME="/github/home/.cargo"
export CARGO_TARGET_DIR="/github/home/target"
cd arrow
cargo build --features=js --target wasm32-unknown-unknown
cargo build --no-default-features --features=csv,ipc,simd --target wasm32-unknown-unknown
cargo build --no-default-features --features=csv,ipc,simd --target wasm32-wasi
# test builds with various feature flags
default-build:
Expand Down
13 changes: 6 additions & 7 deletions arrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ serde = { version = "1.0", features = ["rc"] }
serde_derive = "1.0"
serde_json = { version = "1.0", features = ["preserve_order"] }
indexmap = "1.6"
rand = { version = "0.8", default-features = false }
# getrandom is a dependency of rand, not (directly) of arrow
# need to specify `js` feature to build on wasm
getrandom = { version = "0.2", optional = true }
rand = { version = "0.8", optional = true }
num = "0.4"
csv_crate = { version = "1.1", optional = true, package="csv" }
regex = "1.3"
Expand All @@ -64,16 +61,18 @@ csv = ["csv_crate"]
ipc = ["flatbuffers"]
simd = ["packed_simd"]
prettyprint = ["prettytable-rs"]
js = ["getrandom/js"]
# The test utils feature enables code used in benchmarks and tests but
# not the core arrow code itself
test_utils = ["rand/std", "rand/std_rng"]
# not the core arrow code itself. Be aware that `rand` must be kept as
# an optional dependency for supporting compile to wasm32-unknown-unknown
# target without assuming an environment containing JavaScript.
test_utils = ["rand"]
# this is only intended to be used in single-threaded programs: it verifies that
# all allocated memory is being released (no memory leaks).
# See README for details
memory-check = []

[dev-dependencies]
rand = "0.8"
criterion = "0.3"
flate2 = "1"
tempfile = "3"
Expand Down
6 changes: 4 additions & 2 deletions arrow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ println!("{:?}", array.value(1));

## Building for WASM

In order to compile Arrow for Web Assembly (the `wasm32-unknown-unknown` WASM target), you will likely need to turn off this crate's default features and use the `js` feature.
Arrow can compile to WebAssembly using the `wasm32-unknown-unknown` and `wasm32-wasi` targets.

In order to compile Arrow for `wasm32-unknown-unknown` you will need to disable default features, then include the desired features, but exclude test dependencies (the `test_utils` feature). For example, use this snippet in your `Cargo.toml`:

```toml
[dependencies]
arrow = { version = "5.0", default-features = false, features = ["js"] }
arrow = { version = "5.0", default-features = false, features = ["csv", "ipc", "simd"] }
```

## Examples
Expand Down

0 comments on commit df7d0c9

Please sign in to comment.