diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 93009e3a9..6bbef9bbd 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -25,21 +25,31 @@ jobs: rustup default 1.92.0 rustup target add x86_64-pc-windows-gnu + - name: Download rcedit + run: | + curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe + - name: Compile Krokiet Release if: ${{ github.ref == 'refs/heads/master' }} run: | sed -i 's/#lto = /lto = /g' Cargo.toml sed -i 's/#codegen-units /codegen-units /g' Cargo.toml - cargo build --release --target x86_64-pc-windows-gnu --bin krokiet --features "add_windows_icon" + cargo build --release --target x86_64-pc-windows-gnu --bin krokiet mv target/x86_64-pc-windows-gnu/release/krokiet.exe windows_krokiet_on_linux.exe + + export WINEPREFIX=$(mktemp -d) + wine rcedit-x64.exe windows_krokiet_on_linux.exe --set-icon krokiet/icons/krokiet_logo_flag.ico - name: Compile Krokiet Debug if: ${{ github.ref != 'refs/heads/master' }} run: | sed -i 's/^\(\[profile\.dev\.package.*\)/#\1/' Cargo.toml sed -i 's|^opt-level = 3 # OPT PACKAGES|#opt-level = 3 # OPT PACKAGES|' Cargo.toml - cargo build --target x86_64-pc-windows-gnu --bin krokiet --features "add_windows_icon" + cargo build --target x86_64-pc-windows-gnu --bin krokiet mv target/x86_64-pc-windows-gnu/debug/krokiet.exe windows_krokiet_on_linux.exe + + export WINEPREFIX=$(mktemp -d) + wine rcedit-x64.exe windows_krokiet_on_linux.exe --set-icon krokiet/icons/krokiet_logo_flag.ico - name: Pack with 7z run: | @@ -74,37 +84,39 @@ jobs: run: | rustup default 1.92.0 + - name: Download rcedit + run: | + curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe + - name: Compile Krokiet Release if: ${{ github.ref == 'refs/heads/master' }} run: | - # Replace '#lto = ' with 'lto = ' in Cargo.toml - powershell -Command "(Get-Content Cargo.toml) -replace '#lto = ', 'lto = ' | Set-Content Cargo.toml" - # Replace '#codegen-units ' with 'codegen-units ' in Cargo.toml - powershell -Command "(Get-Content Cargo.toml) -replace '#codegen-units ', 'codegen-units ' | Set-Content Cargo.toml" - cargo build --release --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software,add_windows_icon" + 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" + cargo build --release --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software" mv target/release/krokiet.exe windows_krokiet_on_windows_skia_opengl.exe - cargo build --release --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software,add_windows_icon" + cargo build --release --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software" mv target/release/krokiet.exe windows_krokiet_on_windows_skia_vulkan.exe - cargo build --release --bin krokiet --no-default-features --features "femtovg_wgpu,add_windows_icon" + cargo build --release --bin krokiet --no-default-features --features "femtovg_wgpu" mv target/release/krokiet.exe windows_krokiet_on_windows_femtovg_wgpu.exe - cargo build --release --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu,add_windows_icon" + cargo build --release --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu" mv target/release/krokiet.exe windows_krokiet_on_windows_all_backends.exe + Get-ChildItem windows_krokiet_on_windows_*.exe | ForEach-Object { ./rcedit-x64.exe $_.Name --set-icon krokiet/icons/krokiet_logo_flag.ico } - name: Compile Krokiet Debug if: ${{ github.ref != 'refs/heads/master' }} run: | - # Comment out '[profile.dev.package.*' lines - powershell -Command "(Get-Content Cargo.toml) -replace '^\[profile\.dev\.package.*', { '#' + \$_ } | Set-Content Cargo.toml" - # Comment out 'opt-level = 3 # OPT PACKAGES' - powershell -Command "(Get-Content Cargo.toml) -replace '^opt-level = 3 # OPT PACKAGES', '#opt-level = 3 # OPT PACKAGES' | Set-Content Cargo.toml" - cargo build --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software,add_windows_icon" + (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 + + cargo build --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software" mv target/debug/krokiet.exe windows_krokiet_on_windows_skia_opengl.exe - cargo build --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software,add_windows_icon" + cargo build --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software" mv target/debug/krokiet.exe windows_krokiet_on_windows_skia_vulkan.exe - cargo build --bin krokiet --no-default-features --features "femtovg_wgpu,add_windows_icon" + cargo build --bin krokiet --no-default-features --features "femtovg_wgpu" mv target/debug/krokiet.exe windows_krokiet_on_windows_femtovg_wgpu.exe - cargo build --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu,add_windows_icon" + cargo build --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu" mv target/debug/krokiet.exe windows_krokiet_on_windows_all_backends.exe + + Get-ChildItem windows_krokiet_on_windows_*.exe | ForEach-Object { ./rcedit-x64.exe $_.Name --set-icon krokiet/icons/krokiet_logo_flag.ico } - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -145,25 +157,31 @@ jobs: rustup target add x86_64-pc-windows-gnu mkdir -p package - mkdir -p package_with_icon_tmp + curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe - name: Cross compile for Windows - Release if: ${{ github.ref == 'refs/heads/master' }} run: | source "$HOME/.cargo/env" export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/ - cargo build --target=x86_64-pc-windows-gnu --release --locked --features "add_windows_icon" + cargo build --target=x86_64-pc-windows-gnu --release --locked cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe package/ cp target/x86_64-pc-windows-gnu/release/czkawka_cli.exe package/ + + export WINEPREFIX=$(mktemp -d) + wine rcedit-x64.exe package/czkawka_gui.exe --set-icon czkawka_gui/icons/icon.ico - name: Cross compile for Windows - Debug if: ${{ github.ref != 'refs/heads/master' }} run: | source "$HOME/.cargo/env" export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/ - cargo build --target=x86_64-pc-windows-gnu --locked --profile fastci --features "add_windows_icon" + cargo build --target=x86_64-pc-windows-gnu --locked --profile fastci cp target/x86_64-pc-windows-gnu/fastci/czkawka_gui.exe package/ cp target/x86_64-pc-windows-gnu/fastci/czkawka_cli.exe package/ + + export WINEPREFIX=$(mktemp -d) + wine rcedit-x64.exe package/czkawka_gui.exe --set-icon czkawka_gui/icons/icon.ico - name: Package run: | diff --git a/Cargo.lock b/Cargo.lock index 298593fde..476821b5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1655,7 +1655,6 @@ dependencies = [ "serde", "serde_json", "winapi", - "winresource", ] [[package]] @@ -4315,7 +4314,6 @@ dependencies = [ "serde_json", "slint", "slint-build", - "winresource", ] [[package]] @@ -9535,16 +9533,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winresource" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e287ced0f21cd11f4035fe946fd3af145f068d1acb708afd248100f89ec7432d" -dependencies = [ - "toml 0.9.12+spec-1.1.0", - "version_check", -] - [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/LICENSE_CC_BY_4_ICONS b/LICENSE_CC_BY_4_ICONS index 4a01ed640..1e819d9e4 100644 --- a/LICENSE_CC_BY_4_ICONS +++ b/LICENSE_CC_BY_4_ICONS @@ -5,6 +5,9 @@ Copyright (c) 2020 [jannuary](https://github.com/jannuary) - data/icons/com.github.qarmin.czkawka.svg - data/icons/com.github.qarmin.czkawka-symbolic.svg +Copyright (c) 2020-2026 RafaƂ Mikrut +- data/icons/io.github.qarmin.krokiet.svg + License: CC-BY-4.0 Creative Commons Attribution 4.0 International Public License . diff --git a/czkawka_gui/Cargo.toml b/czkawka_gui/Cargo.toml index ec92a4d6b..b03ab03b3 100644 --- a/czkawka_gui/Cargo.toml +++ b/czkawka_gui/Cargo.toml @@ -46,9 +46,6 @@ rand = "0.10.0" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", features = ["combaseapi", "objbase", "shobjidl_core", "windef", "winerror", "wtypesbase", "winuser"] } -[build-dependencies] -winresource = "0.1" - [features] default = [] heif = ["czkawka_core/heif"] @@ -57,7 +54,6 @@ libavif = ["czkawka_core/libavif"] # Allows to use trash on Linux when using xdg-portal, needed by e.g. flatpak where normal trash access always fails # No-op on other OSes, it is slower and provides less helpful error messages xdg_portal_trash = ["czkawka_core/xdg_portal_trash"] -add_windows_icon = [] [lints] workspace = true diff --git a/czkawka_gui/build.rs b/czkawka_gui/build.rs deleted file mode 100644 index 4d37de93c..000000000 --- a/czkawka_gui/build.rs +++ /dev/null @@ -1,12 +0,0 @@ -use std::env; - -fn main() { - if env::var("CARGO_FEATURE_ADD_WINDOWS_ICON").is_ok() - && let Ok(target_os) = env::var("CARGO_CFG_TARGET_OS") - && target_os == "windows" - { - let mut res = winresource::WindowsResource::new(); - res.set_icon("icons/icon.ico"); - res.compile().expect("Unable to compile icon"); - } -} diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index bebd160f7..2f3d2135c 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -52,7 +52,6 @@ rodio = { version = "0.22.0", default-features = false, features = ["playback", #slint-build = { path = "/home/rafal/test/slint/api/rs/build/"} #slint-build = { git = "https://github.com/slint-ui/slint.git" } slint-build = "1.15" -winresource = "0.1" [features] default = ["winit_femtovg", "winit_software"] @@ -60,9 +59,6 @@ default = ["winit_femtovg", "winit_software"] # Audio support audio = ["rodio"] -# Bundles windows icon into executable -add_windows_icon = [] - # Renderers skia_opengl = ["slint/renderer-skia-opengl"] skia_vulkan = ["slint/renderer-skia-vulkan"] diff --git a/krokiet/build.rs b/krokiet/build.rs index 7ffe3dc41..6a999c8f8 100644 --- a/krokiet/build.rs +++ b/krokiet/build.rs @@ -6,13 +6,4 @@ fn main() { } else { slint_build::compile("ui/main_window.slint").expect("Unable to compile slint file"); } - - if env::var("CARGO_FEATURE_ADD_WINDOWS_ICON").is_ok() - && let Ok(target_os) = env::var("CARGO_CFG_TARGET_OS") - && target_os == "windows" - { - let mut res = winresource::WindowsResource::new(); - res.set_icon("icons/krokiet_logo_flag.ico"); - res.compile().expect("Unable to compile icon"); - } }