Skip to content

Fix Windows embedded source build - #754

Merged
CedricGuillemet merged 39 commits into
BabylonJS:masterfrom
CedricGuillemet:cedricguillemet-embedded-sources-build
Sep 15, 2026
Merged

CedricGuillemet merged 39 commits into
BabylonJS:masterfrom
CedricGuillemet:cedricguillemet-embedded-sources-build

Conversation

@CedricGuillemet

@CedricGuillemet CedricGuillemet commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • package Babylon Native's embedded source tree and build it from Android, iOS, and Windows consumer projects
  • make the Windows MSBuild bridge run CMake only after React Native Windows generates its C++/WinRT projections
  • pass RNW's generated projection tree to every CMake target, inherit RNW's Microsoft.Windows.CppWinRT package policy, and remove the duplicate legacy packages.config integration
  • compile the embedded Windows graph as C++20 and isolate CMake outputs by configuration, toolset, generator, and platform while keeping paths below legacy MSBuild limits
  • add blocking Windows source-tree and packaged-tarball consumer builds
  • keep the Playground controls visible and interactive above native rendering surfaces on Android and Windows, report XR startup errors, and contribute optional ARCore manifest metadata

Windows C++/WinRT compatibility

The generated React Native Windows projection tree is the single source of C++/WinRT headers for the embedded CMake build. The build fails if that tree is unavailable instead of silently falling back to a potentially different Windows SDK projection version. This keeps BRN aligned with the RNW version selected by the consuming application rather than pinning BRN to one machine-specific SDK projection.

Windows consumer CI keeps C++20 scoped to BRN's embedded CMake graph and the generated test application; it does not change RNW source projects. Autolinked native modules are restored and compiled independently against the consumer-selected RNW NuGet packages, then the generated x64 application is compiled through C++/WinRT and XAML and linked as ReactTestApp.exe. AppX packaging is intentionally excluded because it requires resource artifacts from recursively built RNW source projects, which are outside the NuGet consumer graph being validated.

Validation

  • all jobs passed in PR Build run 34877434422, including the Windows source-tree consumer and packaged-tarball consumer
  • both Windows jobs compile the embedded Babylon Native sources, autolinked native modules, generated C++/WinRT/XAML application code, and link the x64 application
  • built and installed the Windows Playground package locally and visually confirmed all controls render correctly
  • built the full Android Debug app with libReactNativeBabylon.so, installed it on a physical Pixel 9a, and confirmed the native rendering surface no longer overlaps the controls
  • confirmed Android XR startup reaches the camera permission flow without the previous missing com.google.ar.core manifest failure
  • Playground regression suite passes: controls are layered above EngineView, and rejected XR startup and shutdown are surfaced to the user
  • merged the latest origin/master into the PR branch

CedricGuillemet and others added 16 commits September 9, 2026 13:34
Use the React Native Windows generated C++/WinRT projections for the CMake build and add blocking source and package CI coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The windows-latest image now uses Visual Studio 2026 and no longer contains the requested 10.0.22621 SDK. Use the runner matching the v143 CMake generator and project toolset.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use RNW's architecture-aware C++ project integration and disable Windows App SDK transitive verification for the Playground's native module build.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the RNW patch containing the corrected Windows App SDK package and skip schema codegen for BRN's hand-written native module.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Generate the Playground with explicit Fabric and NuGet settings, and protect the CMake projection path from trailing-backslash quote parsing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Build the autolinked BRN project directly, keep RNW dependencies on NuGet, and avoid executable packaging during CMake compiler probes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Pass the generated solution metadata required by RNW while building only the BRN project.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Place generated CMake projects under the consumer solution build directory so deeply nested MSBuild tracking files remain below MAX_PATH.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep CMake outputs below legacy MSBuild path limits while preserving platform, configuration, toolset, and generator isolation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Babylon Native now performs frame synchronization in the rendering-frame methods; its DeviceUpdate compatibility shim is intentionally a no-op and deprecated.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Generate the Windows test app through the react-native-test-app API so Fabric can be explicitly disabled while retaining the RNW NuGet dependency path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Compile the CMake bridge as C++20, matching React Native Windows and the embedded Babylon Native dependency graph so C++/WinRT selects the same coroutine and source-location ABI.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep controls visible and interactive above native engine surfaces, surface XR startup failures, and declare ARCore as an optional Android capability.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@CedricGuillemet
CedricGuillemet marked this pull request as ready for review September 11, 2026 07:33
Copilot AI lite review requested due to automatic review settings September 11, 2026 07:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical RNW compatibility and moderate Windows consumer-validation issues remain unresolved.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes Windows embedded-source builds by aligning CMake/MSBuild with RNW-generated C++/WinRT projections, adding CI validation, and improving Playground XR/UI behavior.

Changes:

  • Reworks Windows CMake/MSBuild integration, C++20 settings, output isolation, and legacy package cleanup.
  • Adds Windows source and packaged-consumer CI coverage.
  • Updates Playground controls, XR error handling, tests, and optional Android ARCore metadata.
