Skip to content

User Manual AS2WASM

Erik de Bruin edited this page Nov 16, 2017 · 26 revisions

Prepare

Set up your system

Your system will need to have the following tools available/installed:

Make and CMake

The build of wat2wasm requires make and CMake to be installed on your computer:

PATH

Add the bin directory of CMake to the PATH:

On a Mac, set PATH to

export PATH=/Applications/CMake.app/Contents/bin:$PATH

Get the code

To use Royale WAST you need - for now - to get and set up 2 git repos:

git clone https://github.com/apache/royale-compiler.git royale-compiler
cd royale-compiler
git checkout feature/wast
cd ..
git clone https://github.com/apache/royale-asjs.git royale-asjs
cd royale-asjs
git checkout feature/wast

Build the code

Now we build the compiler project by running:

cd royale-compiler
ant sdk

WAT2WASM

The compiler puts out '.wat' files (WebAssembly Text format). In order to compile these files into the binary '.wasm', we have to use the wat2wasm tool.

npm install -g webassembly-binary-toolkit

Note: this will take a considerable amount of time to finish!

Your first Royale AS2WASM project

Build the 'wastc' compiler

cd royale-asjs/wast
npm run dev-build

Create a project

cd royale-asjs/wast
npm run create-project -- -dir=[root dir] -name=[project name]

Build your project

cd [root dir] /[project name]
npm run build
Clone this wiki locally