Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,39 @@ jobs:
distribution: temurin
java-version: '17'

- name: Install Hermes host build tools
if: inputs.js-engine == 'Hermes'
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get update
sudo apt-get install -y ninja-build
elif [ "${{ runner.os }}" = "macOS" ] && ! command -v ninja >/dev/null 2>&1; then
brew install ninja
fi

- name: Build Hermes host compilers
if: inputs.js-engine == 'Hermes'
run: |
git clone --depth 1 --branch hermes-integration https://github.com/CedricGuillemet/JsRuntimeHost.git Build/JsRuntimeHostHost
cmake -B Build/HermesHost -G Ninja -S Build/JsRuntimeHostHost \
Comment thread
CedricGuillemet marked this conversation as resolved.
Outdated
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D NAPI_JAVASCRIPT_ENGINE=Hermes \
-D HERMES_UNICODE_LITE=ON \
-D HERMES_ALLOW_BOOST_CONTEXT=0 \
-D JSRUNTIMEHOST_TESTS=OFF
cmake --build Build/HermesHost --target hermesc shermes --config RelWithDebInfo

- name: Build Playground ${{ inputs.js-engine }}
working-directory: Apps/Playground/Android
run: |
EXTRA_ARGS=""
if [ "${{ inputs.js-engine }}" = "Hermes" ]; then
EXTRA_ARGS="-PimportHostCompilers=${{ github.workspace }}/Build/HermesHost/ImportHostCompilers.cmake"
fi
chmod +x gradlew
./gradlew assembleRelease \
-PJSEngine=${{ inputs.js-engine }} \
-PjsEngine=${{ inputs.js-engine }} \
-PARM64Only \
-PNDK_VERSION=${{ env.NDK_VERSION }} \
-PSANITIZERS=OFF
-PSANITIZERS=OFF \
${EXTRA_ARGS}
3 changes: 2 additions & 1 deletion .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: ${{ inputs.js-engine == 'Hermes' && 60 || 30 }}
env:
CC: ${{ inputs.cc }}
CXX: ${{ inputs.cxx }}
Expand All @@ -46,6 +46,7 @@ jobs:
-D BX_CONFIG_DEBUG=ON \
-D OpenGL_GL_PREFERENCE=GLVND \
-D BABYLON_DEBUG_TRACE=ON \
${{ inputs.js-engine == 'Hermes' && '-D HERMES_UNICODE_LITE=ON -D HERMES_ALLOW_BOOST_CONTEXT=0' || '' }} \
-D ENABLE_SANITIZERS=${{ inputs.enable-sanitizers && 'ON' || 'OFF' }} .
ninja -C build/Linux

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
elif [ "${{ inputs.napi-type }}" = "V8" ]; then
SUFFIX="_V8"
JS_DEFINE="-DNAPI_JAVASCRIPT_ENGINE=V8"
elif [ "${{ inputs.napi-type }}" = "Hermes" ]; then
SUFFIX="_Hermes"
JS_DEFINE="-DNAPI_JAVASCRIPT_ENGINE=Hermes -DHERMES_ALLOW_BOOST_CONTEXT=0"
fi
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
echo "js_define=$JS_DEFINE" >> "$GITHUB_OUTPUT"
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ jobs:
platform: x64
napi-type: V8

Win32_x64_Hermes_D3D11:
uses: ./.github/workflows/build-win32.yml
with:
platform: x64
napi-type: Hermes

Win32_x64_D3D11_Sanitizers:
uses: ./.github/workflows/build-win32.yml
with:
Expand Down Expand Up @@ -104,6 +110,13 @@ jobs:
cxx: clang++
js-engine: JavaScriptCore

Ubuntu_Clang_Hermes:
uses: ./.github/workflows/build-linux.yml
with:
cc: clang
cxx: clang++
js-engine: Hermes

Ubuntu_GCC_JSC:
uses: ./.github/workflows/build-linux.yml
with:
Expand All @@ -124,6 +137,12 @@ jobs:
runs-on: ubuntu-latest
js-engine: V8

Android_Ubuntu_Hermes:
uses: ./.github/workflows/build-android.yml
with:
runs-on: ubuntu-latest
js-engine: Hermes

