HeadlinesBriefing favicon HeadlinesBriefing.com

LibreCAD Ported to WebAssembly Runs Full Desktop CAD in Browser Tabs

Hacker News •
×

A developer successfully compiled the complete LibreCAD desktop application to WebAssembly, allowing users to run full 2D CAD software directly in browser tabs without installation. Using GLM-5.2 to assist with the port and Qt's WebAssembly support, the project demonstrates how traditional desktop apps can migrate to web platforms with minimal code changes.

The main obstacle involved handling modal dialogs and nested event loops that desktop applications rely on. Traditional Asyncify only supports single-level suspension, causing the app to freeze when users opened combo boxes or color pickers inside dialogs. The solution required JavaScript Promise Integration (JSPI) with WebAssembly exceptions, forcing a custom Qt 6.9 build from source.

Performance optimizations addressed a major bottleneck where Qt's default RGBA8888 pixel format caused 3-4 fps rendering. Switching to premultiplied ARGB32 enabled SIMD-accelerated compositing, tripling frame rates. File operations route through Emscripten's memory filesystem with JavaScript shims for reliable loading and saving.

The result delivers a working CAD application supporting DXF/DWG files, layers, and dimensions in approximately 18 MB compressed package. It requires Chromium-based browsers version 137+ since JSPI support remains absent in Firefox and Safari. This proves complex desktop software can genuinely run client-side in modern browsers.