Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bf47252
Squashed 'Dependencies/CMakeExtensions/' content from commit 631780e428
CedricGuillemet Sep 2, 2026
05beeb3
Merge commit 'bf472529ef45f9f9f220683aa6a32bf2f8cc7a5e' as 'Dependenc…
CedricGuillemet Sep 2, 2026
abb7f8d
Squashed 'Dependencies/AndroidExtensions/' content from commit 2e85a8…
CedricGuillemet Sep 2, 2026
782aaec
Merge commit 'abb7f8da27b66fc8c2fed48de8c381dd7b9e033c' as 'Dependenc…
CedricGuillemet Sep 2, 2026
6aa3e60
Merge commit 'f49213c04cbdf887c6d83aa19d064a8812d1069c' as 'Dependenc…
CedricGuillemet Sep 2, 2026
f49213c
Squashed 'Dependencies/bgfx.cmake/' content from commit 9c64597523
CedricGuillemet Sep 2, 2026
4dfb4dd
Squashed 'Dependencies/glslang/' content from commit 284e4301e5
CedricGuillemet Sep 2, 2026
14bac6b
Merge commit '4dfb4dd25c10b82251510c61f7b499537c230efa' as 'Dependenc…
CedricGuillemet Sep 2, 2026
e360f40
Merge commit 'c9c9e2f87ff65e108fef8dfb678de92f5d6e211a' as 'Dependenc…
CedricGuillemet Sep 2, 2026
c9c9e2f
Squashed 'Dependencies/JsRuntimeHost/' content from commit 8cd1429510
CedricGuillemet Sep 2, 2026
e23752c
Merge commit '9046673b2ee93f37e40a0f891777e140d35b8e48' as 'Dependenc…
CedricGuillemet Sep 2, 2026
9046673
Squashed 'Dependencies/SPIRV-Cross/' content from commit a512817ddb
CedricGuillemet Sep 2, 2026
a422512
Merge commit '75509da8137c1d658c236aeb3de887941ea6fd8f' as 'Dependenc…
CedricGuillemet Sep 2, 2026
75509da
Squashed 'Dependencies/UrlLib/' content from commit e86ffb34e7
CedricGuillemet Sep 2, 2026
b749b8d
Merge commit '4466a4f55c08707cd20b780c6fdc12f8ec49f4de' as 'Dependenc…
CedricGuillemet Sep 2, 2026
4466a4f
Squashed 'Dependencies/bgfx/' content from commit 539e1febfb
CedricGuillemet Sep 2, 2026
1fda77c
Squashed 'Dependencies/bimg/' content from commit c3cf9afef0
CedricGuillemet Sep 2, 2026
4cf84bc
Merge commit '1fda77cdc1e26de8bb7e2cf688395591f34994b8' as 'Dependenc…
CedricGuillemet Sep 2, 2026
a60285f
Merge commit '0d507fe843f416093e5348edba3b960698abc119' as 'Dependenc…
CedricGuillemet Sep 2, 2026
0d507fe
Squashed 'Dependencies/bx/' content from commit efdef94b94
CedricGuillemet Sep 2, 2026
b3420f5
Use git subtrees for monorepo dependencies
CedricGuillemet Sep 2, 2026
e319f23
Merge upstream/master into monorepo subtree branch
CedricGuillemet Sep 2, 2026
de771fc
Squashed 'Dependencies/bgfx/' changes from 539e1febfb..0837ead970
CedricGuillemet Sep 2, 2026
24e4016
Merge commit 'de771fc9b605e3a4fede7232097ec874762f2f47' into cedricgu…
CedricGuillemet Sep 2, 2026
bab9c50
Squashed 'Dependencies/bimg/' changes from c3cf9afef0..371d90098b
CedricGuillemet Sep 2, 2026
97f4ca9
Merge commit 'bab9c50ddcc003f30f0ec8152e00d37566755637' into cedricgu…
CedricGuillemet Sep 2, 2026
b18aee8
Squashed 'Dependencies/bx/' changes from efdef94b94..080f466590
CedricGuillemet Sep 2, 2026
908df97
Merge commit 'b18aee8b7404d147702a0662d2fa2e9dfb9c0670' into cedricgu…
CedricGuillemet Sep 2, 2026
20530ca
Squashed 'Dependencies/SPIRV-Cross/' changes from a512817ddb..7c8705749f
CedricGuillemet Sep 2, 2026
232be00
Merge commit '20530caa19c9c89e11d830a91ef685af73928761' into cedricgu…
CedricGuillemet Sep 2, 2026
c29dc11
Squashed 'Dependencies/bgfx.cmake/' changes from 9c64597523..9a569c7759
CedricGuillemet Sep 2, 2026
68ddccf
Merge commit 'c29dc117025a5e664e31f610cf32b58a41e5b1de' into cedricgu…
CedricGuillemet Sep 2, 2026
3511d10
Squashed 'Dependencies/JsRuntimeHost/' changes from 8cd1429510..0d263…
CedricGuillemet Sep 2, 2026
873159b
Merge commit '3511d10762b5a77a98e640704696f71b41326e8c' into cedricgu…
CedricGuillemet Sep 2, 2026
0058ed3
Squashed 'Dependencies/UrlLib/' changes from e86ffb34e7..0c991337a1
CedricGuillemet Sep 2, 2026
0170cb9
Merge commit '0058ed3300ae95c3a795c1d6e627889d238caab4' into cedricgu…
CedricGuillemet Sep 2, 2026
2a6734d
Keep dependency subtrees upstream-compatible
CedricGuillemet Sep 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
33 changes: 21 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@ endif()

