Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5a8380c642d16ec8cc8d08de37aea2d62747cebe
https://github.com/WebKit/WebKit/commit/5a8380c642d16ec8cc8d08de37aea2d62747cebe
Author: Jean-Yves Avenard <[email protected]>
Date: 2026-09-01 (Tue, 01 Sep 2026)
Changed paths:
M CMakeLists.txt
M CMakePresets.json
M Source/JavaScriptCore/CMakeLists.txt
M Source/JavaScriptCore/PlatformCocoa.cmake
M Source/ThirdParty/ANGLE/CMakeLists.txt
M Source/WebCore/Modules/model-element/HTMLModelElement.cpp
M Source/WebCore/PlatformCocoa.cmake
M Source/WebGPU/WGSL/CMakeLists.txt
M Source/WebGPU/WebGPU/CMakeLists.txt
M Source/WebKit/Headers.cmake
M Source/WebKit/PlatformCocoa.cmake
M Source/WebKit/UIProcess/Cocoa/WKScrollGeometryAdapter.swift
M Source/WebKitLegacy/PlatformCocoa.cmake
M Source/WebKitLegacy/scripts/forward-headers-cmake.pl
M Source/cmake/OptionsCocoa.cmake
M
Source/cmake/WebKitFS.cmake
M Source/cmake/WebKitMacros.cmake
M Source/cmake/WebKitXcodeSDK.cmake
M Tools/CMakeLists.txt
M Tools/Scripts/webkitdirs.pm
M Tools/TestWebKitAPI/CMakeLists.txt
M Tools/TestWebKitAPI/PlatformCocoa.cmake
M Tools/WebKitTestRunner/CMakeLists.txt
M Tools/WebKitTestRunner/PlatformCocoa.cmake
Log Message:
-----------
Safari and Swift Browser can't be built against WebKit built with CMake
https://bugs.webkit.org/show_bug.cgi?id=322473
rdar://185760184
Reviewed by Elliott Williams.
There were a few issues preventing to build Safari against WebKit built via
cmake
as well as problems preventing it to run. Related yet, separate issues.
Building everything above WebKit against a cmake-built WebKit hit seventeen
build
failures across macOS, iOS and the platforms the cmake build had never targeted
at
all, and left four differences from the Xcode build that only showed up at
runtime.
Build failures:
1)
forward-headers-cmake.pl only rewrote `<WebKitLegacy` into `<WebKit`, so the
forwarded public header WebKit.framework/Headers/WebScriptObject.h still
imported `<WebCore/WebKitAvailability.h>` and still used bare
WEBCORE_EXPORT.
WebKitAvailability.h is a WebCore private header, and WebCore_Private covers
those with a submodule that requires C++, so importing WebKit from any plain
Objective-C file failed to build the WebKit module.
2) WebKitLegacy.framework/PrivateHeaders was empty on macOS, because only the
iOS branch staged those headers. Anything importing `<WebKitLegacy/X.h>`
failed to find it.
3) WebKit.apinotes was not installed on macOS, so Swift saw un-renamed API:
WKContentMode did not appear as WKWebpagePreferences.ContentMode, and
WKErrorCode's NSErrorDomain pairing did not synthesize WKError.
4) The WebPage Swift API was listed only in the iOS branch and macOS did not
pass -DENABLE_SWIFTUI, so those files compiled to
nothing and the SDK's
_WebKit_SwiftUI interface failed with `cannot find type 'WebKit::WebPage'`.
5) The Swift argument generator preprocessed wtf/Platform.h without an
-iframework for the SDK's PrivateFrameworks, so `__has_include` probes were
false and six HAVE_ macros the C++ compiles had never reached Swift.
6) WKScrollGeometryAdapter's macOS `contentInsets: NSEdgeInsets` lacked the
@_expose(!Cxx) its iOS UIEdgeInsets branch carries, so NSEdgeInsets reached
the C++ interop section of WebKit-Swift-Generated.h, which the plain C++
translation units of the WebKit_SwiftInterop subtarget cannot name.
7) JavaScriptCore's code generation scripts, Automation.json and its atoms were
never staged into the frameworks' PrivateHeaders, so Safari's WebDriver
derived sources had no rule to make WDProtocol.h.
8) buildCMakeProjectOrExit() compared wrapperPrefixIfNeeded() and
jhbuildWrapperPrefix() with numeric ==, and both return lists. On
Cocoa the
wrapper is "xcrun", which warned before evaluating false.
9) build-webkit named the CMake tree cmake-mac whatever the platform, appending
the
SDK to the configuration, so an iOS build resolved to a directory no CMake
build
ever created. The tree is named after the platform now, matching the
presets.
10) WebKitLegacy's iOS-family section linked SecurityInterface, which only
ships in
the macOS SDK. Its one user is a file the iOS build does not compile.
11) The iOS family adds the SDK's framework directories as global link options,
which
CMake emits ahead of a target's own, so _WebKit_SwiftUI bound to the SDK's
WebKit
stub and failed on the @_spi(CrossImportOverlay) symbols. The build
directory now
comes first.
12) The swiftc -print-target-info probe named no target, so an iOS build took
the
macOS Swift runtime directory and linked iOS binaries with -L and -rpath
pointing
at it. The probe now passes -target.
13)
HTMLModelElement.cpp default-constructs AddEventListenerOptions, whose RefPtr
<AbortSignal> destructor needs the complete type that only a forward
declaration
provided.
14) wrapperPrefixIfNeeded() prefixed cmake with a bare xcrun, which exports
SDKROOT
for the default macOS SDK, so tools taking their sysroot from the
environment
built an iOS target against macOS headers. The prefix names the selected
SDK.
15) WebKitXcodeSDK.cmake classified three SDKs and stopped with a fatal error
on the
rest, so tvOS, watchOS and visionOS could not be configured at all, though
Xcode
lists all nine in SUPPORTED_PLATFORMS. Each SDK is a row of a table now,
and the
platform booleans, triple spellings and deployment-target flag follow from
it.
16) The ios device presets did not use ninja-wrapper, which the mac and ios-sim
presets already had. Nothing it does is specific to a simulator.
17) Every Apple preset repeated the generator, port, make program
and ccache
environment, with only the SDK actually varying. Hidden cocoa and
cocoa-embedded
presets carry what they share.
Runtime failures:
1) The macOS frameworks kept CMake's default @rpath install names, so binaries
linked against them recorded @rpath/WebKit.framework/Versions/A/WebKit
rather
than the system path. dyld then loaded that WebKit next to the shared cache
copy instead of replacing it, and LinkPresentation kept its WKContentWorld
class reference pointing into a WebKit that was never loaded, aborting with
`no class for metaclass` when it sent +worldWithName:.
2) _WebKit_SwiftUI was built only for the iOS family, so clients importing both
WebKit and SwiftUI resolved the SDK's overlay against a locally built
WebKit.
3) The overlay framework had no top-level Modules symlink, so the Swift importer
could not see its module and clients compiled against the SDK's interface
while linking the local binary.
4)
WKWebView+RefreshControl.swift, WKUserContentController.swift and
WKWebsiteDataStore+SwiftOverlay.swift are in WebKit.xcodeproj but were built
by no cmake target, so WKWebView lacked the _WKRefreshControlHosting
conformance and the module lacked their members.
To compile and run SwiftBrowser from the command line you can do:
```
xcodebuild -project Tools/SwiftBrowser/SwiftBrowser.xcodeproj -scheme
SwiftBrowser -configuration Release \
SYMROOT=$PWD/WebKitBuild/cmake-mac OBJROOT=$PWD/WebKitBuild/cmake-mac \
&& run-swiftbrowser --cmake --release
```
* CMakeLists.txt:
* CMakePresets.json:
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/PlatformCocoa.cmake:
* Source/ThirdParty/ANGLE/CMakeLists.txt:
* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
* Source/WebCore/PlatformCocoa.cmake:
* Source/WebGPU/WGSL/CMakeLists.txt:
* Source/WebGPU/WebGPU/CMakeLists.txt:
* Source/WebKit/Headers.cmake:
*
Source/WebKit/PlatformCocoa.cmake:
* Source/WebKit/UIProcess/Cocoa/WKScrollGeometryAdapter.swift:
* Source/WebKitLegacy/PlatformCocoa.cmake:
* Source/WebKitLegacy/scripts/forward-headers-cmake.pl:
* Source/cmake/OptionsCocoa.cmake:
* Source/cmake/WebKitFS.cmake:
* Source/cmake/WebKitMacros.cmake:
(_webkit_generate_platform_swift_args): Preprocess Platform.h with the SDK's
private framework search path so Swift sees the same HAVE_ macros as C++.
* Source/cmake/WebKitXcodeSDK.cmake:
* Tools/CMakeLists.txt:
* Tools/Scripts/webkitdirs.pm:
(buildCMakeProjectOrExit): Compare the wrapper prefixes as lists.
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/PlatformCocoa.cmake:
* Tools/WebKitTestRunner/CMakeLists.txt:
* Tools/WebKitTestRunner/PlatformCocoa.cmake:
Canonical link:
https://flagged.apple.com:443/proxy?t2=DO6P0G9tu4&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzIwMjM3QG1haW4=&emid=4d38799d-5c66-45a7-9a3a-25461750c6b4&c=11
To unsubscribe from these
emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications