File tree 4 files changed +13
-23
lines changed
4 files changed +13
-23
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " wasm3"
3
- version = " 0.3.1 "
3
+ version = " 0.5.0 "
4
4
authors = [
" Lukas Tobias Wirth <[email protected] >" ]
5
5
edition = " 2018"
6
6
description = " Rust bindings for wasm3"
@@ -27,7 +27,7 @@ build-bindgen = ["ffi/build-bindgen"]
27
27
cty = " 0.2"
28
28
29
29
[dependencies .ffi ]
30
- version = " 0.3 .0"
30
+ version = " 0.5 .0"
31
31
path = " ./wasm3-sys"
32
32
package = " wasm3-sys"
33
33
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " wasm3-sys"
3
- version = " 0.3 .0"
3
+ version = " 0.5 .0"
4
4
authors = [
" Lukas Tobias Wirth <[email protected] >" ]
5
5
edition = " 2018"
6
6
description = " Raw ffi bindings for wasm3"
Original file line number Diff line number Diff line change 1
1
use std:: env;
2
2
use std:: ffi:: OsStr ;
3
- use std:: fmt:: Write as _;
4
3
use std:: fs;
5
4
use std:: path:: { Path , PathBuf } ;
6
5
@@ -13,25 +12,16 @@ const PRIMITIVES: &[&str] = &[
13
12
] ;
14
13
15
14
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.
18
15
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" ) ;
35
25
wrapper_file
36
26
}
37
27
You can’t perform that action at this time.
0 commit comments