include(FetchContent)

# Resolve Babylon Native's imported dependency subtrees through the normal
# FetchContent declarations, including declarations made by nested consumers.
# Cache entries preserve explicit user-provided source-directory overrides.
set(FETCHCONTENT_SOURCE_DIR_CMAKEEXTENSIONS "${CMAKE_CURRENT_LIST_DIR}/Dependencies/CMakeExtensions" CACHE PATH "Location of the in-tree CMakeExtensions sources.")
set(FETCHCONTENT_SOURCE_DIR_ANDROIDEXTENSIONS "${CMAKE_CURRENT_LIST_DIR}/Dependencies/AndroidExtensions" CACHE PATH "Location of the in-tree AndroidExtensions sources.")
set(FETCHCONTENT_SOURCE_DIR_BGFX.CMAKE "${CMAKE_CURRENT_LIST_DIR}/Dependencies/bgfx.cmake" CACHE PATH "Location of the in-tree bgfx.cmake sources.")
set(FETCHCONTENT_SOURCE_DIR_GLSLANG "${CMAKE_CURRENT_LIST_DIR}/Dependencies/glslang" CACHE PATH "Location of the in-tree glslang sources.")
set(FETCHCONTENT_SOURCE_DIR_JSRUNTIMEHOST "${CMAKE_CURRENT_LIST_DIR}/Dependencies/JsRuntimeHost" CACHE PATH "Location of the in-tree JsRuntimeHost sources.")
set(FETCHCONTENT_SOURCE_DIR_SPIRV-CROSS "${CMAKE_CURRENT_LIST_DIR}/Dependencies/SPIRV-Cross" CACHE PATH "Location of the in-tree SPIRV-Cross sources.")
set(FETCHCONTENT_SOURCE_DIR_URLLIB "${CMAKE_CURRENT_LIST_DIR}/Dependencies/UrlLib" CACHE PATH "Location of the in-tree UrlLib sources.")

# bgfx.cmake owns these as git submodules upstream. Babylon Native supplies
# the corresponding sibling subtrees instead, without initializing gitlinks.
set(BGFX_DIR "${CMAKE_CURRENT_LIST_DIR}/Dependencies/bgfx" CACHE PATH "Location of the in-tree bgfx sources.")
set(BIMG_DIR "${CMAKE_CURRENT_LIST_DIR}/Dependencies/bimg" CACHE PATH "Location of the in-tree bimg sources.")
set(BX_DIR "${CMAKE_CURRENT_LIST_DIR}/Dependencies/bx" CACHE PATH "Location of the in-tree bx sources.")

# --------------------------------------------------
# Declarations
# --------------------------------------------------

# EXCLUDE_FROM_ALL is used to prevent FetchContent from automatically adding
# targets to the ALL_BUILD target. We do this for all dependencies except
# JsRuntimeHost because JsRuntimeHost has top-level targets (e.g., AppRuntime)
# that are part of the Babylon Native contract. When adding dependencies using
# FetchContent, add the EXCLUDE_FROM_ALL option except where there are top-level
# targets that are part of the Babylon Native contract.

