|
|
2 سال پیش | |
|---|---|---|
| .. | ||
| .gitignore | 5 سال پیش | |
| CMakeLists.txt | 2 سال پیش | |
| README.md | 2 سال پیش | |
| codecbench.patch | 2 سال پیش | |
This sample demonstrates how to build codecbench of messoptimizer into WebAssembly with simd support and run it with iwasm.
please refer to installation instructions.
$ mkdir build && cd build
$ cmake ..
$ make
# to verify
$ ls codecbench.wasm
EMSDK is another toolchain to compile C/C++ code to WASM. In this case, the output wasm file might have a higher performance than the file generated by wasi-sdk.
$ git clone https://github.com/zeux/meshoptimizer.git
$ cd messoptimizer
$ em++ tools/codecbench.cpp src/vertexcodec.cpp src/vertexfilter.cpp \
src/overdrawanalyzer.cpp src/indexgenerator.cpp src/vcacheoptimizer.cpp \
src/clusterizer.cpp src/indexcodec.cpp src/vfetchanalyzer.cpp \
src/spatialorder.cpp src/allocator.cpp src/vcacheanalyzer.cpp \
src/vfetchoptimizer.cpp src/overdrawoptimizer.cpp src/simplifier.cpp \
src/stripifier.cpp -O3 -msimd128 \
-s TOTAL_MEMORY=268435456 \
-o codecbench.wasm
$ ls -l codecbench.wasm
Firstly please build iwasm with simd support:
$ cd <wamr dir>/product-mini/platforms/linux/
$ mkdir build && cd build
$ cmake ..
$ make
Then compile wasm file to aot file and run:
$ <wamr dir>/wamr-compiler/build/wamrc -o codecbench.aot codecbench.wasm
$ <wamr dir>/product-mini/platforms/linux/build/iwasm codecbench.aot