Skip to content

Add Tizen x64 and arm64 native build support#3607

Closed
mattleibow wants to merge 2 commits into
mainfrom
dev/tizen-x64-arm64-native-support
Closed

Add Tizen x64 and arm64 native build support#3607
mattleibow wants to merge 2 commits into
mainfrom
dev/tizen-x64-arm64-native-support

Conversation

@mattleibow

@mattleibow mattleibow commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Add 64-bit (x86_64, aarch64) native library builds for Tizen alongside existing 32-bit (arm, x86) builds. Upgrade Tizen Studio from 5.6 to 6.1 to get the required toolchains and rootstraps.

What changed

Build infrastructure:

  • Upgrade Tizen Studio to 6.1 (from 5.6)
  • Install both MOBILE-6.0-NativeAppDevelopment (32-bit) and TIZEN-8.0-NativeAppDevelopment (64-bit)
  • Add TFMMinimum=net6.0 to SkiaSharp.Build.props for platforms where device runtime lags behind SDK

Native build — refactored with helper functions (iOS pattern):

Arch RID Rootstrap Profile
ARM 32 tizen-armel mobile-6.0-device.core mobile-6.0
x86 32 tizen-x86 mobile-6.0-emulator.core mobile-6.0
x64 tizen-x64 tizen-8.0-emulator64.core tizen-8.0
ARM64 tizen-arm64 tizen-8.0-device64.core tizen-8.0

RIDs match Samsung's official RuntimeIdentifierGraph.json. The project_def.prop profile is set dynamically per architecture since tizen build-native has no --profile CLI flag.

Packaging:

  • Add tizen-x64 and tizen-arm64 entries to IncludeNativeAssets targets and NativeAssets.Tizen csprojs
  • Fix x86 RID from linux-x86 to tizen-x86

Binding:

  • Add #if NET7_0_OR_GREATER guard for LibraryImport in GRGlInterface.cs (net6.0 uses DllImport fallback)

CI Verification

Build 156464 on xamarin/public:

  • Windows Tizen: succeeded (~79 min)
  • macOS Tizen: succeeded (~120 min)