Android_MacOS_JSC:
uses: ./.github/workflows/build-android.yml
with:
Expand Down
3 changes: 3 additions & 0 deletions Apps/ModuleLoadTest/Source/App.X11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ namespace ModuleLoadTest
"libexpat.so.1",
"libgbm.so.1",
"libgldispatch.so.0",
"libicudata.so.74",
"libicuuc.so.74",
"liblzma.so.5",
"libpciaccess.so.0",
"libsensors.so.5",
"libtinfo.so.6",
Expand Down
21 changes: 14 additions & 7 deletions Apps/Playground/Android/BabylonNative/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ if (project.hasProperty("GRAPHICS_API")) {

def arcore_libpath = layout.buildDirectory.dir("arcore-native").get().asFile.absolutePath

def cmakeArguments = [
"-DANDROID_STL=c++_shared",
"-DENABLE_PCH=OFF",
"-DGRAPHICS_API=${graphics_api}",
"-DARCORE_LIBPATH=${arcore_libpath}/jni",
"-DNAPI_JAVASCRIPT_ENGINE=${jsEngine}",
"-DBABYLON_NATIVE_BUILD_APPS=ON",
"-DBABYLON_DEBUG_TRACE=ON"
]
if (project.hasProperty("importHostCompilers")) {
cmakeArguments.add("-DIMPORT_HOST_COMPILERS=${project.property('importHostCompilers')}")
}
Comment thread
CedricGuillemet marked this conversation as resolved.

configurations { natives }

android {
Expand All @@ -36,13 +49,7 @@ android {
externalNativeBuild {
cmake {
abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64"
arguments "-DANDROID_STL=c++_shared",
"-DENABLE_PCH=OFF",
"-DGRAPHICS_API=${graphics_api}",
"-DARCORE_LIBPATH=${arcore_libpath}/jni",
"-DNAPI_JAVASCRIPT_ENGINE=${jsEngine}",
"-DBABYLON_NATIVE_BUILD_APPS=ON",
"-DBABYLON_DEBUG_TRACE=ON"
arguments(*cmakeArguments)
cppFlags += ["-Wno-deprecated-literal-operator"]
}
}
Expand Down
2 changes: 2 additions & 0 deletions Apps/Playground/Scripts/validation_native.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
}

const engine = new BABYLON.NativeEngine();
globalThis.engine = engine;
engine.getCaps().parallelShaderCompile = undefined;

// Broaden Babylon's default retry strategy for the test framework: in addition to
Expand Down Expand Up @@ -113,6 +114,7 @@
}

const canvas = window;
globalThis.canvas = canvas;

// Random replacement
let seed = 1;
Expand Down
2 changes: 2 additions & 0 deletions Apps/Playground/Shared/AppContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ AppContext::AppContext(
m_runtime.emplace(options);

m_runtime->Dispatch([this, window, debugLog, additionalInit = std::move(additionalInit), playgroundOptions = std::move(playgroundOptions)](Napi::Env env) {
env.Global().Set("globalThis", env.Global());
m_device->AddToJavaScript(env);

{
Expand Down Expand Up @@ -184,6 +185,7 @@ AppContext::AppContext(
Babylon::Polyfills::Performance::Initialize(env);

Babylon::Polyfills::Window::Initialize(env);
env.Global().Set("canvas", env.Global());

Babylon::Polyfills::TextDecoder::Initialize(env);

Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ FetchContent_Declare(ios-cmake
GIT_TAG 4.5.0
EXCLUDE_FROM_ALL)
FetchContent_Declare(JsRuntimeHost
GIT_REPOSITORY https://github.com/BabylonJS/JsRuntimeHost.git
GIT_TAG c88625b6d61b55c4589f02408d03826e83199870)
GIT_REPOSITORY https://github.com/CedricGuillemet/JsRuntimeHost.git
Comment thread
CedricGuillemet marked this conversation as resolved.
Outdated
GIT_TAG hermes-integration)
FetchContent_Declare(libwebp
GIT_REPOSITORY https://github.com/webmproject/libwebp.git
GIT_TAG 57e324e2eb99be46df46d77b65705e34a7ae616c
Expand Down