The process of converting the libwebp project from C/C++ to WASM is achieved using the Emscripten compiler. The general workflow is as follows:
This includes installing emsdk, cmake, and pnpm. For specific installation methods, refer to the Emscripten official documentation, pnpm official documentation, and installing cmake.
git submodule update --init --recursive --remote --rebase
If you are using zsh, it is recommended to install the dotenv plugin to enable features like setting environment variables if a .env file is present in the current directory.
pnpm build:mac
docker build -f ./docker/Dockerfile -t libwebp-wasm/gif2webp:latest .
docker run --rm -v $(pwd)/dist:/gif2webp/dist -v $(pwd)/es:/gif2webp/es -v $(pwd)/lib:/gif2webp/lib libwebp-wasm/gif2webp
Note: The modification of upstream submodule project code is currently done by running the git apply command. Sometimes you need to commit your own changes in the submodule directory and manually generate the patch.
pnpm build:patch
MIT