A brief overview of Emscripten
For more info, visit
Getting Started on FreeBSD
- Install lang/python. Emscripten uses this for it's build environment. This needs to be version 2.7 or above.
Now simply download the latest Emscripten snapshot and extract to a writable directory (for example, I extracted mine to /usr/home/kpedersen/emscripten). Now add that directory to your path and execute `emcc`. This will possibly output some error messages but will also generate a file called ".emscripten" in your home directory. Open that file in a text editor and ensure that EMSCRIPTEN_ROOT, LLVM_ROOT, PYTHON and NODE_JS paths are correct. Note that LLVM_ROOT should actually point to the bin directory (i.e /usr/local/bin) or it wont work.
Once this is done, now make a simple test program in C or C++ to output hello world and you can then compile with:
emcc main.c -o index.html
em++ main.cpp -o index.html
You should notice an index.html file now exists in your current directory. Open this with a web browser and you should see hello world written in the console.
If your application uses SDL.h or GL/gl.h, you will see the output image in the space just above the console.
How awesome is that!