FetchContent_Declare(AndroidExtensions
GIT_REPOSITORY https://github.com/BabylonJS/AndroidExtensions.git
GIT_TAG 2e85a8d43b89246c460112c9e5546ad54b6e87b4
Expand All @@ -41,14 +51,14 @@ FetchContent_Declare(CMakeExtensions
GIT_REPOSITORY https://github.com/BabylonJS/CMakeExtensions.git
GIT_TAG 631780e42886e5f12bfd1a5568c7395f1d657f43
EXCLUDE_FROM_ALL)
FetchContent_Declare(glslang
GIT_REPOSITORY https://github.com/BabylonJS/glslang.git
GIT_TAG 284e4301e5a6b44b279635276588db7cdd942624
EXCLUDE_FROM_ALL)
FetchContent_Declare(draco
GIT_REPOSITORY https://github.com/google/draco.git
GIT_TAG 1.5.7
EXCLUDE_FROM_ALL)
FetchContent_Declare(glslang
GIT_REPOSITORY https://github.com/BabylonJS/glslang.git
GIT_TAG 284e4301e5a6b44b279635276588db7cdd942624
EXCLUDE_FROM_ALL)
FetchContent_Declare(meshoptimizer
GIT_REPOSITORY https://github.com/zeux/meshoptimizer.git
GIT_TAG v0.22
Expand All @@ -71,7 +81,6 @@ FetchContent_Declare(SPIRV-Cross
GIT_REPOSITORY https://github.com/BabylonJS/SPIRV-Cross.git
GIT_TAG 7c8705749fc1e234119c20695f82179b30d90914
EXCLUDE_FROM_ALL)

# --------------------------------------------------

FetchContent_MakeAvailable(CMakeExtensions)
Expand Down
1 change: 1 addition & 0 deletions Dependencies/AndroidExtensions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Build
50 changes: 50 additions & 0 deletions Dependencies/AndroidExtensions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.18)

include(FetchContent)

# --------------------------------------------------
# Declarations
# --------------------------------------------------
FetchContent_Declare(arcana.cpp
GIT_REPOSITORY https://github.com/microsoft/arcana.cpp.git
GIT_TAG f2757396e80bc4169f2ddb938ce25367a98ffdd0)
FetchContent_Declare(CMakeExtensions
GIT_REPOSITORY https://github.com/BabylonJS/CMakeExtensions.git
GIT_TAG ea28b7689530bfdc4905806f27ecf7e8ed4b5419)
# --------------------------------------------------

FetchContent_MakeAvailable(CMakeExtensions)

project(AndroidExtensions)

if(NOT ANDROID AND NOT BABYLON_NATIVE_BUILD_SOURCETREE)
message(FATAL_ERROR "This project can only build for Android")
endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

FetchContent_MakeAvailable_With_Message(arcana.cpp)

set(SOURCES
"Include/AndroidExtensions/Globals.h"
"Include/AndroidExtensions/JavaWrappers.h"
"Include/AndroidExtensions/OpenGLHelpers.h"
"Include/AndroidExtensions/Permissions.h"
"Include/AndroidExtensions/StdoutLogger.h"
"Source/Globals.cpp"
"Source/JavaWrappers.cpp"
"Source/OpenGLHelpers.cpp"
"Source/Permissions.cpp"
"Source/StdoutLogger.cpp")

add_library(AndroidExtensions ${SOURCES})

target_link_libraries(AndroidExtensions
PUBLIC arcana)

target_include_directories(AndroidExtensions PUBLIC "Include")

source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
14 changes: 14 additions & 0 deletions Dependencies/AndroidExtensions/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing

This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
40 changes: 40 additions & 0 deletions Dependencies/AndroidExtensions/Dependencies/WebSocket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import java.net.URI;
import java.net.URISyntaxException;

public class WebSocket extends WebSocketClient {
public WebSocket(String url) throws URISyntaxException
{
super(new URI(url));
}

@Override
public void onOpen(ServerHandshake handshakedata)
{
this.openCallback();
}

@Override
public void onMessage(String message)
{
this.messageCallback(message);
}

@Override
public void onClose(int code, String reason, boolean remote)
{
this.closeCallback(code, reason);
}

@Override
public void onError(Exception ex)
{
this.errorCallback(ex.getMessage());
}

public native void openCallback();
public native void closeCallback(int code, String reason);
public native void messageCallback(String message);
public native void errorCallback(String message);
}
38 changes: 38 additions & 0 deletions Dependencies/AndroidExtensions/Include/AndroidExtensions/Globals.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma once

#include <jni.h>
#include <android/asset_manager_jni.h>
#include <arcana/containers/ticketed_collection.h>
#include "JavaWrappers.h"

namespace android::global
{
void Initialize(JavaVM* javaVM, jobject appContext);
// Overload supporting headless scenarios without a Context.
// Safe to call multiple times (e.g., hot reloads).
void Initialize(JavaVM* javaVM, jobject appContext, jobject assetManager);

JNIEnv* GetEnvForCurrentThread();

android::content::Context GetAppContext();

void SetAssetManager(jobject assetManager);
AAssetManager* GetAssetManager();

android::app::Activity GetCurrentActivity();
void SetCurrentActivity(jobject currentActivity);
using AppStateChangedCallback = std::function<void()>;
using AppStateChangedCallbackTicket = arcana::ticketed_collection<AppStateChangedCallback>::ticket;

void Pause();
AppStateChangedCallbackTicket AddPauseCallback(std::function<void()>&&);

void Resume();
AppStateChangedCallbackTicket AddResumeCallback(std::function<void()>&&);

using RequestPermissionsResultCallback = std::function<void(int32_t, const std::vector<std::string>&, const std::vector<int32_t>&)>;
using RequestPermissionsResultCallbackTicket = arcana::ticketed_collection<RequestPermissionsResultCallback>::ticket;

void RequestPermissionsResult(int32_t, const std::vector<std::string>&, const std::vector<int32_t>&);
RequestPermissionsResultCallbackTicket AddRequestPermissionsResultCallback(RequestPermissionsResultCallback&&);
}
Loading
Loading