A detailed walkthrough of compiling the Boundary-First-Flattening (BFF) C++ library to WebAssembly for use in the browser. The process involves building OpenBLAS (with LAPACK) for Wasm using Emscripten, patching and building SuiteSparse against it, applying CMake and source code fixes to BFF itself (including a 32-bit size_t bug), and wrapping the result in a custom JS/TypeScript shim that exposes a single `unwrapUVs` function. The guide covers specific patches, CMake overrides, library placement for Emscripten's search path, and ES Module injection.

7m read timeFrom cprimozic.net
Post cover image
Table of contents
Building OpenBLAS for Wasm ⌗Building SuiteSparse ⌗Building boundary-first-flattening ⌗Custom Wrapper Library ⌗Results ⌗

Sort: