Emit Apple .framework from the skiasharp_build GN target#256
Open
mattleibow wants to merge 1 commit into
Open
Conversation
3b70149 to
924f2d6
Compare
Make the GN/ninja build produce the complete, App-Store-safe Apple native
artifacts directly, so SkiaSharp can drop its hand-maintained Xcode projects
for libSkiaSharp/libHarfBuzzSharp and build Apple the same way as every other
GN platform.
Changes (build-system only; does not move src/c, which stays in :core and
already reaches libSkiaSharp via :skia):
- gn/skia/BUILD.gn: drop the invalid "-Wl,{ios,tvos,macosx}_version_min"
ldflags (modern ld treats them as input files) and supply the deployment
target to the linker via "-target" for iOS/tvOS device links. These link
paths are only exercised now that GN links the dylib directly.
- BUILD.gn: set the framework-relative -install_name at link time on the
SkiaSharp/HarfBuzzSharp targets for iOS/tvOS/MacCatalyst (gated on is_ios,
versioned layout when is_maccatalyst).
- gn/toolchain/BUILD.gn: place $rpath before {{ldflags}} in the solink command
so a target's own -install_name wins (last-flag-wins); position-insensitive
for non-overriding targets.
- gn/BUILDCONFIG.gn: make skiasharp_build emit a ready-to-use
lib<Name>.framework (bundle layout, arm64e-thinned binary, provenance-complete
Info.plist) via a GN action whenever is_ios, using the macOS-style versioned
Versions/A layout when is_maccatalyst. No extra GN args are needed: the
framework shape is derived entirely from the OS.
- gn/skiasharp/assemble_apple_framework.py: a single self-contained Python GN
action that wraps the linked dylib into the .framework using first-party
Apple CLI tools only (lipo/xcrun/xcodebuild/sw_vers) and plistlib.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
924f2d6 to
f545a93
Compare
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
Make the GN
skiasharp_buildtargets emit a complete Apple.frameworkdirectly, so SkiaSharp can build libSkiaSharp and libHarfBuzzSharp for iOS/tvOS/MacCatalyst (and a plain.dylibfor macOS) from GN/ninja — without the hand-maintained Xcode projects.This is the submodule half of the Apple GN migration. It is derived cleanly off the
skiasharpbranch (no dependency on the C-API-move work) so it can land independently.Changes
gn/skia/BUILD.gn— drop the invalid-Wl,{ios,tvos,macosx}_version_minldflags (not real linker flags); add-targetfor iOS/tvOS device links.BUILD.gn— set the framework install_name at link time (-Wl,-install_name,@rpath/lib<N>.framework/...) on bothskiasharp_buildtargets, gated onskiasharp_apple_framework.gn/toolchain/BUILD.gn— reorder$rpathbefore{{ldflags}}in the solink command so the link-time install_name takes effect.gn/BUILDCONFIG.gn— adddeclare_args(skiasharp_apple_framework,skiasharp_apple_framework_versioned) and extend theskiasharp_buildtemplate to assemble the.frameworkbundle via a GNactionwhen framework mode is on.gn/skiasharp/assemble_apple_framework.{py,sh}(new) — assemble a single-arch, provenance-complete framework (bundle layout, arm64e thinning,Info.plistwith the CFBundle*/DT*/BuildMachineOSBuild keys the App Store and notarization require) using the Apple CLI tools.Verification
Built libSkiaSharp + libHarfBuzzSharp from source for macOS, iOS (+sim), tvOS (+sim) and Mac Catalyst via the SkiaSharp parent PR. Verified against the released 3.119.0 baseline: symbol counts (887
sk_/gr_, 560hb_), fat archs, framework-relative install_name (/Versions/A/for Catalyst), valid codesign, andInfo.plistkey parity. iOS simulator and Mac Catalyst test suites pass 5548/0.