Add Android AAR project for embedding Babylon Native#1682
Open
CedricGuillemet wants to merge 3 commits intoBabylonJS:masterfrom
Open
Add Android AAR project for embedding Babylon Native#1682CedricGuillemet wants to merge 3 commits intoBabylonJS:masterfrom
CedricGuillemet wants to merge 3 commits intoBabylonJS:masterfrom
Conversation
Adds Install/AndroidAAR/ - a standalone Gradle project that builds a publishable AAR (libBabylonNativeJNI.so + BabylonView/Wrapper Java classes) tuned for the smallest possible footprint: - QuickJS engine, libc++ statically linked - Only arm64-v8a / x86_64 ABIs - OpenGL ES 3.0 only (no Vulkan/D3D/Metal compiled into bgfx) - Image loading, shader compiler, NativeInput, XMLHttpRequest, NativeXr plugins disabled - Release build uses MinSizeRel (-Os, hidden visibility, --gc-sections, --strip-all) Embedding application is expected to drive script loading via BabylonView.loadScript() - nothing is auto-loaded by the AAR. Optional shader cache is read from the embedding application's 'shadercache.bin' asset. Includes: - README.md documenting the contract and footprint optimizations - build-release.ps1 helper that builds and prints AAR/.so sizes - New CI job Android_AAR (build-android-aar.yml) that builds the AAR, prints artifact sizes and uploads the AAR as a workflow artifact Note: temporarily pins JsRuntimeHost to CedricGuillemet/JsRuntimeHost fork until the upstream QuickJS support PR is merged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…JsRuntimeHost
- Restore JsRuntimeHost FetchContent declaration without EXCLUDE_FROM_ALL
(per the comment block above, JsRuntimeHost is intentionally an exception
because it exposes top-level targets like AppRuntime that are part of
the Babylon Native contract).
- Rename Install/AndroidAAR -> Install/AndroidQuickJSMinimal and align all
related identifiers:
* workflow file: build-android-aar.yml -> build-android-quickjs-minimal.yml
* CI job: Android_AAR -> Android_QuickJSMinimal
* gradle root project: BabylonNativeAAR -> BabylonNativeQuickJSMinimal
* uploaded artifact: BabylonNative-release-aar -> BabylonNative-QuickJSMinimal-release-aar
* build staging dir: Build/Android-AAR -> Build/Android-QuickJSMinimal
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The minimal AAR does not link NativeXr, so xrSurfaceChanged() and
isXRActive() are dead surface area. Drop them from:
- BabylonNativeJNI.cpp (the two stub JNI exports)
- Wrapper.java (the two native declarations)
- BabylonView.java (the secondary xrSurfaceView, its callback and
the isXRActive() check in onDraw)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Install/AndroidAAR/— a self-contained Gradle project producing a publishable Android AAR (BabylonNative-release.aar) intended to embed Babylon Native inside any Android application with the smallest possible footprint.Footprint optimizations
arm64-v8a+x86_64onlyNativeInput,XMLHttpRequest,NativeXrplugins disabledMinSizeRel(-Os), function/data sections, hidden visibility,--gc-sections,--strip-allPublic contract
BabylonView.loadScript()— nothing is auto-loaded by the AAR.shadercache.binasset.Includes
README.mddocumenting the contract and footprint optimizationsbuild-release.ps1helper that builds + prints AAR / .so sizesAndroid_AAR(build-android-aar.yml) that builds the AAR, prints artifact sizes and uploads the AAR as a workflow artifactNote
Temporarily pins
JsRuntimeHostto theCedricGuillemet/JsRuntimeHostfork until the upstream QuickJS support PR is merged.Naming is hard. I'm using generic/stupid names like 'Android-AAR'. Please provide your ideas.