Building Moai From Source With Scons
This documentation is obsolete or out of date and requires community help to clean it up.Improve this doc
Moai SDK 0.9 (Revision 8) or later.
Chrome 15 or later.
The Native Client SDK.
The FMOD SDK for sound support. NOTE: FMOD use requires a license. More information about licensing is available here. If you do not want sound in your game, you will need to remove the FMOD library dependencies from the build.
Building for Native Client
Before building Moai for Native Client, it is necessary to tell the build scripts where the Native Client SDK is located on your computer. To do so, set the NACL_SDK_ROOT environment variable in your shell. For example:
Likewise, the build needs to know where the FMOD SDK is installed as well. To do so, set the FMOD_SDK_ROOT environment variable in your shell. For example:
To build, go to scons/ and run the build.sh (Mac) or build.bat (Windows) script (NOTE: Windows build requires cygwin). The script takes two optional command line parameters:
-clean (clean, rather than build)
-p platform-level (specifies the Native Client platform level to build for - the default is pepper_16)
You will also have to ensure that FMOD has provided libraries for the platform level that you have specified or the linking phase of the build will fail. Look in FMOD_SDK_ROOT/api/lib/ and ensure that a subdirectory exists for the Native Client platform level you intend to build with. If no official FMOD libraries for a given platform level were provided in the SDK, you can attempt to use another version of the FMOD libraries by creating a soft-link (or shortcut in Windows) that links the desired platform level with an existing platform level library supplied by FMOD. For example:
ln -s pepper_15 pepper_16
This will create a node called pepper_16 that simply points to pepper_15 and will allow you to build and link for platform level pepper_16 even if no FMOD libraries for pepper_16 are present in the FMOD SDK. If you do not want sound support in your game, you can eliminate the FMOD dependency, but to do so you will have to manually remove the build dependencies in build.scons.
When the build completes, you will need to copy the moai_x86_32.exe, moai_x86_64.exe and moai.nmf to your extension directory.
Running a Moai Native Client Host
The basic workflow is:
Run the build script (only for C++ changes).
Clear browsing data.
Run the extension.
For questions, please see this forum thread.