File tree Expand file tree Collapse file tree 4 files changed +13
-23
lines changed
Expand file tree Collapse file tree 4 files changed +13
-23
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " wasm3"
3- version = " 0.3.1 "
3+ version = " 0.5.0 "
44authors = [
" Lukas Tobias Wirth <[email protected] >" ]
55edition = " 2018"
66description = " Rust bindings for wasm3"
@@ -27,7 +27,7 @@ build-bindgen = ["ffi/build-bindgen"]
2727cty = " 0.2"
2828
2929[dependencies .ffi ]
30- version = " 0.3 .0"
30+ version = " 0.5 .0"
3131path = " ./wasm3-sys"
3232package = " wasm3-sys"
3333
Original file line number Diff line number Diff line change 11[package ]
22name = " wasm3-sys"
3- version = " 0.3 .0"
3+ version = " 0.5 .0"
44authors = [
" Lukas Tobias Wirth <[email protected] >" ]
55edition = " 2018"
66description = " Raw ffi bindings for wasm3"
Original file line number Diff line number Diff line change 11use std:: env;
22use std:: ffi:: OsStr ;
3- use std:: fmt:: Write as _;
43use std:: fs;
54use std:: path:: { Path , PathBuf } ;
65
@@ -13,25 +12,16 @@ const PRIMITIVES: &[&str] = &[
1312] ;
1413
1514fn 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
You can’t perform that action at this time.
0 commit comments