Fix Xcode 26 build: suppress deprecated-declarations + BABYLON_USE_SYSTEM_CMAKE env var#726
Merged
CedricGuillemet merged 3 commits intoBabylonJS:masterfrom Apr 15, 2026
Conversation
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>
There was a problem hiding this comment.
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-declarationsunder (Apple)Clang. - Add
BABYLON_USE_SYSTEM_CMAKE=1support inpostinstall.jsand document it in the module README. - Update the BabylonNative pinned commit hash used by
Package/gulpfile.jsand 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.
bkaradzic-microsoft
approved these changes
Apr 14, 2026
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.
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-declarationsbuild failureXcode 26 / Clang 20 promotes
wstring_convert<std::codecvt_utf8_utf16<char16_t>>deprecation warnings to hard errors under-Werror(set by BabylonNative’swarnings_as_errors()incmakeextensions). The#pragma GCC diagnostic ignoredsuppression innapi-inl.his not sufficient in this context.Fix: Add
-Wno-deprecated-declarationsto the iOS CMake target compile options, guarded by a Clang/AppleClang compiler check.Files changed:
Modules/@babylonjs/react-native/ios/CMakeLists.txtFeature:
BABYLON_USE_SYSTEM_CMAKEenvironment variableThe
postinstall.jsscript previously always tried to resolvecmakefrom the npmcmake-runtimepackage, falling back to PATH only on error. Some environments (CI, Homebrew, custom toolchains) have a preferredcmakeon PATH that should take precedence.Fix: Add
BABYLON_USE_SYSTEM_CMAKE=1env variable: when set,getCmakeExecutable()immediately returnscmake(from PATH) without attempting to resolve the npm package.Files changed:
Modules/@babylonjs/react-native/postinstall.jsModules/@babylonjs/react-native/README.md— documents the new variable and adds 2.0.2 row to the Platform Native Packages version tablePackage/gulpfile.js— update BabylonNative to latest master commit (ce2edf08)Usage
export BABYLON_USE_SYSTEM_CMAKE=1 npm install