File summaries
File Summary / final finding
Package/gulpfile.js Excludes generated Windows build artifacts from packages.
Modules/@babylonjs/react-native/windows/CMakeLists.txt Requires RNW projections and enables C++20.
Modules/@babylonjs/react-native/windows/BabylonReactNative/PropertySheet.props Isolates generated files by configuration.
Modules/@babylonjs/react-native/windows/BabylonReactNative/packages.config Removes legacy package integration. Nit (1 vote): .vcxproj.filters retains a stale packages.config entry.
Modules/@babylonjs/react-native/windows/BabylonReactNative/BabylonReactNative.vcxproj Updates RNW and CMake integration. Critical (2 votes): the new CppLib imports remove compatibility with documented older RNW layouts.
Modules/@babylonjs/react-native/shared/BabylonNative.cpp Removes obsolete frame-update handling.
Modules/@babylonjs/react-native/android/src/main/AndroidManifest.xml Adds optional ARCore metadata.
Apps/Playground/package-windows.json Updates the React Native Windows dependency.
Apps/Playground/package-lock-windows.json Refreshes locked Windows dependencies.
Apps/Playground/jest.config.js Adds Jest configuration.
Apps/Playground/generate-windows-test-app.mjs Generates the Windows test solution.
Apps/Playground/App.tsx Layers controls above rendering and reports XR errors. Nit (3 votes): stop failures can be reported as start failures.
Apps/Playground/__tests__/App.test.tsx Adds control-layering and XR failure tests.
.github/workflows/windows.yml Adds blocking Windows source-build CI. Moderate (2 votes): builds only the library project, not the generated Playground solution.
.github/workflows/test_windows.yml Adds packaged Windows validation. Moderate (2 votes): does not build the packaged Playground solution. Moderate (1 vote): ignores the copied lockfile and resolves dependencies afresh.
.github/workflows/pr.yml Enables Windows build and package jobs.
Review details

Suppressed comments (2)

.github/workflows/test_windows.yml:45

  • The copied package-lock-windows.json is ignored by --package-lock=false, so this packaged-consumer build resolves the package ranges afresh instead of testing the checked-in dependency graph. That makes the CI result non-reproducible and means lockfile changes are not actually validated.
          npm install --no-save --package-lock=false $package.FullName

Modules/@babylonjs/react-native/windows/BabylonReactNative/packages.config:1

  • Removing packages.config leaves BabylonReactNative.vcxproj.filters with a stale <None Include="packages.config" /> entry. The packaged project will still advertise a file that is not shipped; remove that filter entry as part of this legacy NuGet integration cleanup.
  • Files reviewed: 16/16 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/test_windows.yml Outdated
Comment thread .github/workflows/windows.yml Outdated
Comment thread Apps/Playground/App.tsx Outdated
dependabot Bot and others added 4 commits September 11, 2026 10:43
Bumps [braces](https://github.com/micromatch/braces) to 3.0.3 and updates ancestor dependency [gulp](https://github.com/gulpjs/gulp). These dependencies need to be updated together.


Updates `braces` from 2.3.2 to 3.0.3
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/commits/3.0.3)

Updates `gulp` from 4.0.2 to 5.0.1
- [Release notes](https://github.com/gulpjs/gulp/releases)
- [Changelog](https://github.com/gulpjs/gulp/blob/master/CHANGELOG.md)
- [Commits](gulpjs/gulp@v4.0.2...v5.0.1)

---
updated-dependencies:
- dependency-name: braces
  dependency-version: 3.0.3
  dependency-type: indirect
- dependency-name: gulp
  dependency-version: 5.0.1
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Preserve legacy RNW imports, validate complete Windows consumers, honor the packaged dependency lockfile, and report XR stop failures accurately.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The full RNW solution compiles coroutine-based Hermes sources that require the same C++20 standard as the native bridge.

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

@RaananW RaananW left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 This review comment was created by an AI agent.

Thanks for adding direct Windows consumer checks. Both Windows jobs fail on the current head. The solution-wide LanguageStandard=stdcpp20 setting at .github/workflows/windows.yml:48-52 and .github/workflows/test_windows.yml:63-67 also changes Microsoft.ReactNative.vcxproj. RNW then mixes std::coroutine_handle and std::experimental::coroutine_handle, so both consumer builds fail. Please keep C++20 scoped to the projects that need it and restore green Windows checks.

@RaananW
RaananW dismissed their stale review September 11, 2026 22:38

Automated monitor correction: this repository is excluded from auto-review because its name contains Native.

@RaananW RaananW left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 This review comment was created by an AI agent.

Thank you for adding direct Windows consumer checks. The current head is unchanged since the earlier review, and both Windows jobs still fail. The solution-wide LanguageStandard=stdcpp20 setting also changes Microsoft.ReactNative.vcxproj, which mixes standard and experimental coroutine types. Please keep C++20 scoped to the projects that need it and restore green Windows checks.

@RaananW
RaananW dismissed their stale review September 14, 2026 08:41

This review was submitted by the automated monitor in error. BabylonReactNative is excluded from automatic reviews by the repository-name rule.

CedricGuillemet and others added 17 commits September 14, 2026 12:34
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore and build each autolinked project independently so MSBuild cannot traverse into React Native Windows source projects.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Import the generated consumer setting before each C++ project evaluates its RNW references, ensuring native modules consume the matching NuGet projections and binaries.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Set the RNW NuGet properties in the MSBuild process environment and assert each native project evaluates the expected mode before restore and build.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Pass UseExperimentalNuget directly to every MSBuild root and reject projects that still evaluate an RNW source reference before restore.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace resolved Microsoft.ReactNative WinMD inputs with the consumer-selected NuGet package path before C++/WinRT generates MIDL references.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove stale Microsoft.ReactNative metadata from every C++/WinRT reference collection immediately before generating MIDL inputs.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CedricGuillemet and others added 2 commits September 14, 2026 19:32
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@CedricGuillemet
CedricGuillemet merged commit 0a13e15 into BabylonJS:master Sep 15, 2026
10 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