Skip to content

Use a coherent system SDK for Apple builds - #1783

Open
matthargett wants to merge 1 commit into
BabylonJS:masterfrom
rebeckerspecialties:apple-sdk-build-consistency
Open

matthargett wants to merge 1 commit into
BabylonJS:masterfrom
rebeckerspecialties:apple-sdk-build-consistency

Conversation

@matthargett

@matthargett matthargett commented Jul 21, 2026

Copy link
Copy Markdown

Summary

  • default top-level macOS builds to the selected Xcode macosx SDK when no toolchain or sysroot was supplied
  • classify JavaScriptCore framework headers as system headers for napi and its consumers
  • normalize both JavaScriptCore framework-bundle and framework-binary paths
  • preserve explicit toolchains, explicit sysroots, and Apple mobile configurations

Why

An empty macOS sysroot can mix Command Line Tools headers with frameworks from the selected Xcode installation. Diagnostics from that mixed SDK surface become errors under JsRuntimeHost warnings-as-errors builds.

Using one SDK for headers and frameworks fixes the mismatch. Marking the JavaScriptCore framework directory as a system framework keeps SDK implementation diagnostics out of project warning policy without suppressing warnings in BabylonNative or JsRuntimeHost sources.

Validation

  • rebased onto current BabylonNative master
  • fresh RelWithDebInfo/Ninja configure with JavaScriptCore
  • built napi and AppRuntime
  • verified compile commands use the same selected SDK for -isysroot and -iframework
  • tested both .../JavaScriptCore.framework and .../JavaScriptCore.framework/JavaScriptCore discovery forms under a framework directory containing spaces
  • git diff --check

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 aims to make Apple/macOS builds use a consistent Xcode SDK sysroot (avoiding mixed Command Line Tools + Xcode SDK headers/frameworks) and to treat JavaScriptCore framework headers as system headers when building napi with the JavaScriptCore engine, preventing SDK diagnostics from being promoted to errors under warnings-as-errors builds.

Changes:

  • Default top-level macOS builds (when not using an explicit toolchain/sysroot and not targeting iOS/visionOS) to CMAKE_OSX_SYSROOT=macosx.
  • Add -iframework propagation on Apple JavaScriptCore builds so JavaScriptCore framework headers are treated as system headers for napi and its consumers.

Reviewed changes

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

File Description
CMakeLists.txt Defaults top-level macOS builds to the selected Xcode macosx SDK when no sysroot/toolchain is explicitly provided.
Dependencies/CMakeLists.txt Adds compiler flags to classify JavaScriptCore framework headers as system headers for napi consumers on Apple builds.

Comment thread Dependencies/CMakeLists.txt
RaananW

This comment was marked as off-topic.

Default top-level macOS builds to the selected Xcode SDK instead of allowing Command Line Tools headers to mix with Xcode frameworks. Mark the JavaScriptCore framework search path as a system framework through napi so JsRuntimeHost's pedantic warnings-as-errors policy ignores SDK implementation diagnostics without suppressing project warnings.\n\nThis fixes Xcode 26.5 nullability, invalid UTF-8, and related framework-header failures while leaving explicit cross-compilation toolchains and Apple mobile platforms unchanged.
@matthargett
matthargett force-pushed the apple-sdk-build-consistency branch from d4ee79f to 124fe09 Compare September 17, 2026 04:46
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