2025-08-28 14:41:57 +00:00

CWasm

A minimal layer for compiling C applications that render graphics through WebGL from a WebAssembly module using Clang (not Emscripten)

Compilation

CWasm is compiled with the applicaiton as a Unity Build. The application's main source file must #include cwasm.c before anything else. The code in this repository is only tested with Clang as the compiler and wasm32-unknown-unknown as the target architecture. You must have a version of Clang that supports compiling to WebAssembly.

  1. Install Clang (LLVM's Compiler) from LLVM's Download Page
  2. Make sure Clang is available from the command-line by doing clang -v. If it's not, make sure you update your PATH environment variable to include the bin/ folder of the LLVM install directory
  3. Ensure you have Clang 11.0 or greater for proper WebAssembly support (we recommend using the latest, that's v18.1.8 as this is written)
  4. On Windows run the build.bat [path/to/app.c]. On Linux or OSX run the build.sh [path/to/app.c]. If compiling CWasm without a real application the app.c argument may be ommitted and test_app.c will be used instead.
Description
A minimal layer for compiling C applications that render graphics through WebGL from a WebAssembly module using Clang (not Emscripten)
Readme MIT 392 KiB
Languages
C 94.4%
JavaScript 5.2%
Batchfile 0.2%