Skip to content

Commit

Permalink
remove wasm-gc for webasm build
Browse files Browse the repository at this point in the history
  • Loading branch information
hlorenzi committed Jun 4, 2023
1 parent e48fe8d commit 93b575d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build_ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ jobs:
- run: rm .gitignore
- run: mv .gitignore.ghpages .gitignore
- run: cargo build --lib --target wasm32-unknown-unknown --release
- run: cargo install wasm-gc
- run: wasm-gc ./target/wasm32-unknown-unknown/release/customasm.wasm -o ./target/wasm32-unknown-unknown/release/customasm.gc.wasm
- run: mv ./target/wasm32-unknown-unknown/release/customasm.gc.wasm ./web/customasm.gc.wasm
- run: mv ./target/wasm32-unknown-unknown/release/customasm.wasm ./web/customasm.wasm
- run: git config user.name github-actions
- run: git config user.email github-actions@github.com
- run: git add -A
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
/test.asm
/test_output_mismatch

/web/customasm.gc.wasm
/web/customasm.wasm
5 changes: 1 addition & 4 deletions build_wasm.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Build wasm binary
cargo build --lib --target wasm32-unknown-unknown --release

# Reduce binary size
wasm-gc "./target/wasm32-unknown-unknown/release/customasm.wasm" -o "./target/wasm32-unknown-unknown/release/customasm.gc.wasm"

# Copy to web folder
Copy-Item -Path "./target/wasm32-unknown-unknown/release/customasm.gc.wasm" -Destination "./web/customasm.gc.wasm"
Copy-Item -Path "./target/wasm32-unknown-unknown/release/customasm.wasm" -Destination "./web/customasm.wasm"

2 changes: 1 addition & 1 deletion src/webasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub unsafe extern fn wasm_assemble(
None =>
{
let mut err = Vec::<u8>::new();
report.print_all(&mut err, &fileserver);
report.print_all(&mut err, &fileserver, true);
return wasm_string_new_with(
String::from_utf8(err).unwrap());
}
Expand Down
2 changes: 1 addition & 1 deletion web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function main()
window.onkeydown = onKeyDown
window.onbeforeunload = onBeforeUnload

fetch("customasm.gc.wasm")
fetch("customasm.wasm")
.then(r => r.arrayBuffer())
.then(r => WebAssembly.instantiate(r))
.then(wasm =>
Expand Down

0 comments on commit 93b575d

Please sign in to comment.