-
Notifications
You must be signed in to change notification settings - Fork 23
Incremental steps to support Android XR #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
79e03c1
43d677a
22d1f96
435c798
e1d0f2f
dbef5ba
1159300
39f1536
82b17e8
2dd6185
98c40b5
02a7dc5
99c49b1
a40c852
f98247a
7faff92
b3480ca
118450b
4d9eb96
e5e5648
d205c4a
4633fa3
465685e
fcc3ce1
c1fdff4
a54a121
be1baf6
a6a258d
b9aa23c
27eed75
9a268bb
56be206
f378d3f
ed53fd9
863f962
2e467dd
84005c0
9e3cfc9
98e80ef
499ae36
51f1f45
496c67f
403b452
5253492
ebf6950
cfb1af6
d30f735
d23737f
ada4a17
56c1f3e
04bcc75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ FetchContent_Declare(arcana.cpp | |
| GIT_TAG c726dbe58713eda65bfb139c257093c43479b894) | ||
| FetchContent_Declare(AndroidExtensions | ||
| GIT_REPOSITORY https://github.com/BabylonJS/AndroidExtensions.git | ||
| GIT_TAG 7d88a601fda9892791e7b4e994e375e049615688) | ||
| GIT_TAG f7ed149b5360cc8a4908fece66607c5ce1e6095b) | ||
| FetchContent_Declare(asio | ||
| GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git | ||
| GIT_TAG f693a3eb7fe72a5f19b975289afc4f437d373d9c) | ||
|
|
@@ -49,6 +49,19 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) | |
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| if(APPLE) | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fobjc-arc") | ||
| if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
| if(NOT DEFINED JSRUNTIMEHOST_NATIVE_SANITIZERS) | ||
| set(JSRUNTIMEHOST_NATIVE_SANITIZERS "address,undefined") | ||
| endif() | ||
| if(JSRUNTIMEHOST_NATIVE_SANITIZERS) | ||
| message(STATUS "macOS sanitizers enabled: ${JSRUNTIMEHOST_NATIVE_SANITIZERS}") | ||
| add_compile_options("-fsanitize=${JSRUNTIMEHOST_NATIVE_SANITIZERS}" "-fno-omit-frame-pointer") | ||
| add_link_options("-fsanitize=${JSRUNTIMEHOST_NATIVE_SANITIZERS}") | ||
| endif() | ||
| endif() | ||
| endif() | ||
|
|
||
| # -------------------------------------------------- | ||
| # Options | ||
|
|
@@ -81,6 +94,21 @@ set_property(TARGET arcana PROPERTY FOLDER Dependencies) | |
| if(JSRUNTIMEHOST_POLYFILL_XMLHTTPREQUEST) | ||
| FetchContent_MakeAvailable_With_Message(UrlLib) | ||
| set_property(TARGET UrlLib PROPERTY FOLDER Dependencies) | ||
| if(APPLE) | ||
| FetchContent_GetProperties(UrlLib) | ||
| if(UrlLib_POPULATED) | ||
| target_compile_options(UrlLib PRIVATE -fobjc-arc) | ||
| set(_urllib_objc_sources | ||
| "${UrlLib_SOURCE_DIR}/Source/UrlRequest_Apple.mm" | ||
| "${UrlLib_SOURCE_DIR}/Source/WebSocket_Apple.mm" | ||
| "${UrlLib_SOURCE_DIR}/Source/WebSocket_Apple_ObjC.m") | ||
| foreach(_file IN LISTS _urllib_objc_sources) | ||
| if(EXISTS "${_file}") | ||
| set_source_files_properties("${_file}" PROPERTIES COMPILE_FLAGS "-fobjc-arc") | ||
| endif() | ||
| endforeach() | ||
| endif() | ||
| endif() | ||
|
Comment on lines
+97
to
+111
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be in UrlLib itself? |
||
| endif() | ||
|
|
||
| if(BABYLON_DEBUG_TRACE) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "dependencies": { | ||
| "jsc-android": "250231.0.0" | ||
| "jsc-android": "294992.0.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ polyfills that consumers can include if required. | |
|
|
||
| ## **Building - All Development Platforms** | ||
|
|
||
| **Required Tools:** [git](https://git-scm.com/), [CMake](https://cmake.org/), [node.js](https://nodejs.org/en/) | ||
| **Required Tools:** [git](https://git-scm.com/), [CMake 3.29 or newer](https://cmake.org/), [node.js 20.x or newer](https://nodejs.org/en/) | ||
|
|
||
| The first step for all development environments and targets is to clone this repository. | ||
|
|
||
|
|
@@ -32,9 +32,9 @@ npm install | |
| _Follow the steps from [All Development Platforms](#all-development-platforms) before proceeding._ | ||
|
|
||
| **Required Tools:** | ||
| [Android Studio](https://developer.android.com/studio), [Node.js](https://nodejs.org/en/download/), [Ninja](https://ninja-build.org/) | ||
| [Android Studio](https://developer.android.com/studio) with Android NDK 28.2.13676358 and API level 35 SDK platforms installed, [Node.js 20.x or newer](https://nodejs.org/en/download/), [Ninja](https://ninja-build.org/) | ||
|
|
||
| The minimal requirement target is Android 5.0. | ||
| The minimal requirement target is Android 10.0, which has [~95%](https://gs.statcounter.com/android-version-market-share/mobile-tablet/worldwide) active device coverage globally. Android 10 support covers Meta Quest 1 (and newer), HTC Vive Focus 2 (and newer), and Pico 3 (and newer). | ||
|
|
||
| Only building with Android Studio is supported. CMake is not used directly. Instead, Gradle | ||
| is used for building and CMake is automatically invocated for building the native part. | ||
|
|
@@ -68,4 +68,4 @@ Security Response Center (MSRC) at [[email protected]](mailto:secure@microsof | |
| You should receive a response within 24 hours. If for some reason you do not, please | ||
| follow up via email to ensure we received your original message. Further information, | ||
| including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can | ||
| be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default). | ||
| be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,10 @@ | ||
| add_subdirectory(UnitTests) | ||
| set(JSRUNTIMEHOST_OUTPUT_DIR "${CMAKE_SOURCE_DIR}/build/Tests/UnitTests/dist") | ||
| set(JSRUNTIMEHOST_OUTPUT_DIR "${JSRUNTIMEHOST_OUTPUT_DIR}" CACHE INTERNAL "Output directory for bundled unit test scripts") | ||
| file(MAKE_DIRECTORY "${JSRUNTIMEHOST_OUTPUT_DIR}") | ||
| file(REMOVE_RECURSE "${CMAKE_CURRENT_SOURCE_DIR}/UnitTests/dist") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a good idea? Seems dangerous to remove a folder in the source folder when running CMake. |
||
|
|
||
| set(ENV{JSRUNTIMEHOST_BUNDLE_OUTPUT} "${JSRUNTIMEHOST_OUTPUT_DIR}") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, looking at this more. I didn't realize what was happening here. Looks like |
||
| npm(install --silent) | ||
| unset(ENV{JSRUNTIMEHOST_BUNDLE_OUTPUT}) | ||
|
|
||
| add_subdirectory(UnitTests) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,36 +7,56 @@ if (project.hasProperty("jsEngine")) { | |
| jsEngine = project.property("jsEngine") | ||
| } | ||
|
|
||
| def targetApiLevel = 35 | ||
| def requiredNdkVersion = project.findProperty("ndkVersion") ?: "28.2.13676358" | ||
|
|
||
| android { | ||
| namespace 'com.jsruntimehost.unittests' | ||
| compileSdk 33 | ||
| ndkVersion = "23.1.7779620" | ||
| if (project.hasProperty("ndkVersion")) { | ||
| ndkVersion = project.property("ndkVersion") | ||
| } | ||
| compileSdk targetApiLevel | ||
| ndkVersion = requiredNdkVersion | ||
|
|
||
| defaultConfig { | ||
| applicationId "com.jsruntimehost.unittests" | ||
| minSdk 21 | ||
| targetSdk 33 | ||
| targetSdk targetApiLevel | ||
| versionCode 1 | ||
| versionName "1.0" | ||
|
|
||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
|
|
||
| externalNativeBuild { | ||
| cmake { | ||
| arguments ( | ||
| arguments( | ||
| "-DANDROID_STL=c++_shared", | ||
| "-DNAPI_JAVASCRIPT_ENGINE=${jsEngine}", | ||
| "-DJSRUNTIMEHOST_CORE_APPRUNTIME_V8_INSPECTOR=ON" | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| if (project.hasProperty("abiFilters")) { | ||
| ndk { | ||
| abiFilters project.getProperty("abiFilters") | ||
| ndk { | ||
| def abiFiltersProp = project.findProperty("abiFilters")?.toString() | ||
| if (abiFiltersProp) { | ||
| def propFilters = abiFiltersProp.split(',').collect { it.trim() }.findAll { !it.isEmpty() } | ||
| if (!propFilters.isEmpty()) { | ||
| abiFilters(*propFilters) | ||
| } | ||
| } else { | ||
| // Prefer injected ABI hints and fall back to a host-aware default | ||
| def requestedAbi = project.findProperty("android.injected.build.abi") ?: System.getenv("ANDROID_ABI") | ||
| def defaultAbis = [] | ||
| if (requestedAbi) { | ||
| defaultAbis = requestedAbi.split(',').collect { it.trim() }.findAll { !it.isEmpty() } | ||
| } | ||
| if (defaultAbis.isEmpty()) { | ||
| def hostArch = (System.getProperty("os.arch") ?: "").toLowerCase() | ||
| if (hostArch.contains("aarch64") || hostArch.contains("arm64")) { | ||
| defaultAbis = ['arm64-v8a'] | ||
| } else { | ||
| defaultAbis = ['arm64-v8a', 'x86_64'] | ||
| } | ||
| } | ||
| abiFilters(*defaultAbis) | ||
|
Comment on lines
+37
to
+59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of this change? |
||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are sanitizers supposed to be part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To some degree, yes, because NDK 28 turns some of them on by default and the crash that occurred is what got me started on that sidequest. We could override the NDK 28 default to turn off default sanitizers, and put the fixes into a separate PR. Up to you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious about what could be found with sanitizers so I opened this PR : BabylonJS/BabylonNative#1559