Skip to content

Commit 9eb9bf4

Browse files
jimpoVeykril
authored andcommitted
Update Cargo.toml and build.rs to target v0.5.0
Generate bindings for wasm3 v0.5.0 public API.
1 parent f476697 commit 9eb9bf4

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wasm3"
3-
version = "0.3.1"
3+
version = "0.5.0"
44
authors = ["Lukas Tobias Wirth <[email protected]>"]
55
edition = "2018"
66
description = "Rust bindings for wasm3"
@@ -27,7 +27,7 @@ build-bindgen = ["ffi/build-bindgen"]
2727
cty = "0.2"
2828

2929
[dependencies.ffi]
30-
version = "0.3.0"
30+
version = "0.5.0"
3131
path = "./wasm3-sys"
3232
package = "wasm3-sys"
3333

wasm3-sys/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wasm3-sys"
3-
version = "0.3.0"
3+
version = "0.5.0"
44
authors = ["Lukas Tobias Wirth <[email protected]>"]
55
edition = "2018"
66
description = "Raw ffi bindings for wasm3"

wasm3-sys/build.rs

+9-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::env;
22
use std::ffi::OsStr;
3-
use std::fmt::Write as _;
43
use std::fs;
54
use std::path::{Path, PathBuf};
65

@@ -13,25 +12,16 @@ const PRIMITIVES: &[&str] = &[
1312
];
1413

1514
fn gen_wrapper(out_path: &Path) -> PathBuf {
16-
// TODO: we currently need the field definitions of the structs of wasm3. These aren't exposed
17-
// in the wasm3.h header so we have to generate bindings for more.
1815
let wrapper_file = out_path.join("wrapper.h");
19-
20-
let mut buffer = String::new();
21-
fs::read_dir(WASM3_SOURCE)
22-
.unwrap_or_else(|_| panic!("failed to read {} directory", WASM3_SOURCE))
23-
.filter_map(Result::ok)
24-
.map(|entry| entry.path())
25-
.filter(|path| path.extension().and_then(OsStr::to_str) == Some("h"))
26-
.for_each(|path| {
27-
writeln!(
28-
&mut buffer,
29-
"#include \"{}\"",
30-
path.file_name().unwrap().to_str().unwrap()
31-
)
32-
.unwrap()
33-
});
34-
fs::write(&wrapper_file, buffer).expect("failed to create wasm3 wrapper file");
16+
let header_files = [
17+
"wasm3.h",
18+
#[cfg(feature = "wasi")]
19+
"m3_api_wasi.h",
20+
];
21+
let contents = header_files
22+
.map(|header_file| format!("#include \"{}\"\n", header_file))
23+
.join("");
24+
fs::write(&wrapper_file, contents).expect("failed to create wasm3 wrapper file");
3525
wrapper_file
3626
}
3727

wasm3-sys/wasm3

Submodule wasm3 updated 280 files

0 commit comments

Comments
 (0)