| Index: README.md |
| =================================================================== |
| --- a/README.md |
| +++ b/README.md |
| @@ -14,36 +14,46 @@ |
| In order to improve performance and memory usage, some of the code (located |
| inside the `compiled` directory) is written in C++ and compiled to JavaScript |
| via Empscripten. |
| ### Requirements |
| * [Emscripten 1.37.3](https://github.com/kripken/emscripten) |
| * [Python 2.7](https://www.python.org) |
| +* [meson](https://www.mesonbuild.com) |
| +* [ninja](https://www.ninja-build.org) |
| ### Running Emscripten |
| -After installing and configuring Emscripten you can run the following command: |
| +After installing and configuring Emscripten you can setup the build |
| +with the following commands: |
| + |
| + mkdir build |
| + meson build |
| - python compile |
| +Then to build just do: |
| -This will produce a `lib/compiled.js` exporting the classes defined in C++ code. |
| + cd build |
| + ninja |
| + |
| +This will produce a `build/compiled.js` exporting the classes defined |
| +in C++ code. |
| ### Technical details |
| Compilation is currently a two-step process. In the bindings generation step, |
| the source files are compiled into `compiled/bindings.cpp.js` with the |
| `PRINT_BINDINGS` symbol defined. This application is then executed via Node.js |
| and will print JavaScript wrappers for the C++ classes to |
| -`compiled/bindings.js` according to definitions within the `EMSCRIPTEN_BINDINGS` |
| +`build/bindings.js` according to definitions within the `EMSCRIPTEN_BINDINGS` |
| macro in `compiled/bindings.cpp`. |
| In the actual compilation step the source files are compiled into |
| -`lib/compiled.js` without the `PRINT_BINDINGS` symbol, so that the |
| +`build/compiled.js` without the `PRINT_BINDINGS` symbol, so that the |
| `EMSCRIPTEN_BINDINGS` macro ignores its contents and merely emits some generic |
| functions necessary for the JavaScript bindings to work. The previously |
| generated `compiled/bindings.js` file is added to the end of Emscripten output. |
| The binding generation approach is heavily inspired by |
| [embind](http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html). |
| However, embind doesn't use a separate build step to produce the bindings, the |
| bindings are rather generated dynamically at run time. As a side-effect, it |