openframeworks/openFrameworks — pull request #2992 by arturoc (2014-05-28 11:30:45+00:00)
Title: emscripten port

most things are working, including:
- opengl using the programmable renderer, so no lights or materials.
- sound player and sound stream, although sound stream is only fast enough under firefox
. video player and grabber
- and most addons.

opencv is still not in this PR as it needs a newer version of the library, we should update all the other platforms and then i'll upload the emscripten libraries

threads don't exist in javascript, there's the concept of worker threads but you can't have shared memory so we might need to have a different class to have multi threaded applications, even with that there's an empty implementation of ofThread so applications using it should compile but everything running on a thread won't work

ofURLFileLoader doesn't work yet but being web all classes that load resources can load them online as long as it's in the same server and video and audio should work even with absolute urls

To test it you'll need the latest emscripten from github: https://github.com/kripken/emscripten/ which in turn needs a special version of LLVM, fastcomp, more details: https://github.com/kripken/emscripten/wiki/LLVM-Backend

This works on linux and should work on osx since it's based on the same makefiles we use for other platforms, for windows it might need some tools for the makefiles to work, probably the same solution used for android should work for this too.

The linux or osx projectGenerator or just copying Makefile, config.make and addons.make from the templates works for creating a new project.

The emscripten download root folder should be in the PATH env variable:

```bash
export PATH=$PATH:path_to_emscripten
```

And it needs a special variable to find the fastcomp version of LLVM, usually:

```bash
export LLVM=path_to_emscripten-fastcomp/build/Release/bin
```

This 2 env variables can be added in ~/.bashrc or ~/.profile so there's no need to type them every time

To compile a project, from the project folder type:

```bash
emmake make
```

or to compile with debug symbols:

```bash
emmake make Debug
```