Skip to content

Commit

Permalink
Use ImageMagick to create icons
Browse files Browse the repository at this point in the history
  • Loading branch information
printfn committed Dec 28, 2023
1 parent 9d46a6f commit 4f7c727
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 21 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ jobs:
rustup component add clippy
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo fmt -- --check
- name: Compile icon/resources.res
if: ${{ matrix.platform == 'windows-latest' }}
run: |
$InstallationPath = vswhere -products * -latest -prerelease -property installationPath
pushd "$($InstallationPath)\VC\Auxiliary\Build"
cmd /c "vcvarsall.bat x64 & set" |
foreach {
if ($_ -match "=") {
$v = $_.split("=", 2); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
.\icon\create-resources.ps1
- name: Build, get version
run: |
Expand Down
15 changes: 15 additions & 0 deletions icon/create-resources.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$ErrorActionPreference = "Stop"

# https://learn.microsoft.com/en-us/windows/win32/menurc/using-rc-the-rc-command-line-

& magick convert $PSScriptRoot\icon.svg `
`( "-clone" 0 "-resize" 16x16 `) `
`( "-clone" 0 "-resize" 32x32 `) `
`( "-clone" 0 "-resize" 48x48 `) `
`( "-clone" 0 "-resize" 64x64 `) `
`( "-clone" 0 "-resize" 96x96 `) `
`( "-clone" 0 "-resize" 128x128 `) `
`( "-clone" 0 "-resize" 256x256 `) `
"-delete" 0 "-alpha" remove "-colors" 256 fend-icon.ico

& rc /v $PSScriptRoot\resources.rc
Binary file removed icon/fend-icon-128.png
Binary file not shown.
Binary file removed icon/fend-icon-150.png
Binary file not shown.
Binary file removed icon/fend-icon-16.png
Binary file not shown.
Binary file removed icon/fend-icon-256.ico
Binary file not shown.
Binary file removed icon/fend-icon-256.png
Binary file not shown.
Binary file removed icon/fend-icon-32.png
Binary file not shown.
Binary file removed icon/fend-icon-44.png
Binary file not shown.
Binary file removed icon/fend-icon-48.png
Binary file not shown.
Binary file removed icon/fend-icon-500.png
Binary file not shown.
Binary file removed icon/fend-icon-64.png
Binary file not shown.
Binary file removed icon/fend-icon-96.png
Binary file not shown.
Binary file removed icon/fend-icon.ico
Binary file not shown.
Binary file removed icon/resources.res
Binary file not shown.
14 changes: 7 additions & 7 deletions web/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ cd "$(dirname "$0")"

(cd ../wasm && wasm-pack build --target no-modules --out-dir ../web/pkg)

cp ../icon/fend-icon-128.png .
convert -resize "128x128" ../icon/icon.svg fend-icon-128.png

mkdir -p documentation

(cd ../documentation && pandoc --standalone \
--output=../web/documentation/index.html \
--metadata-file=pandoc-metadata.yml \
--lua-filter=include-code-files.lua \
--lua-filter=include-files.lua \
--lua-filter=add-header-ids.lua \
index.md)
--output=../web/documentation/index.html \
--metadata-file=pandoc-metadata.yml \
--lua-filter=include-code-files.lua \
--lua-filter=include-files.lua \
--lua-filter=add-header-ids.lua \
index.md)
28 changes: 14 additions & 14 deletions windows-msix/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,34 @@ $Env:WINDOWS_CERT_PASSWORD = "MyPassword"
# $PSScriptRoot is the directory of this script

if (Test-Path $PSScriptRoot\build) {
Remove-Item -Recurse -Force $PSScriptRoot\build
Remove-Item -Recurse -Force $PSScriptRoot\build
}

if (Test-Path $PSScriptRoot\fend.msix) {
Remove-Item -Force $PSScriptRoot\fend.msix
Remove-Item -Force $PSScriptRoot\fend.msix
}

if (Test-Path $PSScriptRoot\fend-windows-x64.msix) {
Remove-Item -Force $PSScriptRoot\fend-windows-x64.msix
Remove-Item -Force $PSScriptRoot\fend-windows-x64.msix
}

mkdir $PSScriptRoot\build
Copy-Item $PSScriptRoot\..\target\release\fend.exe $PSScriptRoot\build
(Get-Content $PSScriptRoot\AppxManifest.xml).replace('$FEND_VERSION', $Env:FEND_VERSION) | Set-Content $PSScriptRoot\build\AppxManifest.xml
Copy-Item $PSScriptRoot\..\icon\fend-icon-44.png $PSScriptRoot\build
Copy-Item $PSScriptRoot\..\icon\fend-icon-150.png $PSScriptRoot\build
convert -resize 44x44 $PSScriptRoot\..\icon\icon.svg $PSScriptRoot\build\fend-icon-44.png
convert -resize 150x150 $PSScriptRoot\..\icon\icon.svg $PSScriptRoot\build\fend-icon-150.png

& "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx.exe" `
pack `
/d $PSScriptRoot\build `
/p $PSScriptRoot\fend.msix `
/verbose
pack `
/d $PSScriptRoot\build `
/p $PSScriptRoot\fend.msix `
/verbose

& "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool.exe" `
sign `
/fd SHA256 /a `
/f $PSScriptRoot\fend-signing-cert.pfx `
/p $Env:WINDOWS_CERT_PASSWORD `
$PSScriptRoot\fend.msix
sign `
/fd SHA256 /a `
/f $PSScriptRoot\fend-signing-cert.pfx `
/p $Env:WINDOWS_CERT_PASSWORD `
$PSScriptRoot\fend.msix

Move-Item $PSScriptRoot\fend.msix $PSScriptRoot\fend-windows-x64.msix

0 comments on commit 4f7c727

Please sign in to comment.