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

Fixes for WASI compilation #771

Merged
merged 2 commits into from
Nov 7, 2019
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
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ jobs:
- rustup target add wasm32-unknown-unknown
- cargo install --force wasm-pack
- wasm-pack build
- <<: *test
name: wasi target
language: rust
rust: stable
before_script: skip
install: skip
script:
- rustup target add wasm32-wasi
- cargo install --force cargo-wasi
- cargo wasi build

- &wheel
stage: build wheel and send to github releases
Expand Down
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@ itertools = "0.8.0"
typed-builder = "0.3.0"
csv = "1.0.7"

[target.'cfg(target_arch = "wasm32")'.dependencies.wasm-bindgen]
[target.'cfg(all(target_arch = "wasm32", target_vendor="unknown"))'.dependencies.wasm-bindgen]
version = "^0.2"
features = ["serde-serialize"]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.ocf]
[target.'cfg(not(all(target_arch = "wasm32", target_vendor="unknown")))'.dependencies.ocf]
version = "0.1"
path = "ocf"
default-features = false
features = ["bz2"]

[dev-dependencies]
proptest = "^0.8"
Expand Down
3 changes: 2 additions & 1 deletion src/index/sbt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ where
// add a function to build a Storage from a StorageInfo
let mut basepath = PathBuf::new();
basepath.push(path);
basepath.canonicalize()?;
// TODO: canonicalize doesn't work on wasm32-wasi
//basepath.canonicalize()?;

let sbt =
SBT::<Node<U>, Dataset<T>>::from_reader(&mut reader, &basepath.parent().unwrap())?;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use cfg_if::cfg_if;
use murmurhash3::murmurhash3_x64_128;

cfg_if! {
if #[cfg(target_arch = "wasm32")] {
if #[cfg(all(target_arch = "wasm32", target_vendor = "unknown"))] {
pub mod wasm;
} else {
pub mod ffi;
Expand Down
4 changes: 2 additions & 2 deletions src/sketch/minhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use crate::_hash_murmur;
use crate::errors::SourmashError;
use crate::signature::SigsTrait;

#[cfg(target_arch = "wasm32")]
#[cfg(all(target_arch = "wasm32", target_vendor = "unknown"))]
use wasm_bindgen::prelude::*;

#[cfg_attr(target_arch = "wasm32", wasm_bindgen)]
#[cfg_attr(all(target_arch = "wasm32", target_vendor = "unknown"), wasm_bindgen)]
#[derive(Debug, Clone, PartialEq)]
pub struct KmerMinHash {
num: u32,
Expand Down