This document describes how to build Hermes in a cross compilation setting, e.g. building for Android, WASM (with Emscripten), or any other platforms different than the host development machines.
Hermes now requires a two stage build proecess because the VM now contains Hermes bytecode which needs to be compiled by Hermes
We will use environment variable
$HERMES_WS_DIR to indicate the root of your
workspace where the
hermes git checkout directory is a subdirectory.
The key is that we need to pass a CMake flag
-DIMPORT_HERMESC:PATH=$HERMES_WS_DIR/build_host_hermesc/ImportHermesc.cmake during the cross compilation build of
Hermes so it can access the host
hermesc from the first stage to build the VM.
This process is currently happened in different places for different platforms:
- For Android, this happened in
- For Apple platforms, this happend in
- For Emscripten, you can find an example from the
hermes/.circleci/config.yml. Also see more details at Building with Emscripten