Skip to content

Build library with Emscripten

Will Hemsworth edited this page Aug 12, 2025 · 2 revisions

Prerequisites

First, make sure bitloop is cloned and bootstrapped.

Windows

Clone emsdk (replace <LIBS> with your actual library folder)

cd C:\<LIBS>\emsdk
git clone https://github.com/emscripten-core/emsdk.git

Install & activate

cd emsdk
.\emsdk install 3.1.64
.\emsdk activate 3.1.64

Add emsdk to PATH environment variable

  1. Open System Properties (or press Win+R and run SystemPropertiesAdvanced)
  2. Click Advanced tab ⇒ Environment Variables
  3. Add to PATH: C:\<LIBS>\emsdk\upstream\emscripten (replace <LIBS> with your actual library folder)

Linux

Install emsdk

sudo apt-get update && sudo apt-get install -y python3
git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
~/emsdk/emsdk install 3.1.64
~/emsdk/emsdk activate 3.1.64

Set up env vars for the current shell

echo "source ~/emsdk/emsdk_env.sh" >> ~/.bashrc
source ~/emsdk/emsdk_env.sh

Build & Run

cmake --preset wasm32-release
cmake --build --preset wasm32-release
emrun framework/build/wasm32-release/examples.html --port 8000