Before building Prism, you'll need a few dependencies, depending on your target system.
- SpiderMonkey v60 pre-3 (from July 2018) (macOS only)
For Android, you'll need:
- Latest Android SDK
- Latest Android NDK
You'll also need:
- CMake, latest version (for every platform other than Windows UWP, installed as an addon in Android SDK)
- Python, latest version (for Windows UWP only)
- NodeJS, latest version
Configuring your build
Prism uses CMake for its builds. There's a few options you can configure depending on what kind of system you're targeting.
To use a runtime, you need to enable the runtime you want to use, for example:
cmake -g "Unix Makefiles" ../ -DPRISM_USE_SPIDERMONKEY=YES
On some platforms, there are multiple technology stacks available. Prism caters for some of these, and allows you to pick between them.
Win32 (classic Windows) and UWP (modern Windows) tech stacks are a work in progress and are in varying states of readiness. Win32 is enabled by default. To enable the modern tech stack, see BUILDING_FOR_UWP.md.
macOS (AppKit) and iOS (UIKit) tech stacks are available. To enable the iOS tech stack, you can enable the iOS option and specify the iOS toolchain, for example:
cmake -g "Unix Makefiles" ../ -DPRISM_USE_IOS=YES -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR64
To work with the Android tech stack, simply open the Android studio project in the android folder.
You'll need to add a gradle.properties file to your gradle home directory (~/.gradle on *nix OSes) with the following contents:
If your NodeJS is installed via a version manager (nvm, etc), you'll need to
NODEJS_BINARY_PATH variable to the directory containing a valid
node executable, for example:
cmake -g "Unix Makefiles" ../ -DNODEJS_BINARY_PATH=~/.nvm/versions/node/v11.7.0/bin
Not required for Android
via automatically generated code. You can improve the formatting of these
files if you have
This may be useful when changing the bindings (*.jsb files), as the generated code will be easier to read.
In order to take advantage of this, just make sure
clang-format is present
in your PATH.
Not required for Android
You can build the runtime and the example project from Android Studio.
After generating your CMake project, you should be able to compile prism using the project or makefile generated by CMake.
The compilation output will consist of a static library containing the prism runtime.
To integrate, you should link an application to this static library. Check out the examples for information on how to properly package a prism application for your target platform, and initialise the prism runtime.