Skip to content

Commit

Permalink
Slightly cleanup Wasm build recipes
Browse files Browse the repository at this point in the history
There is no need to repeat the recipe for JS embedding for single-module
files; decoder is still special because it embeds two modules.
  • Loading branch information
zeux committed Sep 30, 2024
1 parent ae51b3f commit 1273877
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,13 @@ js/meshopt_decoder.js: build/decoder_base.wasm build/decoder_simd.wasm tools/was
sed -i "s#\([\"']\).*\(;\s*//\s*embed! simd\)#\\1$$(cat build/decoder_simd.wasm | python3 tools/wasmpack.py)\\1\\2#" $@

js/meshopt_encoder.js: build/encoder.wasm tools/wasmpack.py
sed -i "s#Built with clang.*#Built with $$($(WASMCC) --version | head -n 1 | sed 's/\s\+(.*//')#" $@
sed -i "s#Built from meshoptimizer .*#Built from meshoptimizer $$(cat src/meshoptimizer.h | grep -Po '(?<=version )[0-9.]+')#" $@
sed -i "s#\([\"']\).*\(;\s*//\s*embed! wasm\)#\\1$$(cat build/encoder.wasm | python3 tools/wasmpack.py)\\1\\2#" $@

js/meshopt_simplifier.js: build/simplifier.wasm tools/wasmpack.py
sed -i "s#Built with clang.*#Built with $$($(WASMCC) --version | head -n 1 | sed 's/\s\+(.*//')#" $@
sed -i "s#Built from meshoptimizer .*#Built from meshoptimizer $$(cat src/meshoptimizer.h | grep -Po '(?<=version )[0-9.]+')#" $@
sed -i "s#\([\"']\).*\(;\s*//\s*embed! wasm\)#\\1$$(cat build/simplifier.wasm | python3 tools/wasmpack.py)\\1\\2#" $@

js/meshopt_clusterizer.js: build/clusterizer.wasm tools/wasmpack.py

js/meshopt_encoder.js js/meshopt_simplifier.js js/meshopt_clusterizer.js:
sed -i "s#Built with clang.*#Built with $$($(WASMCC) --version | head -n 1 | sed 's/\s\+(.*//')#" $@
sed -i "s#Built from meshoptimizer .*#Built from meshoptimizer $$(cat src/meshoptimizer.h | grep -Po '(?<=version )[0-9.]+')#" $@
sed -i "s#\([\"']\).*\(;\s*//\s*embed! wasm\)#\\1$$(cat build/clusterizer.wasm | python3 tools/wasmpack.py)\\1\\2#" $@
sed -i "s#\([\"']\).*\(;\s*//\s*embed! wasm\)#\\1$$(cat $< | python3 tools/wasmpack.py)\\1\\2#" $@

js/%.module.js: js/%.js
sed '\#// export!#q' <$< >$@
Expand Down

0 comments on commit 1273877

Please sign in to comment.