Skip to content

Commit

Permalink
编译 wasm 时,创建 docs/public/wasm 目录
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Jun 20, 2024
1 parent a021c9f commit 42de7d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ cargo build --no-default-features --profile wasm-release --target wasm32-unknown
--bin compute-pipeline \
--bin vertex-animation \
--bin hilbert-curve \
--bin hdr
--bin hdr

# 创建 wasm 目录
mkdir -p "docs/public/wasm"

# Generate bindings
for i in target/wasm32-unknown-unknown/wasm-release/*.wasm;
Expand All @@ -28,7 +31,7 @@ do
# 优化 wasm 包大小
filename=$(basename "$i");
# Remove the .wasm extension from filename
name_no_extension="${filename%.wasm}"
name_no_extension="${filename%.wasm}";
wasm-opt -Oz wasm/"$name_no_extension"_bg.wasm --output docs/public/wasm/"$name_no_extension"_bg.wasm;

cp wasm/"$name_no_extension".js docs/public/wasm/"$name_no_extension".js
Expand Down

0 comments on commit 42de7d2

Please sign in to comment.