Installation
Build the BWSL compiler or use the WebAssembly build in tools and editors.
Turn the guide into code
Take the key idea from this page into the playground and validate it in a real shader instead of leaving it as theory.
Open PlaygroundThe compiler repo supports three installation paths:
- prebuilt command-line compilers from GitHub Releases
- a native CLI compiler for local builds and asset pipelines
- a WebAssembly build for browser tools, editors, and playgrounds
Download a Release
Prebuilt CLI binaries are published on the BWSL GitHub Releases page when a version is cut.
Choose the asset for your platform:
| Platform | Release asset |
|---|---|
| Windows | bwslc-windows-x64.exe |
| macOS | bwslc-macos-arm64 or bwslc-macos-x64 |
| Linux | bwslc-linux-x64 |
After downloading, put the binary somewhere on your PATH or call it directly from your build scripts. On macOS and Linux, make the binary executable if your browser or archive tool strips that bit:
chmod +x bwslc-*
Build the CLI Compiler
From the BWSL source repo:
git clone --recurse-submodules https://github.com/apresthus/BWSL.git
cd BWSL
make bwslc
This produces the native compiler in build/:
build/
└── bwslc
On Windows, the repo also includes build.bat and make.bat helpers:
build.bat bwslc
Verify Installation
The current compiler exposes help and version information through -h:
./build/bwslc -h
If bwslc is already on your PATH, the same check works as:
bwslc -h
The help output should show the compiler version and flags such as -o, -metal, -hlsl, -glsl, -gles, -variant, and -dump-variant-space.
WebAssembly Build
For browser-based compilation, build the WASM target:
make wasm
Artifacts are written to build/wasm/:
build/wasm/
├── bwsl.js
└── bwsl.wasm
Usage in JavaScript
import initBWSL from "./build/wasm/bwsl.js";
const bwsl = await initBWSL();
const result = bwsl.ccall(
"compile",
"string",
["string", "string", "string"],
[
shaderSource,
"",
"-internals -modules ./modules",
]
);
const output = JSON.parse(result);
The WASM build also exposes getSymbols for editor tooling and autocomplete.
Notes
- Releases are the easiest path for users who only need the compiler binary.
- Source builds require a C++20-capable toolchain.
- WASM builds require Emscripten (
emcc) inPATH. - Resources are declared in source; host-only preview or render-graph metadata should be handled outside the compiler call.
Next Steps
- Quick Start - Write your first shader
- CLI Reference - Full command-line flag reference
- Integration - Build-system and engine integration