Files changed (10)

  • source/SkiaSharp.Build.props — TFMMinimum, TPVTizenMinimum
  • source/SkiaSharp.Build.Override.in.props — TFMMinimum comment
  • externals/skia — GN BUILDCONFIG x64/arm64 branches
  • native/tizen/build.cake — Refactored with helper functions, 4 architectures
  • scripts/install-tizen.ps1 — Studio 6.1, both package sets, clean existing dir
  • binding/IncludeNativeAssets.SkiaSharp.targets — tizen-x64, tizen-arm64 RIDs
  • binding/IncludeNativeAssets.HarfBuzzSharp.targets — same
  • binding/SkiaSharp.NativeAssets.Tizen/*.csproj — x64/arm64 PackageFile entries
  • binding/HarfBuzzSharp.NativeAssets.Tizen/*.csproj — same
  • binding/SkiaSharp/GRGlInterface.cs — NET7_0_OR_GREATER guard

@mattleibow
mattleibow force-pushed the dev/tizen-x64-arm64-native-support branch 3 times, most recently from 0e22619 to 93d059c Compare March 29, 2026 17:38
@mattleibow
mattleibow force-pushed the dev/tizen-x64-arm64-native-support branch from 93d059c to 09cd7f3 Compare March 29, 2026 19:18
Build system:
- Add TFMMinimum=net6.0 for platforms where device runtime lags behind SDK
- Add TPVTizenMinimum=8.0 and PlatformTargetFrameworksMinimum block
- Update Tizen Studio to 6.1 with MOBILE-6.0 + TIZEN-8.0 native dev

Native build:
- Refactor build.cake with helper functions (GetTizenProfile, GetTizenRootstrap,
  GetTizenArch, GetTizenOutputDir) following the iOS pattern
- Dynamically set project_def.prop profile per architecture (mobile-6.0 for
  32-bit, tizen-8.0 for 64-bit) since tizen build-native has no --profile flag
- Clean build output between arch builds to avoid stale artifacts
- Add x64/arm64 to Skia GN BUILDCONFIG with tizen-8.0 rootstrap paths

Packaging:
- Add tizen-x64 and tizen-arm64 RIDs (from Samsung RuntimeIdentifierGraph)
- Fix x86 RID from linux-x86 to tizen-x86

Binding:
- Add #if NET7_0_OR_GREATER guard for LibraryImport in GRGlInterface.cs

Verified: Windows and macOS CI Tizen builds pass (build 156464).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow
mattleibow force-pushed the dev/tizen-x64-arm64-native-support branch from 09cd7f3 to 3ddddef Compare March 29, 2026 19:19
@mattleibow
mattleibow requested a review from Copilot March 29, 2026 21:04

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

Adds 64-bit native build and packaging support for Tizen (x64/arm64) alongside existing 32-bit builds, including build-system tweaks to support Tizen’s on-device .NET/runtime constraints and updated Tizen Studio tooling.

Changes:

  • Introduces TFMMinimum/TPVTizenMinimum to enable building a net6.0 Tizen TFM where device runtimes lag behind current SDK TFMs.
  • Refactors Tizen native build Cake script to build 4 architectures (armel, i586, x86_64, aarch64) and switches Tizen installation to Studio 6.1 with both 32/64-bit package sets.
  • Updates NuGet packaging and app-include targets to add tizen-x64/tizen-arm64 and fixes the x86 RID mapping (linux-x86tizen-x86); adds a net6-friendly DllImport fallback for Tizen Evas GL loading.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
source/SkiaSharp.Build.props Adds minimum TFM/TPV support and includes net6.0 Tizen TFMs when enabled.
source/SkiaSharp.Build.Override.in.props Documents overriding TFMMinimum locally.
scripts/install-tizen.ps1 Updates installer to Tizen Studio 6.1 and installs both 32/64-bit package sets.
native/tizen/build.cake Refactors Tizen builds with helper function and adds x64/arm64 builds.
binding/SkiaSharp/GRGlInterface.cs Uses DllImport on net6 and LibraryImport on net7+ for Tizen Evas GL P/Invokes.
binding/IncludeNativeAssets.SkiaSharp.targets Updates Tizen RID paths and adds tizen-x64/tizen-arm64 TPK inclusions.
binding/IncludeNativeAssets.HarfBuzzSharp.targets Same as above for HarfBuzzSharp.
binding/SkiaSharp.NativeAssets.Tizen/SkiaSharp.NativeAssets.Tizen.csproj Adds net6 Tizen TFM and packages x64/arm64 native libs.
binding/HarfBuzzSharp.NativeAssets.Tizen/HarfBuzzSharp.NativeAssets.Tizen.csproj Adds net6 Tizen TFM and packages x64/arm64 native libs.

Comment thread scripts/install-tizen.ps1 Outdated
Comment on lines +49 to +53
# clean up any previous install (the 6.1 installer fails if the directory already exists)
if (Test-Path "$ts") {
Write-Host "Removing previous installation at '$ts'..."
Remove-Item -Path "$ts" -Recurse -Force
}

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

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

The script unconditionally deletes the existing $ts directory. If -InstallDestination is set incorrectly (or points somewhere shared), this can delete arbitrary paths recursively. Add a safety guard (e.g., only auto-delete when using the default $HOME_DIR\tizen-studio, or require an explicit -ForceReinstall flag / path sanity check) before calling Remove-Item -Recurse -Force.

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +68
<TizenTpkFiles Include="$(MSBuildThisFileDirectory)..\output\native\tizen\x86_64\libSkiaSharp.so" Condition="Exists('$(MSBuildThisFileDirectory)..\output\native\tizen\x86_64\libSkiaSharp.so')">
<Visible>false</Visible>
<TizenTpkSubDir>bin\runtimes\tizen-x64\native\</TizenTpkSubDir>
<TizenTpkFileName>libSkiaSharp.so</TizenTpkFileName>
</TizenTpkFiles>
<TizenTpkFiles Include="$(MSBuildThisFileDirectory)..\output\native\tizen\aarch64\libSkiaSharp.so" Condition="Exists('$(MSBuildThisFileDirectory)..\output\native\tizen\aarch64\libSkiaSharp.so')">
<Visible>false</Visible>
<TizenTpkSubDir>bin\runtimes\tizen-arm64\native\</TizenTpkSubDir>
<TizenTpkFileName>libSkiaSharp.so</TizenTpkFileName>
</TizenTpkFiles>

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

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

The new tizen-x64/tizen-arm64 entries are gated on Exists(...), so a Tizen app build can succeed while silently omitting the required native library for those architectures (leading to runtime load failures). Prefer conditioning these items on the active $(RuntimeIdentifier) (e.g., include x86_64 only for tizen-x64, aarch64 only for tizen-arm64) and/or failing the build if the expected file is missing, rather than skipping the item entirely.

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +68
<TizenTpkFiles Include="$(MSBuildThisFileDirectory)..\output\native\tizen\x86_64\libHarfBuzzSharp.so" Condition="Exists('$(MSBuildThisFileDirectory)..\output\native\tizen\x86_64\libHarfBuzzSharp.so')">
<Visible>false</Visible>
<TizenTpkSubDir>bin\runtimes\tizen-x64\native\</TizenTpkSubDir>
<TizenTpkFileName>libHarfBuzzSharp.so</TizenTpkFileName>
</TizenTpkFiles>
<TizenTpkFiles Include="$(MSBuildThisFileDirectory)..\output\native\tizen\aarch64\libHarfBuzzSharp.so" Condition="Exists('$(MSBuildThisFileDirectory)..\output\native\tizen\aarch64\libHarfBuzzSharp.so')">
<Visible>false</Visible>
<TizenTpkSubDir>bin\runtimes\tizen-arm64\native\</TizenTpkSubDir>
<TizenTpkFileName>libHarfBuzzSharp.so</TizenTpkFileName>
</TizenTpkFiles>

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

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

The new tizen-x64/tizen-arm64 entries are gated on Exists(...), so a Tizen app build can succeed while silently omitting the required native library for those architectures (leading to runtime load failures). Prefer conditioning these items on the active $(RuntimeIdentifier) (e.g., include x86_64 only for tizen-x64, aarch64 only for tizen-arm64) and/or failing the build if the expected file is missing, rather than skipping the item entirely.

Copilot uses AI. Check for mistakes.
Comment thread native/tizen/build.cake Outdated
Comment on lines +16 to +20
var propContent = System.IO.File.ReadAllText(propFile);
propContent = System.Text.RegularExpressions.Regex.Replace(
propContent, @"^profile = .+$", $"profile = {profile}",
System.Text.RegularExpressions.RegexOptions.Multiline);
System.IO.File.WriteAllText(propFile, propContent);

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

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

SetProjectProfile rewrites project_def.prop in-place but doesn’t verify that the profile = ... line was actually found/replaced. If the file format ever changes (or the line is missing), the build will silently keep the old profile and produce the wrong binaries. Consider checking for a successful match (and failing fast if not), and restoring the original file content after each build (try/finally) to avoid leaving the working tree dirty when running the Cake script locally.

Copilot uses AI. Check for mistakes.
@mattleibow
mattleibow force-pushed the dev/tizen-x64-arm64-native-support branch from 8e8f748 to b5d3c40 Compare March 30, 2026 14:21
- install-tizen.ps1: Add -Force flag; require it when using custom InstallDestination
- azure-templates-jobs-bootstrapper.yml: Pass -Force on CI
- build.cake: SetProjectProfile fails fast if profile line not found
- IncludeNativeAssets targets: Remove Exists() guards on x64/arm64 entries for consistency with other platforms

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow
mattleibow force-pushed the dev/tizen-x64-arm64-native-support branch from b5d3c40 to f2a8ef9 Compare March 30, 2026 14:28
mattleibow added a commit that referenced this pull request Mar 31, 2026
Tizen build infrastructure (from PR #3607, without submodule bump):
- Upgrade Tizen Studio from 5.6 to 6.1 in install-tizen.ps1
- Install both MOBILE-6.0 and TIZEN-8.0 NativeAppDevelopment packages
- Add TFMMinimum=net6.0 and TPVTizenMinimum to SkiaSharp.Build.props
- Refactor native/tizen/build.cake with helper functions for 4 archs
- Add x64/arm64 entries to IncludeNativeAssets targets (with Exists guards)
- Add x64/arm64 PackageFile entries to NativeAssets.Tizen csproj files
- Add NET7_0_OR_GREATER guard for LibraryImport in GRGlInterface.cs
- Add Tizen native build tasks to build.cake

Tizen sample (3-page TabView):
- App.cs — Thin shell with NUI TabView and back-key handler
- CpuPage.cs — Software-rendered gradient, circles, text with FPS counter
- GpuPage.cs — Animated SkSL lava lamp shader with touch and FPS counter
- DrawingPage.cs — Freehand touch drawing with 6-color palette and clear
- FpsCounter.cs — Shared FPS counter utility (same as other platform samples)
- SamplePage.cs — Page enum (Cpu, Gpu, Drawing)
- Update tizen-manifest.xml api-version to 10 for net10.0-tizen

Note: x64/arm64 native compilation requires the skia submodule GN config
update (deferred to avoid conflicts with upcoming Skia bump).

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

Copy link
Copy Markdown
Contributor Author

Superseded by #3619 (Tizen Studio 6.1 + TFM + sample) and #3620 (x64/arm64 native builds). Split into two PRs to allow merging independently of the Skia submodule bump.

@mattleibow mattleibow closed this Mar 31, 2026
mattleibow added a commit that referenced this pull request Mar 31, 2026
* Update Tizen support: Studio 6.1, TFM fixes, and 3-tab sample

Tizen build infrastructure (from PR #3607, without submodule bump):
- Upgrade Tizen Studio from 5.6 to 6.1 in install-tizen.ps1
- Install both MOBILE-6.0 and TIZEN-8.0 NativeAppDevelopment packages
- Add TFMMinimum=net6.0 and TPVTizenMinimum to SkiaSharp.Build.props
- Refactor native/tizen/build.cake with helper functions for 4 archs
- Add x64/arm64 entries to IncludeNativeAssets targets (with Exists guards)
- Add x64/arm64 PackageFile entries to NativeAssets.Tizen csproj files
- Add NET7_0_OR_GREATER guard for LibraryImport in GRGlInterface.cs
- Add Tizen native build tasks to build.cake

Tizen sample (3-page TabView):
- App.cs — Thin shell with NUI TabView and back-key handler
- CpuPage.cs — Software-rendered gradient, circles, text with FPS counter
- GpuPage.cs — Animated SkSL lava lamp shader with touch and FPS counter
- DrawingPage.cs — Freehand touch drawing with 6-color palette and clear
- FpsCounter.cs — Shared FPS counter utility (same as other platform samples)
- SamplePage.cs — Page enum (Cpu, Gpu, Drawing)
- Update tizen-manifest.xml api-version to 10 for net10.0-tizen

Note: x64/arm64 native compilation requires the skia submodule GN config
update (deferred to avoid conflicts with upcoming Skia bump).

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

* Remove x64/arm64 native asset references (deferred to next PR)

Remove tizen-x64 and tizen-arm64 entries from IncludeNativeAssets
targets and NativeAssets.Tizen csproj files. These require the skia
submodule GN config update and will be added back with the x64/arm64
native build support PR.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants