Skip to content

Commit 433fc5c

Browse files
author
Rafał Mikrut
authored
License, rcedit (qarmin#1829)
1 parent f82bd5d commit 433fc5c

7 files changed

Lines changed: 42 additions & 62 deletions

File tree

.github/workflows/windows.yml

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,31 @@ jobs:
2525
rustup default 1.92.0
2626
rustup target add x86_64-pc-windows-gnu
2727
28+
- name: Download rcedit
29+
run: |
30+
curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe
31+
2832
- name: Compile Krokiet Release
2933
if: ${{ github.ref == 'refs/heads/master' }}
3034
run: |
3135
sed -i 's/#lto = /lto = /g' Cargo.toml
3236
sed -i 's/#codegen-units /codegen-units /g' Cargo.toml
33-
cargo build --release --target x86_64-pc-windows-gnu --bin krokiet --features "add_windows_icon"
37+
cargo build --release --target x86_64-pc-windows-gnu --bin krokiet
3438
mv target/x86_64-pc-windows-gnu/release/krokiet.exe windows_krokiet_on_linux.exe
39+
40+
export WINEPREFIX=$(mktemp -d)
41+
wine rcedit-x64.exe windows_krokiet_on_linux.exe --set-icon krokiet/icons/krokiet_logo_flag.ico
3542
3643
- name: Compile Krokiet Debug
3744
if: ${{ github.ref != 'refs/heads/master' }}
3845
run: |
3946
sed -i 's/^\(\[profile\.dev\.package.*\)/#\1/' Cargo.toml
4047
sed -i 's|^opt-level = 3 # OPT PACKAGES|#opt-level = 3 # OPT PACKAGES|' Cargo.toml
41-
cargo build --target x86_64-pc-windows-gnu --bin krokiet --features "add_windows_icon"
48+
cargo build --target x86_64-pc-windows-gnu --bin krokiet
4249
mv target/x86_64-pc-windows-gnu/debug/krokiet.exe windows_krokiet_on_linux.exe
50+
51+
export WINEPREFIX=$(mktemp -d)
52+
wine rcedit-x64.exe windows_krokiet_on_linux.exe --set-icon krokiet/icons/krokiet_logo_flag.ico
4353
4454
- name: Pack with 7z
4555
run: |
@@ -74,37 +84,39 @@ jobs:
7484
run: |
7585
rustup default 1.92.0
7686
87+
- name: Download rcedit
88+
run: |
89+
curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe
90+
7791
- name: Compile Krokiet Release
7892
if: ${{ github.ref == 'refs/heads/master' }}
7993
run: |
80-
# Replace '#lto = ' with 'lto = ' in Cargo.toml
81-
powershell -Command "(Get-Content Cargo.toml) -replace '#lto = ', 'lto = ' | Set-Content Cargo.toml"
82-
# Replace '#codegen-units ' with 'codegen-units ' in Cargo.toml
83-
powershell -Command "(Get-Content Cargo.toml) -replace '#codegen-units ', 'codegen-units ' | Set-Content Cargo.toml"
84-
cargo build --release --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software,add_windows_icon"
94+
powershell -Command "(Get-Content Cargo.toml) -replace '#lto = ', 'lto = ' | Set-Content Cargo.toml; (Get-Content Cargo.toml) -replace '#codegen-units ', 'codegen-units ' | Set-Content Cargo.toml"
95+
cargo build --release --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software"
8596
mv target/release/krokiet.exe windows_krokiet_on_windows_skia_opengl.exe
86-
cargo build --release --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software,add_windows_icon"
97+
cargo build --release --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software"
8798
mv target/release/krokiet.exe windows_krokiet_on_windows_skia_vulkan.exe
88-
cargo build --release --bin krokiet --no-default-features --features "femtovg_wgpu,add_windows_icon"
99+
cargo build --release --bin krokiet --no-default-features --features "femtovg_wgpu"
89100
mv target/release/krokiet.exe windows_krokiet_on_windows_femtovg_wgpu.exe
90-
cargo build --release --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu,add_windows_icon"
101+
cargo build --release --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu"
91102
mv target/release/krokiet.exe windows_krokiet_on_windows_all_backends.exe
103+
Get-ChildItem windows_krokiet_on_windows_*.exe | ForEach-Object { ./rcedit-x64.exe $_.Name --set-icon krokiet/icons/krokiet_logo_flag.ico }
92104
93105
- name: Compile Krokiet Debug
94106
if: ${{ github.ref != 'refs/heads/master' }}
95107
run: |
96-
# Comment out '[profile.dev.package.*' lines
97-
powershell -Command "(Get-Content Cargo.toml) -replace '^\[profile\.dev\.package.*', { '#' + \$_ } | Set-Content Cargo.toml"
98-
# Comment out 'opt-level = 3 # OPT PACKAGES'
99-
powershell -Command "(Get-Content Cargo.toml) -replace '^opt-level = 3 # OPT PACKAGES', '#opt-level = 3 # OPT PACKAGES' | Set-Content Cargo.toml"
100-
cargo build --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software,add_windows_icon"
108+
(Get-Content Cargo.toml) -replace '#lto = ','lto = ' -replace '#codegen-units ','codegen-units ' -replace '^\[profile\.dev\.package','#\[profile.dev.package' -replace '^opt-level = 3 # OPT PACKAGES','#opt-level = 3 # OPT PACKAGES' | Set-Content Cargo.toml
109+
110+
cargo build --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software"
101111
mv target/debug/krokiet.exe windows_krokiet_on_windows_skia_opengl.exe
102-
cargo build --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software,add_windows_icon"
112+
cargo build --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software"
103113
mv target/debug/krokiet.exe windows_krokiet_on_windows_skia_vulkan.exe
104-
cargo build --bin krokiet --no-default-features --features "femtovg_wgpu,add_windows_icon"
114+
cargo build --bin krokiet --no-default-features --features "femtovg_wgpu"
105115
mv target/debug/krokiet.exe windows_krokiet_on_windows_femtovg_wgpu.exe
106-
cargo build --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu,add_windows_icon"
116+
cargo build --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu"
107117
mv target/debug/krokiet.exe windows_krokiet_on_windows_all_backends.exe
118+
119+
Get-ChildItem windows_krokiet_on_windows_*.exe | ForEach-Object { ./rcedit-x64.exe $_.Name --set-icon krokiet/icons/krokiet_logo_flag.ico }
108120
109121
- name: Upload artifacts
110122
uses: actions/upload-artifact@v4
@@ -145,25 +157,31 @@ jobs:
145157
rustup target add x86_64-pc-windows-gnu
146158
147159
mkdir -p package
148-
mkdir -p package_with_icon_tmp
160+
curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe
149161
150162
- name: Cross compile for Windows - Release
151163
if: ${{ github.ref == 'refs/heads/master' }}
152164
run: |
153165
source "$HOME/.cargo/env"
154166
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/
155-
cargo build --target=x86_64-pc-windows-gnu --release --locked --features "add_windows_icon"
167+
cargo build --target=x86_64-pc-windows-gnu --release --locked
156168
cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe package/
157169
cp target/x86_64-pc-windows-gnu/release/czkawka_cli.exe package/
170+
171+
export WINEPREFIX=$(mktemp -d)
172+
wine rcedit-x64.exe package/czkawka_gui.exe --set-icon czkawka_gui/icons/icon.ico
158173
159174
- name: Cross compile for Windows - Debug
160175
if: ${{ github.ref != 'refs/heads/master' }}
161176
run: |
162177
source "$HOME/.cargo/env"
163178
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/
164-
cargo build --target=x86_64-pc-windows-gnu --locked --profile fastci --features "add_windows_icon"
179+
cargo build --target=x86_64-pc-windows-gnu --locked --profile fastci
165180
cp target/x86_64-pc-windows-gnu/fastci/czkawka_gui.exe package/
166181
cp target/x86_64-pc-windows-gnu/fastci/czkawka_cli.exe package/
182+
183+
export WINEPREFIX=$(mktemp -d)
184+
wine rcedit-x64.exe package/czkawka_gui.exe --set-icon czkawka_gui/icons/icon.ico
167185
168186
- name: Package
169187
run: |

Cargo.lock

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE_CC_BY_4_ICONS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Copyright (c) 2020 [jannuary](https://github.com/jannuary)
55
- data/icons/com.github.qarmin.czkawka.svg
66
- data/icons/com.github.qarmin.czkawka-symbolic.svg
77

8+
Copyright (c) 2020-2026 Rafał Mikrut
9+
- data/icons/io.github.qarmin.krokiet.svg
10+
811
License: CC-BY-4.0
912
Creative Commons Attribution 4.0 International Public License
1013
.

czkawka_gui/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ rand = "0.10.0"
4646
[target.'cfg(windows)'.dependencies]
4747
winapi = { version = "0.3.9", features = ["combaseapi", "objbase", "shobjidl_core", "windef", "winerror", "wtypesbase", "winuser"] }
4848

49-
[build-dependencies]
50-
winresource = "0.1"
51-
5249
[features]
5350
default = []
5451
heif = ["czkawka_core/heif"]
@@ -57,7 +54,6 @@ libavif = ["czkawka_core/libavif"]
5754
# Allows to use trash on Linux when using xdg-portal, needed by e.g. flatpak where normal trash access always fails
5855
# No-op on other OSes, it is slower and provides less helpful error messages
5956
xdg_portal_trash = ["czkawka_core/xdg_portal_trash"]
60-
add_windows_icon = []
6157

6258
[lints]
6359
workspace = true

czkawka_gui/build.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

krokiet/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,13 @@ rodio = { version = "0.22.0", default-features = false, features = ["playback",
5252
#slint-build = { path = "/home/rafal/test/slint/api/rs/build/"}
5353
#slint-build = { git = "https://github.com/slint-ui/slint.git" }
5454
slint-build = "1.15"
55-
winresource = "0.1"
5655

5756
[features]
5857
default = ["winit_femtovg", "winit_software"]
5958

6059
# Audio support
6160
audio = ["rodio"]
6261

63-
# Bundles windows icon into executable
64-
add_windows_icon = []
65-
6662
# Renderers
6763
skia_opengl = ["slint/renderer-skia-opengl"]
6864
skia_vulkan = ["slint/renderer-skia-vulkan"]

krokiet/build.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,4 @@ fn main() {
66
} else {
77
slint_build::compile("ui/main_window.slint").expect("Unable to compile slint file");
88
}
9-
10-
if env::var("CARGO_FEATURE_ADD_WINDOWS_ICON").is_ok()
11-
&& let Ok(target_os) = env::var("CARGO_CFG_TARGET_OS")
12-
&& target_os == "windows"
13-
{
14-
let mut res = winresource::WindowsResource::new();
15-
res.set_icon("icons/krokiet_logo_flag.ico");
16-
res.compile().expect("Unable to compile icon");
17-
}
189
}

0 commit comments

Comments
 (0)