This repository contains source codes for the article on Habr (non-published) about different methods to build wasm-module from c++, AssemblyScript and Rust. These modules build the Delaunay triangulation of the plain. We use a port of this algorithm.
It requires Emscripten
Create directory \output\libs\
to store temporary build files. Next build object files
emcc .\delaunay.cpp -o output\libs\delaunay.o -c
emcc .\bvh.cpp -o output\libs\bvh.o -c
Finally, build the module
emcc .\delaunay_api.cpp output\libs\delaunay.o output\libs\bvh.o -o output/delaunay.js -lembind -s MODULARIZE -s EXPORT_NAME=delaunay -s ALLOW_MEMORY_GROWTH=1 -Oz
It requires AssemblyScript
asc assembly/delaunay_api.ts -o build/delaunay.wasm --bindings esm --optimizeLevel 3 --converge --noAssert -Ospeed
It requires wasm-pack
wasm-pack build
Here is an example applicarion, which use the module from the Rust.
./python_wasm/delaunay_wasm.py
contains an example of the Python class, which loads the module from the Rust by using Wasmer.