Files
CWasm/README.md

12 lines
1.2 KiB
Markdown

# 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](https://en.wikipedia.org/wiki/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](https://releases.llvm.org/download.html)
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.