HeadlinesBriefing favicon HeadlinesBriefing.com

FreeCAD Runs in Browser via WebAssembly

Hacker News •
×

FreeCAD — a parametric 3D CAD suite with 1.5 million lines of C++ and 700,000 of Python — now runs inside a browser tab. The port, completed in roughly 4 days by the AI agent Fable, compiles the entire stack into a single 196 MB WebAssembly module alongside Qt 6.11.1 built with JSPI (JavaScript Promise Integration). First load transfers ~96 MB compressed via Brotli; subsequent loads hit the browser cache. The build requires a recent Chromium-based browser (Chrome/Edge 137+) because Firefox and Safari have not yet shipped JSPI, which FreeCAD depends on to preserve blocking `QDialog::exec()` semantics across its 185 C++ and 156 Python modal-dialog sites.

The architecture statically links OCCT (Open CASCADE B-rep kernel), Coin3D/Quarter scene graph, embedded CPython 3.14, PySide6/shiboken6 bindings, VTK 9.3, and the Salome SMESH mesher. Seventeen-plus workbenches — Part, Sketcher, Part Design, FEM, CAM, BIM, Assembly, and more — ship inside the module. Two firsts for the browser: PySide6 and pivy (Coin bindings) running under WebAssembly, and the full OCCT+Coin+CPython+PySide+VTK+SMESH chain linked into one module.

The port proceeded in stages: a headless kernel test in Node, then GUI linking with a custom fixed-function OpenGL-on-GLES2 shim (~900 lines) for Coin's legacy `glBegin`/`glVertex` calls, followed by event-loop fixes using asyncify so `app.exec()` could suspend. Compositing required an offscreen framebuffer read back into Qt's raster path. A depth-clear-value stub bug turned solids invisible; vertex-array fast-path issues dropped the viewport to 1.3 fps before buffer-tracking fixes restored interactive rates.

This demonstrates that massive, dependency-heavy desktop applications can cross-compile to the web without rewriting, provided the toolchain supports JSPI and static linking. The 4-day timeline using an AI agent also signals a shift in how legacy codebases might be ported — treating the build as a prompt-engineering problem rather than a months-long manual effort.