Skip to content

Fix ARcore dep, iOS deployment#732

Merged
CedricGuillemet merged 6 commits into
BabylonJS:masterfrom
CedricGuillemet:FixArcoreiosDep
May 11, 2026
Merged

Fix ARcore dep, iOS deployment#732
CedricGuillemet merged 6 commits into
BabylonJS:masterfrom
CedricGuillemet:FixArcoreiosDep

Conversation

@CedricGuillemet
Copy link
Copy Markdown
Collaborator

  • Detect ARcore lib path with user overiding version
  • iOS min deployment is now 16+

Copilot AI added 5 commits May 11, 2026 11:35
The -DARCORE_LIBPATH cmake argument was hardcoded to core-1.22.0.aar in

Modules/@babylonjs/react-native/android/build.gradle. If a consumer project

applies a resolutionStrategy.force on com.google.ar:core (for example to

resolve a duplicate-class conflict between core:1.22.0 and

installreferrer:2.2 by forcing core:1.26.0), Gradle extracts the AAR into

core-1.26.0.aar/jni while the native build still looks for

core-1.22.0.aar/jni, failing with: 'libarcore_sdk_c.so missing and no

known rule to make it'.

Resolve the actual extracted AAR via configurations.extractLibs and rewrite

the -DARCORE_LIBPATH cmake argument to match the resolved version, with a

graceful fallback to core-1.22.0.aar if resolution fails.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…project

ios/CMakeLists.txt hardcoded the iOS deployment target to 12 in two places:

  - set(DEPLOYMENT_TARGET "12" CACHE STRING "") (line 12, consumed by the

    leetal/ios-cmake toolchain to set CMAKE_OSX_DEPLOYMENT_TARGET)

  - XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 12.0 on the BabylonNative target

Xcode 26's Clang crashes compiling DeviceImpl_iOS.mm against iOS 12, so

projects targeting iOS 16+ had to patch the deployment target from their

Podfile post_install hook.

Plumb a new BABYLON_IOS_DEPLOYMENT_TARGET environment variable from

postinstall.js into the CMake invocation (as -DDEPLOYMENT_TARGET=<value>)

and have CMakeLists.txt honour, in order: an explicit -DDEPLOYMENT_TARGET=,

the BABYLON_IOS_DEPLOYMENT_TARGET env var, then the historical 12 default.

Both DEPLOYMENT_TARGET and XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET now use

the resolved value, so the generated ReactNativeBabylon.xcodeproj matches

the consuming app's Podfile platform :ios setting without manual patching.

Documented in README.md alongside BABYLON_NO_CMAKE_POSTINSTALL and

BABYLON_USE_SYSTEM_CMAKE.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
iOS 12 is no longer a viable minimum: Xcode 26's Clang crashes while

compiling DeviceImpl_iOS.mm against the iOS 12 SDK, so consumers were

forced to override the deployment target via Podfile post_install or via

the BABYLON_IOS_DEPLOYMENT_TARGET env var introduced in the previous

commit. Bump the default everywhere so unmodified consumer projects work

out of the box on Xcode 26+:

  - ios/CMakeLists.txt: DEPLOYMENT_TARGET default 12 -> 16 (still

    overridable via -DDEPLOYMENT_TARGET= or BABYLON_IOS_DEPLOYMENT_TARGET).

  - react-native-babylon.podspec: s.platforms ios 12.0 -> 16.0 so

    CocoaPods enforces the new minimum on consuming apps.

  - postinstall.js: update comment to reflect the new default.

  - README.md: update iOS configuration section and the

    BABYLON_IOS_DEPLOYMENT_TARGET docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Both the implementation and �xtractLibs dependency declarations

hardcoded com.google.ar:core:1.22.0. In practice this is harmless because

Gradle's normal conflict resolution and any consumer-side

resolutionStrategy.force on com.google.ar:core override the declared

version, but it forced every consumer that wants a newer ARCore (e.g. to

resolve the duplicate-class conflict between core:1.22 and

installreferrer:2.2 requiring core:1.26+) to add a resolutionStrategy.force

AND remember to keep the native build's ARCORE_LIBPATH in sync.

Expose the ARCore version as a Gradle ext property using the existing

safeExtGet helper, defaulting to 1.22.0 for backwards compatibility:

  ext.arcoreVersion = '1.26.0'  // in the consumer's root build.gradle

Use the variable in both implementation and �xtractLibs, in the cmake

ARCORE_LIBPATH default, and in the dynamic-resolution fallback. The

dynamic resolution (added previously) still picks up the actually-extracted

AAR when a resolutionStrategy.force overrides the declared version, so

both override mechanisms continue to work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop the defensive scaffolding (try/catch, group filter, manual index

loop with not-found fallback, status logger.warn) and use List.replaceAll

for the cmake-args mutation. Behaviour is unchanged: still resolves the

extractLibs configuration after the dependencies block (necessary because

the android { } block evaluates cmake.arguments before the dependencies

are declared further down in the script) and rewrites -DARCORE_LIBPATH to

match the actually-extracted AAR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 10:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Babylon React Native’s platform build configuration to (1) raise the minimum supported iOS deployment target to 16 and (2) make Android ARCore AAR/JNI path detection resilient to consumer-overridden ARCore versions.

Changes:

  • Raise iOS minimum deployment target to 16.0 (docs + podspec) and add an env var override for the generated Xcode project deployment target.
  • Add ext.arcoreVersion support on Android and dynamically rewrite -DARCORE_LIBPATH to match the resolved ARCore AAR version.
  • Document BABYLON_IOS_DEPLOYMENT_TARGET for consumers.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Modules/@babylonjs/react-native/README.md Updates iOS minimum target to 16 and documents BABYLON_IOS_DEPLOYMENT_TARGET.
Modules/@babylonjs/react-native/react-native-babylon.podspec Raises CocoaPods minimum iOS platform version to 16.0.
Modules/@babylonjs/react-native/postinstall.js Forwards BABYLON_IOS_DEPLOYMENT_TARGET to CMake when generating the iOS Xcode project.
Modules/@babylonjs/react-native/ios/CMakeLists.txt Adds deployment target override logic and applies it to Xcode build settings.
Modules/@babylonjs/react-native/android/build.gradle Introduces overrideable ARCore version + resolves actual extracted AAR name to set ARCORE_LIBPATH.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Modules/@babylonjs/react-native/ios/CMakeLists.txt
Comment thread Modules/@babylonjs/react-native/android/build.gradle
Comment thread Modules/@babylonjs/react-native/android/build.gradle
The @babylonjs/react-native podspec declares an iOS 16 minimum (matching the CMake-generated framework's default deployment target). The test app's Podfile relied on react-native-test-app's lower default, which caused 'pod install' to reject the local pod with Specs satisfying the react-native-babylon dependency were found, but they required a higher minimum deployment target.' Set the Podfile's platform explicitly to keep CI's Pods install in sync with the pod's minimum.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@CedricGuillemet CedricGuillemet changed the title Fix arcoreios dep Fix arcore & ios dep May 11, 2026
@CedricGuillemet CedricGuillemet changed the title Fix arcore & ios dep Fix ARcore dep, iOS deployment May 11, 2026
@CedricGuillemet CedricGuillemet merged commit 1b3cf55 into BabylonJS:master May 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants