Skip to content

Commit

Permalink
enable wasi linking
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Jan 26, 2020
1 parent c4d55e1 commit 7641acb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ authors = ["Lukas Tobias Wirth <[email protected]>"]
edition = "2018"
license = "MIT"

[features]
wasi = ["ffi/wasi"]
default = ["wasi"]

[dependencies.ffi]
path = "wasm3-sys"
package = "wasm3-sys"
Expand Down
5 changes: 2 additions & 3 deletions src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,10 @@ impl<'env, 'rt> Module<'env, 'rt> {
}
}

/*requires defines
#[cfg(feature = "wasi")]
pub fn link_wasi(&mut self) {
unsafe { ffi::m3_LinkWASI(self.0) };
unsafe { ffi::m3_LinkWASI(self.raw) };
}
*/

pub fn link_libc(&mut self) {
unsafe { ffi::m3_LinkLibC(self.raw) };
Expand Down
3 changes: 3 additions & 0 deletions wasm3-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ edition = "2018"
license = "MIT"
links = "wasm3"

[features]
wasi = []

[build-dependencies]
bindgen = "0.52"
cc = "1"
10 changes: 7 additions & 3 deletions wasm3-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ fn main() -> io::Result<()> {
cfg.flag("/Zo");
cfg.flag("/arch:AVX2");
}
cfg.warnings(false)
let cfg = cfg
.warnings(false)
.cpp(false)
.define("d_m3LogOutput", Some("0"))
.extra_warnings(false)
.include("wasm3/source")
.compile("wasm3");
.include("wasm3/source");
if cfg!(feature = "wasi") {
cfg.define("d_m3HasWASI", None);
}
cfg.compile("wasm3");
Ok(())
}

0 comments on commit 7641acb

Please sign in to comment.