Rename package to StaticLink.Avalonia
This commit is contained in:
1 parent
f685b52496
commit
aa0118a4e3
12 files changed
+266
-412
No files matched your search
@@ -93,7 +93,7 @@ jobs:
|
||||
|
||||
- name: Pack experimental NuGet package
|
||||
run: |
|
||||
dotnet pack NuGet/StaticGraphics/Shiroka.Avalonia.StaticLink.csproj \
|
||||
dotnet pack NuGet/StaticGraphics/StaticLink.Avalonia.csproj \
|
||||
-c Release \
|
||||
-o artifacts/nuget \
|
||||
/p:PackageVersion=${{ steps.version.outputs.package_version }} \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: nuget-static-graphics
|
||||
name: staticlink-avalonia
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -15,7 +15,7 @@ on:
|
||||
type: boolean
|
||||
push:
|
||||
tags:
|
||||
- "static-graphics-v*"
|
||||
- "staticlink-avalonia-v*"
|
||||
|
||||
env:
|
||||
SKIASHARP_VERSION: "3.119.2"
|
||||
@@ -121,24 +121,35 @@ jobs:
|
||||
include:
|
||||
- rid: osx-x64
|
||||
target_cpu: x64
|
||||
runner: macos-14
|
||||
- rid: osx-arm64
|
||||
target_cpu: arm64
|
||||
runs-on: macos-latest
|
||||
runner: macos-latest
|
||||
runs-on: ${{ matrix.runner }}
|
||||
env:
|
||||
RID: ${{ matrix.rid }}
|
||||
TARGET_CPU: ${{ matrix.target_cpu }}
|
||||
WORK_DIR: ${{ github.workspace }}/External/NativeStatic/.work
|
||||
OUTPUT_DIR: ${{ github.workspace }}/External/NativeStatic/${{ matrix.rid }}/native
|
||||
AVALONIA_VERSION: 11.3.14
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET for Avalonia header generation
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "8.0.x"
|
||||
|
||||
- name: Install native build dependencies
|
||||
run: brew install ninja
|
||||
|
||||
- name: Build static AvaloniaNative
|
||||
run: bash ./scripts/build-macos-avalonia-native-static.sh
|
||||
|
||||
- name: Build macOS static graphics libraries
|
||||
env:
|
||||
RID: ${{ matrix.rid }}
|
||||
TARGET_CPU: ${{ matrix.target_cpu }}
|
||||
run: scripts/build-macos-static-graphics.sh all
|
||||
run: bash ./scripts/build-macos-static-graphics.sh all
|
||||
|
||||
- name: Build macOS font preinit object
|
||||
env:
|
||||
RID: ${{ matrix.rid }}
|
||||
run: bash scripts/build-macos-font-preinit.sh
|
||||
|
||||
- name: Upload macOS static archives
|
||||
@@ -182,35 +193,40 @@ jobs:
|
||||
- name: Verify static archives
|
||||
run: |
|
||||
for rid in linux-x64 linux-arm64 osx-x64 osx-arm64; do
|
||||
test -f External/NativeStatic/$rid/libskia.a
|
||||
test -f External/NativeStatic/$rid/libSkiaSharp.a
|
||||
test -f External/NativeStatic/$rid/libHarfBuzzSharp.a
|
||||
test -f External/NativeStatic/$rid/libANGLE_static.a
|
||||
test -f External/NativeStatic/$rid/libGLESv2_static.a
|
||||
test -f External/NativeStatic/$rid/native/libskia.a
|
||||
test -f External/NativeStatic/$rid/native/libSkiaSharp.a
|
||||
test -f External/NativeStatic/$rid/native/libHarfBuzzSharp.a
|
||||
test -f External/NativeStatic/$rid/native/libANGLE_static.a
|
||||
test -f External/NativeStatic/$rid/native/libGLESv2_static.a
|
||||
done
|
||||
|
||||
for rid in osx-x64 osx-arm64; do
|
||||
test -f External/NativeStatic/$rid/native/libAvaloniaNative.a
|
||||
test -f External/NativeStatic/$rid/native/macos_font_preinit.o
|
||||
done
|
||||
|
||||
for rid in win-x64 win-arm64; do
|
||||
test -f External/NativeStatic/$rid/skia.lib
|
||||
test -f External/NativeStatic/$rid/SkiaSharp.lib
|
||||
test -f External/NativeStatic/$rid/libHarfBuzzSharp.lib
|
||||
test -f External/NativeStatic/$rid/libANGLE_static.lib
|
||||
test -f External/NativeStatic/$rid/libGLESv2_static.lib
|
||||
test -f External/NativeStatic/$rid/native/skia.lib
|
||||
test -f External/NativeStatic/$rid/native/SkiaSharp.lib
|
||||
test -f External/NativeStatic/$rid/native/libHarfBuzzSharp.lib
|
||||
test -f External/NativeStatic/$rid/native/libANGLE_static.lib
|
||||
test -f External/NativeStatic/$rid/native/libGLESv2_static.lib
|
||||
done
|
||||
|
||||
- name: Pack NuGet package
|
||||
run: dotnet pack NuGet/StaticGraphics/Shiroka.Avalonia.StaticLink.csproj -c Release -o artifacts/nuget
|
||||
run: dotnet pack NuGet/StaticGraphics/StaticLink.Avalonia.csproj -c Release -o artifacts/nuget
|
||||
|
||||
- name: Upload NuGet artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: nuget-static-graphics
|
||||
name: staticlink-avalonia-nuget
|
||||
path: |
|
||||
artifacts/nuget/*.nupkg
|
||||
artifacts/nuget/*.snupkg
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Publish to nuget.org
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/static-graphics-v') || (github.event_name == 'workflow_dispatch' && inputs.publish_to_nuget == true) }}
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/staticlink-avalonia-v') || (github.event_name == 'workflow_dispatch' && inputs.publish_to_nuget == true) }}
|
||||
env:
|
||||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|
||||
run: |
|
||||
@@ -270,16 +286,16 @@ jobs:
|
||||
- name: Download NuGet package
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: nuget-static-graphics
|
||||
name: staticlink-avalonia-nuget
|
||||
path: artifacts/nuget
|
||||
|
||||
- name: Publish Avalonia single-file smoke app
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
$package = Get-ChildItem -Path "artifacts/nuget" -Filter "Shiroka.Avalonia.StaticLink.*.nupkg" | Select-Object -First 1
|
||||
$package = Get-ChildItem -Path "artifacts/nuget" -Filter "StaticLink.Avalonia.*.nupkg" | Select-Object -First 1
|
||||
if (-not $package) { throw "StaticLink NuGet package was not downloaded." }
|
||||
if ($package.BaseName -notmatch '^Shiroka\.Avalonia\.StaticLink\.(.+)$') { throw "Unexpected package name: $($package.Name)" }
|
||||
if ($package.BaseName -notmatch '^StaticLink\.Avalonia\.(.+)$') { throw "Unexpected package name: $($package.Name)" }
|
||||
$version = $Matches[1]
|
||||
$projectDir = Join-Path $PWD "artifacts/avalonia-smoke-src"
|
||||
pwsh ./scripts/create-avalonia-smoke.ps1 -ProjectDir $projectDir -NuGetSource (Resolve-Path "artifacts/nuget") -StaticLinkVersion $version
|
||||
@@ -298,7 +314,7 @@ jobs:
|
||||
run: |
|
||||
$publishDir = "artifacts/smoke-${{ matrix.rid }}"
|
||||
$blocked = Get-ChildItem -Path $publishDir -Recurse -File | Where-Object {
|
||||
$_.Name -in @("libSkiaSharp.dll", "libHarfBuzzSharp.dll", "av_libglesv2.dll", "libSkiaSharp.so", "libHarfBuzzSharp.so", "libSkiaSharp.dylib", "libHarfBuzzSharp.dylib")
|
||||
$_.Name -in @("libSkiaSharp.dll", "libHarfBuzzSharp.dll", "av_libglesv2.dll", "libSkiaSharp.so", "libHarfBuzzSharp.so", "libAvaloniaNative.dylib", "libSkiaSharp.dylib", "libHarfBuzzSharp.dylib")
|
||||
}
|
||||
if ($blocked) {
|
||||
$blocked | ForEach-Object { Write-Error "Unexpected dynamic graphics library: $($_.FullName)" }
|
||||
@@ -306,6 +322,46 @@ jobs:
|
||||
}
|
||||
Get-ChildItem -Path $publishDir -Recurse -File | ForEach-Object { $_.FullName }
|
||||
|
||||
- name: Run macOS Avalonia smoke app
|
||||
if: ${{ startsWith(matrix.rid, 'osx-') }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd "artifacts/smoke-${{ matrix.rid }}"
|
||||
chmod +x ./AvaloniaStaticLinkSmoke
|
||||
python3 - <<'PY'
|
||||
import pathlib
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
log = pathlib.Path("avalonia-smoke-run.log")
|
||||
proc = subprocess.Popen(
|
||||
["./AvaloniaStaticLinkSmoke"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
)
|
||||
|
||||
try:
|
||||
output, _ = proc.communicate(timeout=15)
|
||||
except subprocess.TimeoutExpired:
|
||||
proc.kill()
|
||||
output, _ = proc.communicate()
|
||||
log.write_text(output or "")
|
||||
print(output or "")
|
||||
print("Avalonia smoke app stayed alive for 15 seconds.")
|
||||
sys.exit(0)
|
||||
|
||||
log.write_text(output or "")
|
||||
print(output or "")
|
||||
if proc.returncode == 0:
|
||||
print("Avalonia smoke app exited normally.")
|
||||
sys.exit(0)
|
||||
|
||||
print(f"Avalonia smoke app failed with exit code {proc.returncode}.", file=sys.stderr)
|
||||
sys.exit(proc.returncode if proc.returncode > 0 else 1)
|
||||
PY
|
||||
|
||||
- name: Upload Avalonia smoke app
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -318,10 +374,12 @@ jobs:
|
||||
needs:
|
||||
- pack
|
||||
- smoke-avalonia
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/static-graphics-v') || (github.event_name == 'workflow_dispatch' && inputs.publish_to_release == true) }}
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/staticlink-avalonia-v') || (github.event_name == 'workflow_dispatch' && inputs.publish_to_release == true) }}
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
@@ -330,7 +388,7 @@ jobs:
|
||||
- name: Prepare release files
|
||||
run: |
|
||||
mkdir -p release-files
|
||||
find release-artifacts/nuget-static-graphics -type f \( -name '*.nupkg' -o -name '*.snupkg' \) -exec cp {} release-files/ \;
|
||||
find release-artifacts/staticlink-avalonia-nuget -type f \( -name '*.nupkg' -o -name '*.snupkg' \) -exec cp {} release-files/ \;
|
||||
for dir in release-artifacts/avalonia-smoke-*; do
|
||||
[ -d "$dir" ] || continue
|
||||
name="$(basename "$dir")"
|
||||
@@ -346,8 +404,8 @@ jobs:
|
||||
release_tag="${GITHUB_REF_NAME}"
|
||||
title="${GITHUB_REF_NAME}"
|
||||
else
|
||||
release_tag="static-graphics-smoke-${GITHUB_RUN_NUMBER}"
|
||||
title="Static graphics smoke ${GITHUB_RUN_NUMBER}"
|
||||
release_tag="staticlink-avalonia-smoke-${GITHUB_RUN_NUMBER}"
|
||||
title="StaticLink.Avalonia smoke ${GITHUB_RUN_NUMBER}"
|
||||
fi
|
||||
|
||||
if gh release view "$release_tag" >/dev/null 2>&1; then
|
||||
|
||||
+19
-121
@@ -1,10 +1,10 @@
|
||||
# Shiroka.Avalonia.StaticLink
|
||||
# StaticLink.Avalonia
|
||||
|
||||
Static graphics libraries for Avalonia NativeAOT single-file publishing.
|
||||
Static native libraries for Avalonia NativeAOT publishing.
|
||||
|
||||
This package provides static archives for SkiaSharp, HarfBuzzSharp, and ANGLE, then wires them into MSBuild through `buildTransitive` targets. It is intended for Avalonia applications that want NativeAOT single-file publish outputs without shipping Avalonia graphics native libraries next to the executable.
|
||||
This package links Avalonia's graphics/native dependencies from static archives so NativeAOT publish output does not need the usual SkiaSharp, HarfBuzzSharp, ANGLE, or AvaloniaNative runtime files next to the executable.
|
||||
|
||||
Repository: <https://github.com/greepar/Avalonia.StaticGraphics>
|
||||
Repository: <https://github.com/greepar/StaticLink.Avalonia>
|
||||
|
||||
## Supported RIDs
|
||||
|
||||
@@ -15,34 +15,14 @@ Repository: <https://github.com/greepar/Avalonia.StaticGraphics>
|
||||
- `osx-x64`
|
||||
- `osx-arm64`
|
||||
|
||||
## Included Libraries
|
||||
|
||||
Windows:
|
||||
|
||||
- `skia.lib`
|
||||
- `SkiaSharp.lib`
|
||||
- `libHarfBuzzSharp.lib`
|
||||
- `libANGLE_static.lib`
|
||||
- `libGLESv2_static.lib`
|
||||
|
||||
Linux and macOS:
|
||||
|
||||
- `libskia.a`
|
||||
- `libSkiaSharp.a`
|
||||
- `libHarfBuzzSharp.a`
|
||||
- `libANGLE_static.a`
|
||||
- `libGLESv2_static.a`
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
dotnet add package Shiroka.Avalonia.StaticLink
|
||||
dotnet add package StaticLink.Avalonia
|
||||
```
|
||||
|
||||
## Publish
|
||||
|
||||
Windows x64 or arm64:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r win-x64 \
|
||||
-p:PublishAot=true \
|
||||
@@ -51,7 +31,9 @@ dotnet publish -c Release -r win-x64 \
|
||||
-p:StripSymbols=true
|
||||
```
|
||||
|
||||
Linux x64 or arm64:
|
||||
Use the RID you need, for example `linux-x64`, `linux-arm64`, `osx-arm64`, or `osx-x64`.
|
||||
|
||||
For Linux, `lld` is recommended:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r linux-x64 \
|
||||
@@ -62,102 +44,18 @@ dotnet publish -c Release -r linux-x64 \
|
||||
-p:LinkerFlavor=lld
|
||||
```
|
||||
|
||||
macOS x64 or arm64:
|
||||
For macOS, avoid the Metal renderer for fully static output. Use OpenGL or Software:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r osx-arm64 \
|
||||
-p:PublishAot=true \
|
||||
-p:SelfContained=true \
|
||||
-p:PublishSingleFile=true \
|
||||
-p:StripSymbols=true
|
||||
```csharp
|
||||
.With(new AvaloniaNativePlatformOptions
|
||||
{
|
||||
RenderingMode = [AvaloniaNativeRenderingMode.OpenGl, AvaloniaNativeRenderingMode.Software]
|
||||
})
|
||||
```
|
||||
|
||||
The package automatically contributes the static archives as `NativeLibrary` items when `PublishAot=true` and the `RuntimeIdentifier` is supported.
|
||||
## Notes
|
||||
|
||||
## Verify Output
|
||||
|
||||
After publishing, the publish directory should not contain Avalonia graphics runtime files such as:
|
||||
|
||||
- `libSkiaSharp.so`
|
||||
- `libHarfBuzzSharp.so`
|
||||
- `libSkiaSharp.dylib`
|
||||
- `libHarfBuzzSharp.dylib`
|
||||
- `libSkiaSharp.dll`
|
||||
- `libHarfBuzzSharp.dll`
|
||||
- `av_libglesv2.dll`
|
||||
|
||||
The package stores static archives under `static/<rid>/native/` inside the NuGet package, so `.a` and `.lib` files are used for linking and are not normal runtime assets.
|
||||
|
||||
## Build From Source
|
||||
|
||||
This repository does not depend on 2ndLAB static packages. The GitHub Actions workflow builds the native libraries from upstream source repositories:
|
||||
|
||||
- SkiaSharp: <https://github.com/mono/SkiaSharp>
|
||||
- ANGLE: <https://github.com/google/angle>
|
||||
|
||||
Build scripts:
|
||||
|
||||
- `scripts/build-linux-static-graphics.sh`
|
||||
- `scripts/build-windows-static-graphics.ps1`
|
||||
- `scripts/build-macos-static-graphics.sh`
|
||||
|
||||
Build locally after the static archives exist:
|
||||
|
||||
```bash
|
||||
dotnet pack NuGet/StaticGraphics/Shiroka.Avalonia.StaticLink.csproj -c Release -o artifacts/nuget
|
||||
```
|
||||
|
||||
The package will be written to:
|
||||
|
||||
```text
|
||||
artifacts/nuget/Shiroka.Avalonia.StaticLink.*.nupkg
|
||||
```
|
||||
|
||||
## GitHub Actions
|
||||
|
||||
The workflow `.github/workflows/nuget-static-graphics.yml` builds all native archives and packs a single NuGet package for all supported RIDs.
|
||||
|
||||
It will:
|
||||
|
||||
- build Linux x64 static archives on `ubuntu-latest`
|
||||
- build Linux arm64 static archives on `ubuntu-24.04-arm`
|
||||
- build Windows x64 and arm64 static archives on `windows-latest`
|
||||
- build macOS x64 and arm64 static archives on `macos-latest`
|
||||
- download all native artifacts into `External/NativeStatic/<rid>/`
|
||||
- run `dotnet pack`
|
||||
- upload the generated `.nupkg` as a workflow artifact
|
||||
|
||||
To publish automatically to nuget.org, add a repository secret named `NUGET_API_KEY`, then either:
|
||||
|
||||
- run the workflow manually with `publish_to_nuget=true`
|
||||
- push a tag matching `static-graphics-v*`
|
||||
|
||||
Example tag:
|
||||
|
||||
```bash
|
||||
git tag static-graphics-v3.119.2-7151.4
|
||||
git push origin static-graphics-v3.119.2-7151.4
|
||||
```
|
||||
|
||||
## Known Runtime Dependencies
|
||||
|
||||
Single-file does not always mean dependency-free. Depending on platform and publish settings, the final executable may still depend on operating system libraries and frameworks.
|
||||
|
||||
Linux examples:
|
||||
|
||||
- `libc.so.6`
|
||||
- `libm.so.6`
|
||||
- `libstdc++.so.6`
|
||||
- `libgcc_s.so.1`
|
||||
- `libfontconfig.so.1`
|
||||
- `libfreetype.so.6`
|
||||
|
||||
Linux systems also need usable fonts for text rendering and font fallback.
|
||||
|
||||
## Scope
|
||||
|
||||
This package only covers Avalonia graphics-related native libraries. If your application uses other native dependencies, such as SQLite, audio backends, OpenSSL, or custom native libraries, those dependencies may require separate handling.
|
||||
|
||||
## License
|
||||
|
||||
The NuGet package metadata uses the MIT license. The bundled third-party native libraries are built from their upstream projects and remain subject to their respective upstream licenses.
|
||||
- The package is intended for Avalonia `11.3.x` NativeAOT apps.
|
||||
- The CI builds and smoke-publishes all six supported RIDs.
|
||||
- macOS smoke tests run the published app on GitHub Actions and require it to stay alive for 15 seconds.
|
||||
- Other native dependencies used by your app, such as SQLite or audio libraries, are outside this package's scope.
|
||||
+6
-6
@@ -5,7 +5,7 @@
|
||||
<NoBuild>true</NoBuild>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
<SuppressDependenciesWhenPacking>false</SuppressDependenciesWhenPacking>
|
||||
<PackageId>Shiroka.Avalonia.StaticLink</PackageId>
|
||||
<PackageId>StaticLink.Avalonia</PackageId>
|
||||
<Version>3.119.2-7151.9</Version>
|
||||
<Authors>greepar</Authors>
|
||||
<Company>greepar</Company>
|
||||
@@ -14,8 +14,8 @@
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/greepar/Avalonia.StaticGraphics</RepositoryUrl>
|
||||
<PackageProjectUrl>https://github.com/greepar/Avalonia.StaticGraphics</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/greepar/StaticLink.Avalonia</RepositoryUrl>
|
||||
<PackageProjectUrl>https://github.com/greepar/StaticLink.Avalonia</PackageProjectUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -25,9 +25,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="" />
|
||||
<None Include="lib/net10.0/_._" Pack="true" PackagePath="lib/net10.0/_._" />
|
||||
<None Include="buildTransitive/Shiroka.Avalonia.StaticLink.props" Pack="true" PackagePath="buildTransitive/$(PackageId).props" />
|
||||
<None Include="buildTransitive/Shiroka.Avalonia.StaticLink.targets" Pack="true" PackagePath="buildTransitive/$(PackageId).targets" />
|
||||
<None Include="buildTransitive/Shiroka.Avalonia.StaticLink.MacOSFontWarmup.cs" Pack="true" PackagePath="buildTransitive/Shiroka.Avalonia.StaticLink.MacOSFontWarmup.cs" />
|
||||
<None Include="buildTransitive/StaticLink.Avalonia.props" Pack="true" PackagePath="buildTransitive/$(PackageId).props" />
|
||||
<None Include="buildTransitive/StaticLink.Avalonia.targets" Pack="true" PackagePath="buildTransitive/$(PackageId).targets" />
|
||||
<None Include="buildTransitive/StaticLink.Avalonia.MacOSFontWarmup.cs" Pack="true" PackagePath="buildTransitive/StaticLink.Avalonia.MacOSFontWarmup.cs" />
|
||||
<None Include="../../External/NativeStatic/win-x64/native/**/*" Pack="true" PackagePath="static/win-x64/native/%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
<None Include="../../External/NativeStatic/win-arm64/native/**/*" Pack="true" PackagePath="static/win-arm64/native/%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
<None Include="../../External/NativeStatic/linux-x64/native/**/*" Pack="true" PackagePath="static/linux-x64/native/%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
@@ -1,5 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShirokaAvaloniaStaticLinkRoot Condition="'$(ShirokaAvaloniaStaticLinkRoot)' == ''">$(MSBuildThisFileDirectory)../static/</ShirokaAvaloniaStaticLinkRoot>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,125 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_ShirokaAvaloniaStaticLinkRid Condition="'$(RuntimeIdentifier)' == 'win-x64'">win-x64</_ShirokaAvaloniaStaticLinkRid>
|
||||
<_ShirokaAvaloniaStaticLinkRid Condition="'$(RuntimeIdentifier)' == 'win-arm64'">win-arm64</_ShirokaAvaloniaStaticLinkRid>
|
||||
<_ShirokaAvaloniaStaticLinkRid Condition="'$(RuntimeIdentifier)' == 'linux-x64'">linux-x64</_ShirokaAvaloniaStaticLinkRid>
|
||||
<_ShirokaAvaloniaStaticLinkRid Condition="'$(RuntimeIdentifier)' == 'linux-arm64'">linux-arm64</_ShirokaAvaloniaStaticLinkRid>
|
||||
<_ShirokaAvaloniaStaticLinkRid Condition="'$(RuntimeIdentifier)' == 'osx-x64'">osx-x64</_ShirokaAvaloniaStaticLinkRid>
|
||||
<_ShirokaAvaloniaStaticLinkRid Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">osx-arm64</_ShirokaAvaloniaStaticLinkRid>
|
||||
<_ShirokaAvaloniaStaticLinkNativeRoot Condition="'$(_ShirokaAvaloniaStaticLinkRid)' != ''">$(ShirokaAvaloniaStaticLinkRoot)$(_ShirokaAvaloniaStaticLinkRid)/native</_ShirokaAvaloniaStaticLinkNativeRoot>
|
||||
<LinkerFlavor Condition="'$(LinkerFlavor)' == '' and ('$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64')">lld</LinkerFlavor>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'win-x64' or '$(RuntimeIdentifier)' == 'win-arm64') and '$(_ShirokaAvaloniaStaticLinkNativeRoot)' != ''">
|
||||
<DirectPInvoke Include="libHarfBuzzSharp" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.lib')" />
|
||||
<DirectPInvoke Include="libSkiaSharp" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/SkiaSharp.lib')" />
|
||||
<DirectPInvoke Include="libGLESv2" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libGLESv2_static.lib')" />
|
||||
<DirectPInvoke Include="av_libglesv2" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libGLESv2_static.lib')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.lib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.lib')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/skia.lib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/skia.lib')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/SkiaSharp.lib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/SkiaSharp.lib')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libANGLE_static.lib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libANGLE_static.lib')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libGLESv2_static.lib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libGLESv2_static.lib')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libc++.lib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libc++.lib')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libc++abi.lib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libc++abi.lib')" />
|
||||
<LinkerArg Include="d3d9.lib;dxguid.lib" />
|
||||
<LinkerArg Include="dxgi.lib" />
|
||||
<LinkerArg Include="Gdi32.lib;User32.lib" />
|
||||
<LinkerArg Include="synchronization.lib" />
|
||||
<LinkerArg Include="fontsub.lib;Ole32.lib;USP10.lib" />
|
||||
<LinkerArg Include="d3d12.lib;d3dcompiler.lib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64') and '$(_ShirokaAvaloniaStaticLinkNativeRoot)' != ''">
|
||||
<DirectPInvoke Include="libHarfBuzzSharp" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<DirectPInvoke Include="libSkiaSharp" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libskia.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libskia.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libANGLE_static.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libANGLE_static.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libGLESv2_static.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libGLESv2_static.a')" />
|
||||
<NativeSystemLibrary Include="stdc++" />
|
||||
<NativeSystemLibrary Include="gcc_eh" />
|
||||
<NativeSystemLibrary Include="fontconfig" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64') and '$(_ShirokaAvaloniaStaticLinkNativeRoot)' != '' and '$(LinkerFlavor)' == 'lld'">
|
||||
<LinkerArg Include="-Wl,-z,nostart-stop-gc" />
|
||||
<LinkerArg Include="-Wl,--allow-multiple-definition" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libskia.a')" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64') and '$(_ShirokaAvaloniaStaticLinkNativeRoot)' != ''">
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Shiroka.Avalonia.StaticLink.MacOSFontWarmup.cs" Link="Shiroka.Avalonia.StaticLink.MacOSFontWarmup.cs" Condition="Exists('$(MSBuildThisFileDirectory)Shiroka.Avalonia.StaticLink.MacOSFontWarmup.cs')" />
|
||||
<DirectPInvoke Include="libAvaloniaNative" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libAvaloniaNative.a')" />
|
||||
<DirectPInvoke Include="libHarfBuzzSharp" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<DirectPInvoke Include="libSkiaSharp" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/macos_font_preinit.o" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/macos_font_preinit.o')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libAvaloniaNative.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libAvaloniaNative.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libskia.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libskia.a')" />
|
||||
<NativeLibrary Include="$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a')" />
|
||||
<NativeSystemLibrary Include="c++" />
|
||||
<LinkerArg Include="-framework AppKit" />
|
||||
<LinkerArg Include="-framework Carbon" />
|
||||
<LinkerArg Include="-framework CoreFoundation" />
|
||||
<LinkerArg Include="-framework CoreGraphics" />
|
||||
<LinkerArg Include="-framework CoreText" />
|
||||
<LinkerArg Include="-framework Foundation" />
|
||||
<LinkerArg Include="-framework IOSurface" />
|
||||
<LinkerArg Include="-framework Metal" />
|
||||
<LinkerArg Include="-framework OpenGL" />
|
||||
<LinkerArg Include="-framework QuartzCore" />
|
||||
<LinkerArg Include="-framework UniformTypeIdentifiers" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="ShirokaAvaloniaStaticLinkDisableStaticExecutableOnApple"
|
||||
BeforeTargets="LinkNative"
|
||||
Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64')">
|
||||
<PropertyGroup>
|
||||
<StaticExecutable>false</StaticExecutable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<LinkerArg Remove="-static" />
|
||||
<LinkerArg Remove="-static-pie" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="ShirokaAvaloniaStaticLinkValidateMacOSStaticLibraries"
|
||||
BeforeTargets="LinkNative"
|
||||
Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64') and '$(_ShirokaAvaloniaStaticLinkNativeRoot)' != ''">
|
||||
<Error Condition="!Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a')" Text="Missing static library: $(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a" />
|
||||
<Error Condition="!Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libskia.a')" Text="Missing static library: $(_ShirokaAvaloniaStaticLinkNativeRoot)/libskia.a" />
|
||||
<Error Condition="!Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a')" Text="Missing static library: $(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a" />
|
||||
</Target>
|
||||
|
||||
<Target Name="ShirokaAvaloniaStaticLinkAddMacOSDirectPInvokes"
|
||||
BeforeTargets="WriteIlcRspFileForCompilation"
|
||||
Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64') and '$(_ShirokaAvaloniaStaticLinkNativeRoot)' != ''">
|
||||
<ItemGroup>
|
||||
<DirectPInvoke Include="libAvaloniaNative" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libAvaloniaNative.a')" />
|
||||
<DirectPInvoke Include="libAvaloniaNative.dylib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libAvaloniaNative.a')" />
|
||||
<DirectPInvoke Include="libHarfBuzzSharp" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<DirectPInvoke Include="libHarfBuzzSharp.dylib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<DirectPInvoke Include="libSkiaSharp" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a')" />
|
||||
<DirectPInvoke Include="libSkiaSharp.dylib" Condition="Exists('$(_ShirokaAvaloniaStaticLinkNativeRoot)/libSkiaSharp.a')" />
|
||||
</ItemGroup>
|
||||
<Message Importance="high" Text="Shiroka StaticLink DirectPInvoke: @(DirectPInvoke)" />
|
||||
<Message Importance="high" Text="Shiroka StaticLink NativeLibrary: @(NativeLibrary)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="ShirokaAvaloniaStaticLinkCleanDynamicAssets"
|
||||
AfterTargets="Publish"
|
||||
Condition="'$(PublishAot)' == 'true' and '$(_ShirokaAvaloniaStaticLinkNativeRoot)' != ''">
|
||||
<ItemGroup>
|
||||
<_ShirokaAvaloniaStaticLinkFilesToDelete Include="$(PublishDir)av_libglesv2.dll" />
|
||||
<_ShirokaAvaloniaStaticLinkFilesToDelete Include="$(PublishDir)libHarfBuzzSharp.dll" />
|
||||
<_ShirokaAvaloniaStaticLinkFilesToDelete Include="$(PublishDir)libSkiaSharp.dll" />
|
||||
<_ShirokaAvaloniaStaticLinkFilesToDelete Include="$(PublishDir)libHarfBuzzSharp.so" />
|
||||
<_ShirokaAvaloniaStaticLinkFilesToDelete Include="$(PublishDir)libSkiaSharp.so" />
|
||||
<_ShirokaAvaloniaStaticLinkFilesToDelete Include="$(PublishDir)libHarfBuzzSharp.dylib" />
|
||||
<_ShirokaAvaloniaStaticLinkFilesToDelete Include="$(PublishDir)libSkiaSharp.dylib" />
|
||||
<_ShirokaAvaloniaStaticLinkFilesToDelete Include="$(PublishDir)libAvaloniaNative.dylib" />
|
||||
</ItemGroup>
|
||||
<Delete Files="@(_ShirokaAvaloniaStaticLinkFilesToDelete)" TreatErrorsAsWarnings="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
+1
-1
@@ -2,7 +2,7 @@ using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Shiroka.Avalonia.StaticLink;
|
||||
namespace StaticLink.Avalonia;
|
||||
|
||||
internal static class MacOSFontWarmup
|
||||
{
|
||||
@@ -0,0 +1,5 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<StaticLinkAvaloniaRoot Condition="'$(StaticLinkAvaloniaRoot)' == ''">$(MSBuildThisFileDirectory)../static/</StaticLinkAvaloniaRoot>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,125 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_StaticLinkAvaloniaRid Condition="'$(RuntimeIdentifier)' == 'win-x64'">win-x64</_StaticLinkAvaloniaRid>
|
||||
<_StaticLinkAvaloniaRid Condition="'$(RuntimeIdentifier)' == 'win-arm64'">win-arm64</_StaticLinkAvaloniaRid>
|
||||
<_StaticLinkAvaloniaRid Condition="'$(RuntimeIdentifier)' == 'linux-x64'">linux-x64</_StaticLinkAvaloniaRid>
|
||||
<_StaticLinkAvaloniaRid Condition="'$(RuntimeIdentifier)' == 'linux-arm64'">linux-arm64</_StaticLinkAvaloniaRid>
|
||||
<_StaticLinkAvaloniaRid Condition="'$(RuntimeIdentifier)' == 'osx-x64'">osx-x64</_StaticLinkAvaloniaRid>
|
||||
<_StaticLinkAvaloniaRid Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">osx-arm64</_StaticLinkAvaloniaRid>
|
||||
<_StaticLinkAvaloniaNativeRoot Condition="'$(_StaticLinkAvaloniaRid)' != ''">$(StaticLinkAvaloniaRoot)$(_StaticLinkAvaloniaRid)/native</_StaticLinkAvaloniaNativeRoot>
|
||||
<LinkerFlavor Condition="'$(LinkerFlavor)' == '' and ('$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64')">lld</LinkerFlavor>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'win-x64' or '$(RuntimeIdentifier)' == 'win-arm64') and '$(_StaticLinkAvaloniaNativeRoot)' != ''">
|
||||
<DirectPInvoke Include="libHarfBuzzSharp" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.lib')" />
|
||||
<DirectPInvoke Include="libSkiaSharp" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/SkiaSharp.lib')" />
|
||||
<DirectPInvoke Include="libGLESv2" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libGLESv2_static.lib')" />
|
||||
<DirectPInvoke Include="av_libglesv2" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libGLESv2_static.lib')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.lib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.lib')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/skia.lib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/skia.lib')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/SkiaSharp.lib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/SkiaSharp.lib')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libANGLE_static.lib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libANGLE_static.lib')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libGLESv2_static.lib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libGLESv2_static.lib')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libc++.lib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libc++.lib')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libc++abi.lib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libc++abi.lib')" />
|
||||
<LinkerArg Include="d3d9.lib;dxguid.lib" />
|
||||
<LinkerArg Include="dxgi.lib" />
|
||||
<LinkerArg Include="Gdi32.lib;User32.lib" />
|
||||
<LinkerArg Include="synchronization.lib" />
|
||||
<LinkerArg Include="fontsub.lib;Ole32.lib;USP10.lib" />
|
||||
<LinkerArg Include="d3d12.lib;d3dcompiler.lib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64') and '$(_StaticLinkAvaloniaNativeRoot)' != ''">
|
||||
<DirectPInvoke Include="libHarfBuzzSharp" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<DirectPInvoke Include="libSkiaSharp" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libskia.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libskia.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libANGLE_static.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libANGLE_static.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libGLESv2_static.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libGLESv2_static.a')" />
|
||||
<NativeSystemLibrary Include="stdc++" />
|
||||
<NativeSystemLibrary Include="gcc_eh" />
|
||||
<NativeSystemLibrary Include="fontconfig" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64') and '$(_StaticLinkAvaloniaNativeRoot)' != '' and '$(LinkerFlavor)' == 'lld'">
|
||||
<LinkerArg Include="-Wl,-z,nostart-stop-gc" />
|
||||
<LinkerArg Include="-Wl,--allow-multiple-definition" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libskia.a')" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64') and '$(_StaticLinkAvaloniaNativeRoot)' != ''">
|
||||
<Compile Include="$(MSBuildThisFileDirectory)StaticLink.Avalonia.MacOSFontWarmup.cs" Link="StaticLink.Avalonia.MacOSFontWarmup.cs" Condition="Exists('$(MSBuildThisFileDirectory)StaticLink.Avalonia.MacOSFontWarmup.cs')" />
|
||||
<DirectPInvoke Include="libAvaloniaNative" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libAvaloniaNative.a')" />
|
||||
<DirectPInvoke Include="libHarfBuzzSharp" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<DirectPInvoke Include="libSkiaSharp" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/macos_font_preinit.o" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/macos_font_preinit.o')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libAvaloniaNative.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libAvaloniaNative.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libskia.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libskia.a')" />
|
||||
<NativeLibrary Include="$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a')" />
|
||||
<NativeSystemLibrary Include="c++" />
|
||||
<LinkerArg Include="-framework AppKit" />
|
||||
<LinkerArg Include="-framework Carbon" />
|
||||
<LinkerArg Include="-framework CoreFoundation" />
|
||||
<LinkerArg Include="-framework CoreGraphics" />
|
||||
<LinkerArg Include="-framework CoreText" />
|
||||
<LinkerArg Include="-framework Foundation" />
|
||||
<LinkerArg Include="-framework IOSurface" />
|
||||
<LinkerArg Include="-framework Metal" />
|
||||
<LinkerArg Include="-framework OpenGL" />
|
||||
<LinkerArg Include="-framework QuartzCore" />
|
||||
<LinkerArg Include="-framework UniformTypeIdentifiers" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="StaticLinkAvaloniaDisableStaticExecutableOnApple"
|
||||
BeforeTargets="LinkNative"
|
||||
Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64')">
|
||||
<PropertyGroup>
|
||||
<StaticExecutable>false</StaticExecutable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<LinkerArg Remove="-static" />
|
||||
<LinkerArg Remove="-static-pie" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="StaticLinkAvaloniaValidateMacOSStaticLibraries"
|
||||
BeforeTargets="LinkNative"
|
||||
Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64') and '$(_StaticLinkAvaloniaNativeRoot)' != ''">
|
||||
<Error Condition="!Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a')" Text="Missing static library: $(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a" />
|
||||
<Error Condition="!Exists('$(_StaticLinkAvaloniaNativeRoot)/libskia.a')" Text="Missing static library: $(_StaticLinkAvaloniaNativeRoot)/libskia.a" />
|
||||
<Error Condition="!Exists('$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a')" Text="Missing static library: $(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a" />
|
||||
</Target>
|
||||
|
||||
<Target Name="StaticLinkAvaloniaAddMacOSDirectPInvokes"
|
||||
BeforeTargets="WriteIlcRspFileForCompilation"
|
||||
Condition="'$(PublishAot)' == 'true' and ('$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64') and '$(_StaticLinkAvaloniaNativeRoot)' != ''">
|
||||
<ItemGroup>
|
||||
<DirectPInvoke Include="libAvaloniaNative" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libAvaloniaNative.a')" />
|
||||
<DirectPInvoke Include="libAvaloniaNative.dylib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libAvaloniaNative.a')" />
|
||||
<DirectPInvoke Include="libHarfBuzzSharp" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<DirectPInvoke Include="libHarfBuzzSharp.dylib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libHarfBuzzSharp.a')" />
|
||||
<DirectPInvoke Include="libSkiaSharp" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a')" />
|
||||
<DirectPInvoke Include="libSkiaSharp.dylib" Condition="Exists('$(_StaticLinkAvaloniaNativeRoot)/libSkiaSharp.a')" />
|
||||
</ItemGroup>
|
||||
<Message Importance="high" Text="StaticLink.Avalonia DirectPInvoke: @(DirectPInvoke)" />
|
||||
<Message Importance="high" Text="StaticLink.Avalonia NativeLibrary: @(NativeLibrary)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="StaticLinkAvaloniaCleanDynamicAssets"
|
||||
AfterTargets="Publish"
|
||||
Condition="'$(PublishAot)' == 'true' and '$(_StaticLinkAvaloniaNativeRoot)' != ''">
|
||||
<ItemGroup>
|
||||
<_StaticLinkAvaloniaFilesToDelete Include="$(PublishDir)av_libglesv2.dll" />
|
||||
<_StaticLinkAvaloniaFilesToDelete Include="$(PublishDir)libHarfBuzzSharp.dll" />
|
||||
<_StaticLinkAvaloniaFilesToDelete Include="$(PublishDir)libSkiaSharp.dll" />
|
||||
<_StaticLinkAvaloniaFilesToDelete Include="$(PublishDir)libHarfBuzzSharp.so" />
|
||||
<_StaticLinkAvaloniaFilesToDelete Include="$(PublishDir)libSkiaSharp.so" />
|
||||
<_StaticLinkAvaloniaFilesToDelete Include="$(PublishDir)libHarfBuzzSharp.dylib" />
|
||||
<_StaticLinkAvaloniaFilesToDelete Include="$(PublishDir)libSkiaSharp.dylib" />
|
||||
<_StaticLinkAvaloniaFilesToDelete Include="$(PublishDir)libAvaloniaNative.dylib" />
|
||||
</ItemGroup>
|
||||
<Delete Files="@(_StaticLinkAvaloniaFilesToDelete)" TreatErrorsAsWarnings="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,10 +1,10 @@
|
||||
# Shiroka.Avalonia.StaticLink
|
||||
# StaticLink.Avalonia
|
||||
|
||||
Static graphics libraries for Avalonia NativeAOT single-file publishing.
|
||||
Static native libraries for Avalonia NativeAOT publishing.
|
||||
|
||||
This package provides static archives for SkiaSharp, HarfBuzzSharp, and ANGLE, then wires them into MSBuild through `buildTransitive` targets. It is intended for Avalonia applications that want NativeAOT single-file publish outputs without shipping Avalonia graphics native libraries next to the executable.
|
||||
This package links Avalonia's graphics/native dependencies from static archives so NativeAOT publish output does not need the usual SkiaSharp, HarfBuzzSharp, ANGLE, or AvaloniaNative runtime files next to the executable.
|
||||
|
||||
Repository: <https://github.com/greepar/Avalonia.StaticGraphics>
|
||||
Repository: <https://github.com/greepar/StaticLink.Avalonia>
|
||||
|
||||
## Supported RIDs
|
||||
|
||||
@@ -15,34 +15,14 @@ Repository: <https://github.com/greepar/Avalonia.StaticGraphics>
|
||||
- `osx-x64`
|
||||
- `osx-arm64`
|
||||
|
||||
## Included Libraries
|
||||
|
||||
Windows:
|
||||
|
||||
- `skia.lib`
|
||||
- `SkiaSharp.lib`
|
||||
- `libHarfBuzzSharp.lib`
|
||||
- `libANGLE_static.lib`
|
||||
- `libGLESv2_static.lib`
|
||||
|
||||
Linux and macOS:
|
||||
|
||||
- `libskia.a`
|
||||
- `libSkiaSharp.a`
|
||||
- `libHarfBuzzSharp.a`
|
||||
- `libANGLE_static.a`
|
||||
- `libGLESv2_static.a`
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
dotnet add package Shiroka.Avalonia.StaticLink
|
||||
dotnet add package StaticLink.Avalonia
|
||||
```
|
||||
|
||||
## Publish
|
||||
|
||||
Windows x64 or arm64:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r win-x64 \
|
||||
-p:PublishAot=true \
|
||||
@@ -51,7 +31,9 @@ dotnet publish -c Release -r win-x64 \
|
||||
-p:StripSymbols=true
|
||||
```
|
||||
|
||||
Linux x64 or arm64:
|
||||
Use the RID you need, for example `linux-x64`, `linux-arm64`, `osx-arm64`, or `osx-x64`.
|
||||
|
||||
For Linux, `lld` is recommended:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r linux-x64 \
|
||||
@@ -62,102 +44,18 @@ dotnet publish -c Release -r linux-x64 \
|
||||
-p:LinkerFlavor=lld
|
||||
```
|
||||
|
||||
macOS x64 or arm64:
|
||||
For macOS, avoid the Metal renderer for fully static output. Use OpenGL or Software:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release -r osx-arm64 \
|
||||
-p:PublishAot=true \
|
||||
-p:SelfContained=true \
|
||||
-p:PublishSingleFile=true \
|
||||
-p:StripSymbols=true
|
||||
```csharp
|
||||
.With(new AvaloniaNativePlatformOptions
|
||||
{
|
||||
RenderingMode = [AvaloniaNativeRenderingMode.OpenGl, AvaloniaNativeRenderingMode.Software]
|
||||
})
|
||||
```
|
||||
|
||||
The package automatically contributes the static archives as `NativeLibrary` items when `PublishAot=true` and the `RuntimeIdentifier` is supported.
|
||||
## Notes
|
||||
|
||||
## Verify Output
|
||||
|
||||
After publishing, the publish directory should not contain Avalonia graphics runtime files such as:
|
||||
|
||||
- `libSkiaSharp.so`
|
||||
- `libHarfBuzzSharp.so`
|
||||
- `libSkiaSharp.dylib`
|
||||
- `libHarfBuzzSharp.dylib`
|
||||
- `libSkiaSharp.dll`
|
||||
- `libHarfBuzzSharp.dll`
|
||||
- `av_libglesv2.dll`
|
||||
|
||||
The package stores static archives under `static/<rid>/native/` inside the NuGet package, so `.a` and `.lib` files are used for linking and are not normal runtime assets.
|
||||
|
||||
## Build From Source
|
||||
|
||||
This repository does not depend on 2ndLAB static packages. The GitHub Actions workflow builds the native libraries from upstream source repositories:
|
||||
|
||||
- SkiaSharp: <https://github.com/mono/SkiaSharp>
|
||||
- ANGLE: <https://github.com/google/angle>
|
||||
|
||||
Build scripts:
|
||||
|
||||
- `scripts/build-linux-static-graphics.sh`
|
||||
- `scripts/build-windows-static-graphics.ps1`
|
||||
- `scripts/build-macos-static-graphics.sh`
|
||||
|
||||
Build locally after the static archives exist:
|
||||
|
||||
```bash
|
||||
dotnet pack NuGet/StaticGraphics/Shiroka.Avalonia.StaticLink.csproj -c Release -o artifacts/nuget
|
||||
```
|
||||
|
||||
The package will be written to:
|
||||
|
||||
```text
|
||||
artifacts/nuget/Shiroka.Avalonia.StaticLink.*.nupkg
|
||||
```
|
||||
|
||||
## GitHub Actions
|
||||
|
||||
The workflow `.github/workflows/nuget-static-graphics.yml` builds all native archives and packs a single NuGet package for all supported RIDs.
|
||||
|
||||
It will:
|
||||
|
||||
- build Linux x64 static archives on `ubuntu-latest`
|
||||
- build Linux arm64 static archives on `ubuntu-24.04-arm`
|
||||
- build Windows x64 and arm64 static archives on `windows-latest`
|
||||
- build macOS x64 and arm64 static archives on `macos-latest`
|
||||
- download all native artifacts into `External/NativeStatic/<rid>/`
|
||||
- run `dotnet pack`
|
||||
- upload the generated `.nupkg` as a workflow artifact
|
||||
|
||||
To publish automatically to nuget.org, add a repository secret named `NUGET_API_KEY`, then either:
|
||||
|
||||
- run the workflow manually with `publish_to_nuget=true`
|
||||
- push a tag matching `static-graphics-v*`
|
||||
|
||||
Example tag:
|
||||
|
||||
```bash
|
||||
git tag static-graphics-v3.119.2-7151.4
|
||||
git push origin static-graphics-v3.119.2-7151.4
|
||||
```
|
||||
|
||||
## Known Runtime Dependencies
|
||||
|
||||
Single-file does not always mean dependency-free. Depending on platform and publish settings, the final executable may still depend on operating system libraries and frameworks.
|
||||
|
||||
Linux examples:
|
||||
|
||||
- `libc.so.6`
|
||||
- `libm.so.6`
|
||||
- `libstdc++.so.6`
|
||||
- `libgcc_s.so.1`
|
||||
- `libfontconfig.so.1`
|
||||
- `libfreetype.so.6`
|
||||
|
||||
Linux systems also need usable fonts for text rendering and font fallback.
|
||||
|
||||
## Scope
|
||||
|
||||
This package only covers Avalonia graphics-related native libraries. If your application uses other native dependencies, such as SQLite, audio backends, OpenSSL, or custom native libraries, those dependencies may require separate handling.
|
||||
|
||||
## License
|
||||
|
||||
The NuGet package metadata uses the MIT license. The bundled third-party native libraries are built from their upstream projects and remain subject to their respective upstream licenses.
|
||||
- The package is intended for Avalonia `11.3.x` NativeAOT apps.
|
||||
- The CI builds and smoke-publishes all six supported RIDs.
|
||||
- macOS smoke tests run the published app on GitHub Actions and require it to stay alive for 15 seconds.
|
||||
- Other native dependencies used by your app, such as SQLite or audio libraries, are outside this package's scope.
|
||||
@@ -19,7 +19,7 @@ cat > "$src" <<'OBJC'
|
||||
#import <objc/runtime.h>
|
||||
|
||||
__attribute__((constructor(101)))
|
||||
static void ShirokaAvaloniaStaticLinkPreinitializeAppKitFonts(void)
|
||||
static void StaticLinkAvaloniaPreinitializeAppKitFonts(void)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ New-Item -ItemType Directory -Path $ProjectDir -Force | Out-Null
|
||||
<PackageReference Include="Avalonia" Version="11.3.14" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.14" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.14" />
|
||||
<PackageReference Include="Shiroka.Avalonia.StaticLink" Version="$StaticLinkVersion" />
|
||||
<PackageReference Include="StaticLink.Avalonia" Version="$StaticLinkVersion" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
"@ | Set-Content -Path (Join-Path $ProjectDir "AvaloniaStaticLinkSmoke.csproj") -Encoding UTF8
|
||||
|
||||
Reference in new issue
Block a user