feat: Windows release packaging
Embed the app icon and version info into the exe, generated from musyx.png by tool/make_ico.ps1, and hide the console window in release builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c496275101
commit
4b1f0bb8a0
6 files changed
+94
No files matched your search
@@ -0,0 +1,35 @@
|
||||
# Packs the app icon PNG into a multi-size Windows .ico (PNG-compressed entries).
|
||||
# Usage: powershell -File tool/make_ico.ps1 crates/musyx/assets/icon/musyx.png crates/musyx/assets/icon/musyx.ico
|
||||
param([string]$Src, [string]$Dst)
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$sizes = 16, 20, 24, 32, 40, 48, 64, 128, 256
|
||||
$source = [System.Drawing.Image]::FromFile((Resolve-Path $Src))
|
||||
$images = foreach ($s in $sizes) {
|
||||
$bmp = New-Object System.Drawing.Bitmap $s, $s, ([System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
|
||||
$g = [System.Drawing.Graphics]::FromImage($bmp)
|
||||
$g.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
|
||||
$g.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
|
||||
$g.DrawImage($source, 0, 0, $s, $s)
|
||||
$g.Dispose()
|
||||
$ms = New-Object System.IO.MemoryStream
|
||||
$bmp.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
$bmp.Dispose()
|
||||
, $ms.ToArray()
|
||||
}
|
||||
$source.Dispose()
|
||||
|
||||
$out = New-Object System.IO.MemoryStream
|
||||
$w = New-Object System.IO.BinaryWriter $out
|
||||
$w.Write([uint16]0); $w.Write([uint16]1); $w.Write([uint16]$sizes.Count)
|
||||
$offset = 6 + 16 * $sizes.Count
|
||||
for ($i = 0; $i -lt $sizes.Count; $i++) {
|
||||
$dim = if ($sizes[$i] -ge 256) { 0 } else { $sizes[$i] } # 0 means 256
|
||||
$w.Write([byte]$dim); $w.Write([byte]$dim); $w.Write([byte]0); $w.Write([byte]0)
|
||||
$w.Write([uint16]1); $w.Write([uint16]32)
|
||||
$w.Write([uint32]$images[$i].Length); $w.Write([uint32]$offset)
|
||||
$offset += $images[$i].Length
|
||||
}
|
||||
foreach ($img in $images) { $w.Write($img) }
|
||||
$w.Flush()
|
||||
[System.IO.File]::WriteAllBytes((Join-Path (Get-Location) $Dst), $out.ToArray())
|
||||
Reference in new issue
Block a user