This commit is contained in:
jess 2026-04-23 06:47:35 -07:00
parent ab23a4a885
commit 95894168f3
4 changed files with 53 additions and 5 deletions

5
.gitignore vendored
View File

@ -3,3 +3,8 @@
# Generated at build time from plugin.json.in by each platform's build script.
/plugin.json
# WinUI 3 shell generated artefacts.
/shell/windows/LayersShell/Assets/app.ico
/shell/windows/LayersShell/bin/
/shell/windows/LayersShell/obj/

View File

@ -49,6 +49,7 @@ pacman -S --needed \
mingw-w64-clang-aarch64-toolchain \
mingw-w64-clang-aarch64-cmake \
mingw-w64-clang-aarch64-ninja \
mingw-w64-clang-aarch64-librsvg \
git
# x86_64 (Intel / AMD)
@ -57,6 +58,7 @@ pacman -S --needed \
mingw-w64-ucrt-x86_64-toolchain \
mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ninja \
mingw-w64-ucrt-x86_64-librsvg \
git
```
@ -127,8 +129,20 @@ Runtime requirement on the target machine: **.NET 8 Desktop Runtime**. `winget i
Microsoft.DotNet.DesktopRuntime.8` — the installer's ~100 MB and common on modern
Windows boxes.
Optional: `winget install GNOME.librsvg` gives you `rsvg-convert` for regenerating icons
from `resources/Layers.svg`. Not required to build.
For a polished build you'll also want ImageMagick — it composes the Windows `.ico`
from the SVG, called from an MSBuild `<Target>` inside `LayersShell.csproj` so it runs
as part of `dotnet publish`. `rsvg-convert` was already pulled in via the MSYS2
`…-librsvg` package.
```powershell
winget install ImageMagick.ImageMagick
```
Neither tool is strictly required — the Target's `ContinueOnError="true"` and the
ApplicationIcon `Condition="Exists(...)"` let the build skip icon baking and fall
through to the default .NET exe icon if either is missing. If you don't want MSYS2
and need a standalone `rsvg-convert` (x86_64 only), grab a release from
<https://github.com/charls-data/static-rsvg-convert/releases> and drop it on PATH.
### Linux — Debian / Ubuntu / Pop!_OS (apt)

View File

@ -47,6 +47,9 @@ if %ERRORLEVEL% equ 0 (
)
)
rem The Windows exe icon is generated by an MSBuild Target inside LayersShell.csproj
rem (matches Acord's build.rs pattern). No action needed here.
rem nng 1.x triggers clang 16+ hard errors on type-incompatibilities; downgrade to warnings.
set "NNG_RELAX=-Wno-error=incompatible-pointer-types -Wno-error=incompatible-function-pointer-types -Wno-incompatible-pointer-types -Wno-incompatible-function-pointer-types"
if defined CFLAGS (

View File

@ -14,13 +14,39 @@
<LangVersion>latest</LangVersion>
<PublishReadyToRun>true</PublishReadyToRun>
<AssemblyName>Layers</AssemblyName>
<ApplicationIcon>Assets/app.ico</ApplicationIcon>
<!-- Baked by the GenerateAppIcon target below before every build. If neither rsvg-convert
nor magick are on PATH, the file never gets produced and this reference stays elided
via the Condition — .NET just uses its default exe icon, build still succeeds. -->
<ApplicationIcon Condition="Exists('Assets\app.ico')">Assets\app.ico</ApplicationIcon>
<LayersIconSvg>$(MSBuildProjectDirectory)\..\..\..\resources\Layers.svg</LayersIconSvg>
<LayersIconOut>$(MSBuildProjectDirectory)\Assets\app.ico</LayersIconOut>
<LayersIconTmp>$(IntermediateOutputPath)icon_tmp</LayersIconTmp>
</PropertyGroup>
<ItemGroup>
<!-- If NuGet complains "package not found", bump this to the newest 1.5.* or 1.6.* listed
on https://www.nuget.org/packages/Microsoft.WindowsAppSDK. The API surface we use
(MicaController, SwapChainPanel hosting) has been stable since 1.4. -->
on https://www.nuget.org/packages/Microsoft.WindowsAppSDK. -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240607001" />
</ItemGroup>
<!-- Acord's pattern: let the build system generate the icon so there's no ordering concern
between build.bat and dotnet publish, and no separate icon-shuffling step. Runs before
the compiler needs to open app.ico. Every Exec has ContinueOnError=true so a missing
tool degrades to "no icon" instead of a build failure. -->
<Target Name="GenerateAppIcon"
BeforeTargets="BeforeBuild"
Condition="Exists('$(LayersIconSvg)') and !Exists('$(LayersIconOut)')">
<MakeDir Directories="$(MSBuildProjectDirectory)\Assets;$(LayersIconTmp)" />
<Exec Command='rsvg-convert --width 16 --height 16 "$(LayersIconSvg)" -o "$(LayersIconTmp)\icon_16.png"' ContinueOnError="true" />
<Exec Command='rsvg-convert --width 24 --height 24 "$(LayersIconSvg)" -o "$(LayersIconTmp)\icon_24.png"' ContinueOnError="true" />
<Exec Command='rsvg-convert --width 32 --height 32 "$(LayersIconSvg)" -o "$(LayersIconTmp)\icon_32.png"' ContinueOnError="true" />
<Exec Command='rsvg-convert --width 48 --height 48 "$(LayersIconSvg)" -o "$(LayersIconTmp)\icon_48.png"' ContinueOnError="true" />
<Exec Command='rsvg-convert --width 64 --height 64 "$(LayersIconSvg)" -o "$(LayersIconTmp)\icon_64.png"' ContinueOnError="true" />
<Exec Command='rsvg-convert --width 128 --height 128 "$(LayersIconSvg)" -o "$(LayersIconTmp)\icon_128.png"' ContinueOnError="true" />
<Exec Command='rsvg-convert --width 256 --height 256 "$(LayersIconSvg)" -o "$(LayersIconTmp)\icon_256.png"' ContinueOnError="true" />
<Exec Command='magick "$(LayersIconTmp)\icon_16.png" "$(LayersIconTmp)\icon_24.png" "$(LayersIconTmp)\icon_32.png" "$(LayersIconTmp)\icon_48.png" "$(LayersIconTmp)\icon_64.png" "$(LayersIconTmp)\icon_128.png" "$(LayersIconTmp)\icon_256.png" "$(LayersIconOut)"'
ContinueOnError="true" />
<RemoveDir Directories="$(LayersIconTmp)" ContinueOnError="true" />
</Target>
</Project>