From da2ffe33bf6aae861f80f1f7b7926f612eed1630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 20 Oct 2013 15:12:36 +0200 Subject: [PATCH] Added Emscripten building documentation. --- doc/building.dox | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/doc/building.dox b/doc/building.dox index 4473b9f6d..9b94da38f 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -326,6 +326,38 @@ for depending projects. The headers are shared by both versions. For ArchLinux there are also prepared package files in root, named `PKGBUILD-nacl-glibc` and `PKGBUILD-nacl-newlib`. +@subsection building-cross-emscripten Crosscompiling for Emscripten + +You will need [Emscripten](https://github.com/kripken/emscripten/wiki/Tutorial) +installed and configured. + +Don't forget to adapt `EMSCRIPTEN_PREFIX` variable in `generic/Emscripten.cmake` +to path where Emscripten is installed. Default is `/usr/emscripten`. Emscripten +supports dynamic only to simplify porting and they are generally slower, thus +`BUILD_STATIC` is implicitly enabled. + +Then create build directory and run cmake and make in it. The toolchain needs +access to its platform file, so be sure to properly set **absolute** path to +`modules/` directory containing `Platform/Emscripten.cmake`. Default is +`/usr/emscripten`. Also set `CMAKE_INSTALL_PREFIX` to value which is contained +in `CMAKE_FIND_ROOT_PATH` in toolchain file. + + mkdir -p build-emscripten + cd build-emscripten + cmake .. \ + -DCMAKE_MODULE_PATH="/absolute/path/to/toolchains/modules" \ + -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr/emscripten/system \ + -DWITH_SDL2APPLICATION=ON + make + +Then you can install the library using `make install` to make it available for +depending projects. + +If you have Node.js installed, you can also build and run unit tests using +`ctest`. See `BUILD_TESTS` above. + */ }