Compile C API (src/c) in libSkiaSharp instead of upstream :core#4131
Compile C API (src/c) in libSkiaSharp instead of upstream :core#4131mattleibow wants to merge 4 commits into
Conversation
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4131PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4131"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4131/packages --name skiasharp-pr-4131More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4131 |
|
📖 Documentation Preview The documentation for this PR has been deployed and is available at: 🔗 View Staging Site This preview will be updated automatically when you push new commits to this PR. This comment is automatically updated by the documentation staging workflow. |
d8ec327 to
c494443
Compare
There was a problem hiding this comment.
Pull request overview
This PR aligns the non-GN native build systems (Apple Xcode projects and Tizen makefile) with the upstream GN-graph change that moves SkiaSharp’s fork-owned C API shim (externals/skia/src/c/*.cpp) into the libSkiaSharp target, instead of relying on those sources being compiled via Skia’s upstream :core target.
Changes:
- Adds
externals/skia/src/c/*.cppfiles to thelibSkiaSharpXcode project sources for macOS, iOS (and thus Mac Catalyst via reuse), and tvOS. - Adds
-Werror=deprecated-declarationsviaOTHER_CFLAGSto all Xcode build configurations so deprecation enforcement matches GN/Tizen behavior. - Adds the same
src/c/*.cpplist to Tizen’sUSER_SRCSso the non-GN Tizen build compiles the shim directly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| native/macos/libSkiaSharp/libSkiaSharp.xcodeproj/project.pbxproj | Adds src/c shim sources to the macOS Xcode build and enforces deprecated-declarations as errors. |
| native/ios/libSkiaSharp/libSkiaSharp.xcodeproj/project.pbxproj | Adds src/c shim sources to the iOS (and Mac Catalyst via reuse) Xcode build and enforces deprecated-declarations as errors. |
| native/tvos/libSkiaSharp/libSkiaSharp.xcodeproj/project.pbxproj | Adds src/c shim sources to the tvOS Xcode build and enforces deprecated-declarations as errors. |
| native/tizen/libSkiaSharp/project_def.prop | Adds src/c shim sources to the Tizen makefile’s USER_SRCS list. |
Follow-up to the mono/skia change that moves the fork-owned C API shim
(src/c/*.cpp) out of upstream Skia's :core target and into the libSkiaSharp
build, decoupling it from :core's milestone-churning transitive dependencies
(which silently dropped SK_FONTMGR_FONTCONFIG_AVAILABLE on Linux in m148).
On platforms built via the GN skiasharp_build("SkiaSharp") target (Android,
Linux, Windows, WASM) the move is handled entirely in the submodule. But the
Apple platforms (macOS, iOS, tvOS) and Tizen build libSkiaSharp from a project
file that compiles the managed-interop glue and links the GN-built libskia.a;
they relied on src/c being inside :core. Add the src/c/*.cpp sources to:
- native/{macos,ios,tvos}/libSkiaSharp/libSkiaSharp.xcodeproj
- native/tizen/libSkiaSharp/project_def.prop
so every platform compiles the C API into libSkiaSharp itself, consistent with
how the src/xamarin glue is already handled. These projects already link
-lskottie/-lsksg/-lskresources/-ljsonreader, so no extra linkage is needed.
Validated: macOS arm64 (real dylib, full test suite passes) and Linux x64
(real .so with libfontconfig.so.1 dependency and 44 Fc* imports — the m148
regression guard).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The macOS/iOS/tvOS libSkiaSharp targets build via xcodebuild (pbxproj), not GN, so the GN-side deprecation guardrail does not cover them. They compiled the deprecated SkPathOps TightBounds() with only a warning. Add OTHER_CFLAGS = -Werror=deprecated-declarations to every build configuration in the three Apple xcodeprojs so deprecated Skia API usage fails the build on Apple platforms too, matching the GN (:skiasharp_strict) and Tizen (-Werror) builds. These targets compile only our src/c + src/xamarin shim (upstream Skia is linked as a prebuilt static lib), so the scope is exactly our own sources. Bumps externals/skia to pick up the TightBounds fix + GN warnings guardrail. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f878b64 to
9a9e700
Compare
Summary
Parent-repo side of the change that compiles SkiaSharp's fork-owned C API shim (
externals/skia/src/c/*.cpp) in thelibSkiaSharptarget on every platform, instead of injecting it into upstream Skia's:coreGN target.externals/skiato it).See mono/skia#251 for the full motivation (the m148
:fontmgr_fontconfig/SK_FONTMGR_FONTCONFIG_AVAILABLEregression that this architecturally fixes).Why the non-GN builds need separate changes
libSkiaSharpis produced by three independent build systems:src/c?externals/skia/BUILD.gn)skiasharp_build("SkiaSharp")(mono/skia#251)*.xcodeproj)project.pbxprojSourcesproject_def.prop)USER_SRCSThe Apple/Tizen builds compile our shim directly and link a prebuilt
libskia.a, so the GN source-list move doesn't propagate to them automatically — they each carry their own copy of the list.Changes
externals/skiasubmodulesrc/cmoved intolibSkiaSharp; the two dead:coreworkarounds removed; deprecated-SkPathOpsusages insk_path.cppfixed; GN warnings/deprecation guardrail added; C API public header list completed.Apple xcodeprojs —
native/{macos,ios,tvos}/libSkiaSharp/libSkiaSharp.xcodeproj/project.pbxprojsrc/c/*.cppsources to each project's Sources build phase (previously they came from:coreindirectly; now they're explicit, matching the GN move). Covers macOS, iOS, tvOS, and Mac Catalyst (which reuses the ios project vianative/maccatalyst/build.cake).OTHER_CFLAGS = -Werror=deprecated-declarationsto all four build configurations in each of the three projects. These targets build viaxcodebuild(not GN), so the GN-side guardrail doesn't apply — without this, deprecated-API usage only warned and the build still succeeded. They compile only oursrc/c+src/xamarinshim (upstream Skia is a prebuilt static lib), so the scope is exactly our own sources.Tizen —
native/tizen/libSkiaSharp/project_def.propsrc/c/*.cppsources toUSER_SRCS. (Tizen's makefile already builds with-Wall -Wextra -Werror, which is what first caught the deprecatedTightBoundsusage.)Deprecation enforcement is now consistent everywhere
:skiasharp_strictconfig →-Werror=deprecated-declarations(mono/skia#251)OTHER_CFLAGS = -Werror=deprecated-declarations(this PR)-WerrorValidation
TightBoundscall restored,dotnet cake --target=externals-macosfails (exit 65) witherror: 'TightBounds' is deprecated [-Werror,-Wdeprecated-declarations]; with the fix it builds clean.Merge order
Merge mono/skia#251 first, then this PR will point at the merged submodule SHA.