Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 11 additions & 1 deletion .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@ jobs:
distribution: temurin
java-version: '17'

- name: Install Ninja (Hermes host-compiler bootstrap)
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 Playground ${{ inputs.js-engine }}
working-directory: Apps/Playground/Android
run: |
chmod +x gradlew
./gradlew assembleRelease \
-PJSEngine=${{ inputs.js-engine }} \
-PjsEngine=${{ inputs.js-engine }} \
-PARM64Only \
-PNDK_VERSION=${{ env.NDK_VERSION }} \
-PSANITIZERS=OFF
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
51 changes: 33 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,36 @@ jobs:
# ── Apple: macOS ──────────────────────────────────────────────
MacOS:
uses: ./.github/workflows/build-macos.yml
with:
xcode-version: "26.4"
runs-on: macos-26

MacOS_Ninja:
uses: ./.github/workflows/build-macos.yml
with:
generator: 'Ninja Multi-Config'
generator: "Ninja Multi-Config"
xcode-version: "26.4"
runs-on: macos-26

MacOS_Sanitizers:
uses: ./.github/workflows/build-macos.yml
with:
enable-sanitizers: true

# ── Apple: iOS ────────────────────────────────────────────────
iOS_iOS180:
uses: ./.github/workflows/build-ios.yml
with:
deployment-target: '18.0'

iOS_iOS175:
uses: ./.github/workflows/build-ios.yml
with:
deployment-target: '17.5'
xcode-version: "26.4"
runs-on: macos-26

# ── Apple: Xcode 26 ──────────────────────────────────────────
MacOS_Xcode26:
uses: ./.github/workflows/build-macos.yml
with:
xcode-version: '26.4'
xcode-version: "26.4"
runs-on: macos-26

iOS_Xcode26:
uses: ./.github/workflows/build-ios.yml
with:
deployment-target: '26.0'
xcode-version: '26.4'
deployment-target: "26.0"
xcode-version: "26.4"
runs-on: macos-26

# ── Win32─────────────────────────────────────────────────────
Expand All @@ -64,6 +60,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 +106,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,23 +133,29 @@ 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:
runs-on: macos-latest
runs-on: macos-26
js-engine: JavaScriptCore

Android_MacOS_V8:
uses: ./.github/workflows/build-android.yml
with:
runs-on: macos-latest
runs-on: macos-26
js-engine: V8

# ── Installation Tests ────────────────────────────────────────
iOS_Installation:
uses: ./.github/workflows/test-install-ios.yml
with:
deployment-target: '17.2'
deployment-target: "17.2"

Linux_Installation:
uses: ./.github/workflows/test-install-linux.yml
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test-install-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ on:
xcode-version:
required: false
type: string
default: '16.4'
default: "26.4.1"

jobs:
test-install:
runs-on: macos-latest
runs-on: macos-26
timeout-minutes: 20
steps:
- uses: actions/checkout@v5


- name: Select Xcode ${{ inputs.xcode-version }}
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test-install-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ on:
xcode-version:
required: false
type: string
default: '16.4'
default: "26.4.1"

jobs:
test-install:
runs-on: macos-latest
runs-on: macos-26
timeout-minutes: 20
steps:
- uses: actions/checkout@v5


- name: Select Xcode ${{ inputs.xcode-version }}
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer

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
27 changes: 20 additions & 7 deletions Apps/Playground/Android/BabylonNative/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ 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"
]
// Hermes for Android needs HOST hermesc/shermes (they emit bytecode at build
// time and can't run as NDK-cross-compiled binaries). JsRuntimeHost's CMake
Comment thread
CedricGuillemet marked this conversation as resolved.
// bootstraps these host compilers automatically when cross-compiling, so no
// hand-off is normally required. This property is an optional manual override:
// pass -PimportHostCompilers=<ImportHostCompilers.cmake> to reuse a prebuilt
// host-compiler set and skip the in-CMake bootstrap.
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 +55,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: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ FetchContent_Declare(ios-cmake
EXCLUDE_FROM_ALL)
FetchContent_Declare(JsRuntimeHost
GIT_REPOSITORY https://github.com/BabylonJS/JsRuntimeHost.git
GIT_TAG 272f6a9f3de78f7c4cd8a838ae9655c81fc4881a)
GIT_TAG f07d99119887131a89a3580ada9c2a8dbc7782f7)
FetchContent_Declare(metal-cpp
GIT_REPOSITORY https://github.com/bkaradzic/metal-cpp.git
GIT_TAG metal-cpp_26
Expand Down
11 changes: 11 additions & 0 deletions Embedding/Source/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ namespace Babylon::Embedding
#endif

m_appRuntime->Dispatch([implPtr = this, window](Napi::Env env) {
// 0. Install the ES2020 `globalThis` self-reference. V8/JSC/Chakra
// provide it intrinsically, but the embedded Hermes runtime does
// not, and Hermes evaluates eval()'d code as indirect (global
// scope) eval -- so browser-style snippets can only reach host
// state through properties of the global object.
env.Global().Set("globalThis", env.Global());

// 1. Make the Device available to JS.
implPtr->m_device->AddToJavaScript(env);

Expand Down Expand Up @@ -225,6 +232,10 @@ namespace Babylon::Embedding

#if BABYLON_NATIVE_POLYFILL_WINDOW
Babylon::Polyfills::Window::Initialize(env);
// Alias `canvas` to the global object so playground snippets that
// reference a bare `canvas` global resolve under Hermes indirect
// eval (mirrors the `window` polyfill).
env.Global().Set("canvas", env.Global());
#endif

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