Skip to content

Commit cc5464a

Browse files
authored
Switch from ImGui to Qt (GUI App) (#5)
* Switch from ImGui to Qt * update Cargo.lock * Install Qt in GitHub actions * Use LTS version instead of latest * Fix build workflow * Fix build workflow * Fix Windows GUI build * Fix Windows GUI build (again) * Remove ARM Windows GUI build and fix Linux GUI build * Update prefix key of rust cache * Remove unused SQL drivers that cause ldd failures * Reduce size of builds * Reduce size of builds * Fix Deploy Qt Dependencies (Linux) * Fix Deploy Qt Dependencies (Linux) * Remove maximum and minimum window sizes * Reduce size of Deploy Qt Dependencies (Linux) build * Fix Deploy Qt Dependencies (Linux) build * Improve macOS and linux Qt builds * Remove invalid arguments for Deploy Qt Dependencies (macOS) * Update build script and use portals for file picking * Use system colors * Reformat QML file and use system colors * Rename `packobf_gui.app` to `PackOBF-GUI.app` for macOS build and put license file in the .app folder instead of the ZIP file.
1 parent 4730520 commit cc5464a

7 files changed

Lines changed: 1345 additions & 2592 deletions

File tree

.github/workflows/build.yml

Lines changed: 106 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,31 @@ jobs:
5555
matrix:
5656
include:
5757
# Linux x64 GNU
58-
- os: ubuntu-latest
58+
- os: ubuntu-22.04 # using an older version of Ubuntu for linuxdeployqt
5959
target: x86_64-unknown-linux-gnu
6060
artifact: linux-x86_64
6161
cli: packobf_cli
6262
gui: packobf_gui
6363
java-lib: librust.so
64+
qt-arch: linux_gcc_64
6465

6566
# Linux x64 MUSL
6667
- os: ubuntu-latest
6768
target: x86_64-unknown-linux-musl
6869
artifact: linux-x86_64-musl
6970
cli: packobf_cli
70-
gui: packobf_gui
71+
gui: ""
7172
java-lib: librust.so
73+
qt-arch: ""
7274

7375
# Linux ARM64
74-
- os: ubuntu-latest
76+
- os: ubuntu-22.04 # using an older version of Ubuntu for linuxdeployqt
7577
target: aarch64-unknown-linux-gnu
7678
artifact: linux-aarch64
7779
cli: packobf_cli
78-
gui: packobf_gui
80+
gui: ""
7981
java-lib: librust.so
82+
qt-arch: ""
8083

8184
# macOS Intel
8285
- os: macos-latest
@@ -85,6 +88,7 @@ jobs:
8588
cli: packobf_cli
8689
gui: packobf_gui
8790
java-lib: librust.dylib
91+
qt-arch: clang_64
8892

8993
# macOS Apple Silicon
9094
- os: macos-latest
@@ -93,6 +97,7 @@ jobs:
9397
cli: packobf_cli
9498
gui: packobf_gui
9599
java-lib: librust.dylib
100+
qt-arch: clang_64
96101

97102
# Windows x64
98103
- os: windows-latest
@@ -101,80 +106,170 @@ jobs:
101106
cli: packobf_cli.exe
102107
gui: packobf_gui.exe
103108
java-lib: rust.dll
109+
qt-arch: win64_msvc2022_64
104110

105111
# Windows ARM64
106112
- os: windows-latest
107113
target: aarch64-pc-windows-msvc
108114
artifact: windows-aarch64
109115
cli: packobf_cli.exe
110-
gui: packobf_gui.exe
116+
gui: ""
111117
java-lib: rust.dll
118+
qt-arch: ""
112119
steps:
113120
- name: Checkout sources
114121
uses: actions/checkout@v4
122+
115123
- name: Install Rust
116124
uses: dtolnay/rust-toolchain@stable
117125
with:
118126
toolchain: stable
119127
targets: ${{ matrix.target }}
128+
120129
- name: Rust Cache
121130
uses: Swatinem/rust-cache@v2
122-
- name: Install cargo-about
123-
uses: taiki-e/install-action@v2
124131
with:
125-
tool: cargo-about
132+
prefix-key: "v1-rust-qt-6.8.3-${{ matrix.os }}-${{ matrix.target }}"
133+
134+
- name: Install Qt
135+
if: matrix.gui != ''
136+
uses: jurplel/install-qt-action@v4
137+
with:
138+
version: '6.8.3'
139+
arch: ${{ matrix.qt-arch }}
140+
126141
- name: Install cross (linux-x86_64-musl and linux-aarch64)
127142
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'x86_64-unknown-linux-musl'
128143
uses: taiki-e/install-action@v2
129144
with:
130145
tool: cross
146+
131147
- name: Build
132-
if: matrix.target != 'aarch64-unknown-linux-gnu' && matrix.target != 'x86_64-unknown-linux-musl'
148+
if: matrix.target != 'aarch64-unknown-linux-gnu' && matrix.target != 'x86_64-unknown-linux-musl' && matrix.target != 'aarch64-pc-windows-msvc'
133149
run: cargo build --release --target ${{ matrix.target }}
150+
134151
- name: Build (linux-aarch64)
135152
if: matrix.target == 'aarch64-unknown-linux-gnu'
136-
run: cross build --release --target ${{ matrix.target }}
153+
run: cross build --release --target ${{ matrix.target }} -p packobf_cli -p rust
154+
137155
- name: Build (linux-x86_64-musl)
138156
if: matrix.target == 'x86_64-unknown-linux-musl'
139-
run: cross build --release --target ${{ matrix.target }} -p packobf_cli -p packobf_gui
157+
run: cross build --release --target ${{ matrix.target }} -p packobf_cli
158+
159+
- name: Build (aarch64-pc-windows-msvc)
160+
if: matrix.target == 'aarch64-pc-windows-msvc'
161+
run: cargo build --release --target ${{ matrix.target }} -p packobf_cli -p rust
162+
140163
- name: Download LICENSE.md
141164
uses: actions/download-artifact@v4
142165
with:
143166
name: generated-license
167+
144168
- name: Prepare CLI Executable
145169
# Always make sure files that are published contain the license files
146170
run: |
147171
rm -rf dist && mkdir -p dist
148172
cp target/${{ matrix.target }}/release/${{ matrix.cli }} dist/
149173
cp LICENSE.md dist/
174+
150175
- name: Upload CLI Executable
151176
uses: actions/upload-artifact@v4
152177
with:
153178
name: cli-${{ matrix.artifact }}
154179
path: dist/*
180+
155181
- name: Prepare GUI Executable
182+
if: matrix.gui != ''
156183
# Always make sure files that are published contain the license files
157184
run: |
158185
rm -rf dist && mkdir -p dist
159186
cp target/${{ matrix.target }}/release/${{ matrix.gui }} dist/
160187
cp LICENSE.md dist/
188+
189+
- name: Deploy Qt Dependencies (Windows)
190+
if: runner.os == 'Windows' && matrix.gui != ''
191+
run: |
192+
windeployqt --qmldir packobf_gui --no-translations --no-opengl-sw --no-system-d3d-compiler --no-compiler-runtime dist/${{ matrix.gui }}
193+
194+
cp /c/Windows/System32/msvcp140.dll dist/
195+
cp /c/Windows/System32/vcruntime140.dll dist/
196+
cp /c/Windows/System32/msvcp140_1.dll dist/
197+
cp /c/Windows/System32/msvcp140_2.dll dist/
198+
cp /c/Windows/System32/vcruntime140_1.dll dist/
199+
200+
# Removing all unused DLLs
201+
rm -rf dist/generic dist/iconengines dist/imageformats dist/networkinformation dist/qmltooling dist/tls dist/Qt6LabsFolderListModel.dll dist/Qt6QuickControls2BasicStyleImpl.dll dist/Qt6QuickControls2FluentWinUI3StyleImpl.dll dist/Qt6QuickControls2Imagine.dll dist/Qt6QuickControls2ImagineStyleImpl.dll dist/Qt6QuickControls2Material.dll dist/Qt6QuickControls2MaterialStyleImpl.dll dist/Qt6QuickControls2Universal.dll dist/Qt6QuickControls2UniversalStyleImpl.dll dist/Qt6QuickControls2WindowsStyleImpl.dll dist/Qt6QuickEffects.dll dist/Qt6QuickShapes.dll dist/Qt6Svg.dll
202+
203+
- name: Deploy Qt Dependencies (macOS)
204+
if: runner.os == 'macOS' && matrix.gui != ''
205+
run: |
206+
mkdir -p dist/PackOBF\ GUI.app/Contents/MacOS
207+
cp dist/${{ matrix.gui }} dist/PackOBF\ GUI.app/Contents/MacOS/PackOBF\ GUI
208+
209+
mkdir -p dist/PackOBF\ GUI.app/Contents/Resources
210+
mv dist/LICENSE.md dist/PackOBF\ GUI.app/Contents/Resources/
211+
212+
cd dist
213+
macdeployqt PackOBF\ GUI.app -dmg -qmldir=../packobf_gui
214+
cd ..
215+
216+
rm -rf dist/PackOBF\ GUI.app
217+
rm -f dist/${{ matrix.gui }}
218+
219+
- name: Deploy Qt Dependencies (Linux)
220+
if: runner.os == 'Linux' && matrix.gui != ''
221+
run: |
222+
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
223+
chmod +x linuxdeployqt-continuous-x86_64.AppImage
224+
225+
# Cleanup Qt installation
226+
rm -rf ../Qt/6.8.3/gcc_64/plugins/printsupport
227+
rm -rf ../Qt/6.8.3/gcc_64/plugins/sqldrivers
228+
rm -rf ../Qt/6.8.3/gcc_64/plugins/help
229+
rm -rf ../Qt/6.8.3/gcc_64/plugins/designer
230+
rm -rf ../Qt/6.8.3/gcc_64/plugins/qmltooling
231+
rm -rf ../Qt/6.8.3/gcc_64/plugins/qmlls
232+
rm -rf ../Qt/6.8.3/gcc_64/plugins/qmllint
233+
rm -rf ../Qt/6.8.3/gcc_64/plugins/platformthemes/libqgtk3.so
234+
235+
cat <<EOF > dist/packobf_gui.desktop
236+
[Desktop Entry]
237+
Type=Application
238+
Name=packobf
239+
Exec=packobf_gui
240+
Icon=packobf_gui
241+
Categories=Utility;
242+
EOF
243+
touch dist/packobf_gui.png
244+
245+
export APPIMAGE_EXTRACT_AND_RUN=1
246+
./linuxdeployqt-continuous-x86_64.AppImage dist/${{ matrix.gui }} -appimage -qmldir=packobf_gui -no-translations -exclude-libs=networkinformation,qmltooling,tls -extra-plugins=platformthemes/libqxdgdesktopportal.so
247+
248+
# The AppImage will already contain the license file
249+
rm -rf dist && mkdir -p dist
250+
mv packobf-*.AppImage dist/packobf-gui-${{ matrix.artifact }}.AppImage
251+
161252
- name: Upload GUI Executable
253+
if: matrix.gui != ''
162254
uses: actions/upload-artifact@v4
163255
with:
164256
name: gui-${{ matrix.artifact }}
165257
path: dist/*
258+
166259
- name: Prepare Java Native Library
167260
if: matrix.target != 'x86_64-unknown-linux-musl'
168261
run: |
169262
rm -rf dist && mkdir -p dist
170263
cp target/${{ matrix.target }}/release/${{ matrix.java-lib }} dist/
171264
cp LICENSE.md dist/
265+
172266
- name: Upload Java Native Library
173267
if: matrix.target != 'x86_64-unknown-linux-musl'
174268
uses: actions/upload-artifact@v4
175269
with:
176270
name: java-lib-${{ matrix.artifact }}
177271
path: dist/*
272+
178273
buildJava:
179274
name: Build Java Library
180275
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)