Skip to content
Build native, high quality applications in JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.idea
android
cmake
compiler
docs
example-mac
example-win32
example-winrt
lib
prism
shell
toolchains
winrt
.clang-format
.editorconfig
.gitignore
BUILDING_FOR_UWP.md
CMakeLists.txt
README.md
TODO.md
packages.config
pch.cpp
pch.h
prism.sln

README.md

Prism

Prism is a toolkit for building native applications in JavaScript, exposing the power of the native operating system, and making full use of the built-in UI technologies.

Preflight

Before building Prism, you'll need a few dependencies, depending on your target system.

For JavaScript, you'll need one of the following:

  • SpiderMonkey v60 pre-3 (from July 2018) (macOS only)
  • JavascriptCore (built into macOS and iOS, requires compilation for Android, macOS, iOS and Android 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.

JavaScript Runtime

There's currently two options for JavaScript:

  • Spidermonkey, ES6+ support, more memory and computationally expensive, but offers the latest JavaScript functionality
  • JavascriptCore, Less up to date than SpiderMonkey, but the only option available for iOS

To use a runtime, you need to enable the runtime you want to use, for example:

cmake -g "Unix Makefiles" ../ -DPRISM_USE_SPIDERMONKEY=YES

Platform Variants

On some platforms, there are multiple technology stacks available. Prism caters for some of these, and allows you to pick between them.

Windows

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.

Apple

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

Android

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:

prism.nodePath=/full/path/to/directory/containing/node

NodeJS

If your NodeJS is installed via a version manager (nvm, etc), you'll need to set the 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

Formatting

The majority of the bindings to your chosen JavaScript runtime are achieved via automatically generated code. You can improve the formatting of these files if you have clang-format installed.

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

Building

Android

You can build the runtime and the example project from Android Studio.

Other platforms

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.

You can’t perform that action at this time.