Skip to content

Fix Xcode 26 build: suppress deprecated-declarations + BABYLON_USE_SYSTEM_CMAKE env var#726

Merged
CedricGuillemet merged 3 commits intoBabylonJS:masterfrom
CedricGuillemet:xcode26-deprecated-declarations-fix
Apr 15, 2026
Merged

Fix Xcode 26 build: suppress deprecated-declarations + BABYLON_USE_SYSTEM_CMAKE env var#726
CedricGuillemet merged 3 commits intoBabylonJS:masterfrom
CedricGuillemet:xcode26-deprecated-declarations-fix

Conversation

@CedricGuillemet
Copy link
Copy Markdown
Collaborator

Summary

This PR addresses two issues when building BabylonReactNative with Xcode 26 (Clang 20) and adds a quality-of-life improvement for cmake usage.

Fix: Xcode 26 -Wdeprecated-declarations build failure

Xcode 26 / Clang 20 promotes wstring_convert<std::codecvt_utf8_utf16<char16_t>> deprecation warnings to hard errors under -Werror (set by BabylonNative’s warnings_as_errors() in cmakeextensions). The #pragma GCC diagnostic ignored suppression in napi-inl.h is not sufficient in this context.

Fix: Add -Wno-deprecated-declarations to the iOS CMake target compile options, guarded by a Clang/AppleClang compiler check.

Files changed:

  • Modules/@babylonjs/react-native/ios/CMakeLists.txt

Feature: BABYLON_USE_SYSTEM_CMAKE environment variable

The postinstall.js script previously always tried to resolve cmake from the npm cmake-runtime package, falling back to PATH only on error. Some environments (CI, Homebrew, custom toolchains) have a preferred cmake on PATH that should take precedence.

Fix: Add BABYLON_USE_SYSTEM_CMAKE=1 env variable: when set, getCmakeExecutable() immediately returns cmake (from PATH) without attempting to resolve the npm package.

Files changed:

  • Modules/@babylonjs/react-native/postinstall.js
  • Modules/@babylonjs/react-native/README.md — documents the new variable and adds 2.0.2 row to the Platform Native Packages version table
  • Package/gulpfile.js — update BabylonNative to latest master commit (ce2edf08)

Usage

export BABYLON_USE_SYSTEM_CMAKE=1
npm install

CedricGuillemet and others added 3 commits April 14, 2026 18:43
wstring_convert<codecvt_utf8_utf16> is deprecated in C++17 and the
BabylonNative cmakeextensions build helper adds -Werror to all Clang
targets, turning this deprecation into a hard build error on
Xcode 26+ / Clang 20+.

Add -Wno-deprecated-declarations via add_compile_options for Clang/
AppleClang builds so the project compiles cleanly while all other
-Werror checks remain enforced.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- postinstall.js: add BABYLON_USE_SYSTEM_CMAKE=1 env variable that
  bypasses the npm-bundled cmake-runtime package and uses whatever
  cmake is found on PATH (Homebrew, system install, etc.)
- README: document the new BABYLON_USE_SYSTEM_CMAKE variable in the
  iOS CMake configuration section
- README: add BabylonReactNative 2.0.2 entry to the Platform Native
  Packages version table (requires Babylon.js 9.0.0, BabylonNative 887a044)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Package/gulpfile.js: update COMMIT_ID to latest BabylonNative master
  commit ce2edf0851e0c8483559832a4f8eb9d39c6b2f53
- README.md: use full 40-character commit hash for the 2.0.2 row to
  match the format of existing rows in the Platform Native Packages table

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 14, 2026 16:47
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 BabylonReactNative’s build tooling to (1) avoid Xcode 26 / Clang 20 build failures caused by deprecated C++17 APIs being treated as errors, and (2) allow opting into a PATH-provided CMake instead of the cmake-runtime bundled CMake, while also bumping the pinned BabylonNative commit used by the packaging workflow.

Changes:

  • Add an iOS CMake compile option to suppress -Wdeprecated-declarations under (Apple)Clang.
  • Add BABYLON_USE_SYSTEM_CMAKE=1 support in postinstall.js and document it in the module README.
  • Update the BabylonNative pinned commit hash used by Package/gulpfile.js and reflect it in the README version table.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
Package/gulpfile.js Updates the pinned BabylonNative commit hash used when assembling/packaging.
Modules/@babylonjs/react-native/postinstall.js Adds an env var escape hatch to prefer system/PATH cmake over cmake-runtime.
Modules/@babylonjs/react-native/ios/CMakeLists.txt Suppresses deprecated-declarations warnings-as-errors for (Apple)Clang toolchains.
Modules/@babylonjs/react-native/README.md Documents BABYLON_USE_SYSTEM_CMAKE and adds a 2.0.2 row mapping to the new commit.

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

Comment thread Modules/@babylonjs/react-native/ios/CMakeLists.txt
@CedricGuillemet CedricGuillemet merged commit 9542c30 into BabylonJS:master Apr 15, 2026
12 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.

3 participants