Skip to content

Commit d2610b3

Browse files
authored
Merge pull request #74 from MAGICGrants/windows
Windows build
2 parents aac3045 + ed99699 commit d2610b3

File tree

19 files changed

+245
-14
lines changed

19 files changed

+245
-14
lines changed

.github/workflows/build-monero-c.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,33 @@ jobs:
108108
name: armv7a-linux-androideabi
109109
path: artifacts/libmonero_libwallet2_api_c.so
110110

111+
build-x86_64-w64-mingw32:
112+
name: Build x86_64-w64-mingw32
113+
runs-on: ubuntu-latest
114+
container:
115+
image: debian:bookworm
116+
steps:
117+
- name: Checkout repository
118+
uses: actions/checkout@v4
119+
120+
- name: Build monero_c
121+
env:
122+
TARGET_ARCH: x86_64-w64-mingw32
123+
run: scripts/build-moneroc.sh
124+
125+
- name: Copy built libraries
126+
run: |
127+
mkdir -p artifacts
128+
cp monero_c/monero_libwallet2_api_c/build/x86_64-w64-mingw32/libwallet2_api_c.dll artifacts/monero_libwallet2_api_c.dll
129+
cp monero_c/release/monero/x86_64-w64-mingw32_libwinpthread-1.dll artifacts/libwinpthread-1.dll
130+
cp monero_c/release/monero/x86_64-w64-mingw32_libssp-0.dll artifacts/libssp-0.dll
131+
132+
- name: Upload artifact
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: x86_64-w64-mingw32
136+
path: artifacts/
137+
111138
build-ios-targets:
112139
name: Build ${{ matrix.target }}
113140
runs-on: macos-15
@@ -232,6 +259,7 @@ jobs:
232259
- build-x86_64-linux-android
233260
- build-aarch64-linux-android
234261
- build-armv7a-linux-androideabi
262+
- build-x86_64-w64-mingw32
235263
- create-ios-xcframework
236264
steps:
237265
- name: Checkout repository
@@ -267,6 +295,12 @@ jobs:
267295
name: MoneroWallet-xcframework
268296
path: artifacts/MoneroWallet.xcframework
269297

298+
- name: Download x86_64-w64-mingw32 artifact
299+
uses: actions/download-artifact@v4
300+
with:
301+
name: x86_64-w64-mingw32
302+
path: artifacts/x86_64-w64-mingw32
303+
270304
- name: Place libraries in correct locations
271305
run: |
272306
# Linux x86_64
@@ -285,6 +319,11 @@ jobs:
285319
rm -rf ios/Frameworks/MoneroWallet.xcframework
286320
cp -R artifacts/MoneroWallet.xcframework ios/Frameworks/MoneroWallet.xcframework
287321
322+
# Windows x86_64
323+
cp artifacts/x86_64-w64-mingw32/monero_libwallet2_api_c.dll windows/monero_libwallet2_api_c.dll
324+
cp artifacts/x86_64-w64-mingw32/libwinpthread-1.dll windows/libwinpthread-1.dll
325+
cp artifacts/x86_64-w64-mingw32/libssp-0.dll windows/libssp-0.dll
326+
288327
- name: Fix Linux library executable stack
289328
run: scripts/fix-linux-moneroc-execstack.sh
290329

@@ -309,6 +348,9 @@ jobs:
309348
- `android/app/src/main/jniLibs/x86_64/libmonero_libwallet2_api_c.so` (x86_64-linux-android)
310349
- `android/app/src/main/jniLibs/arm64-v8a/libmonero_libwallet2_api_c.so` (aarch64-linux-android)
311350
- `android/app/src/main/jniLibs/armeabi-v7a/libmonero_libwallet2_api_c.so` (armv7a-linux-androideabi)
351+
- `windows/monero_libwallet2_api_c.dll` (x86_64-w64-mingw32)
352+
- `windows/libwinpthread-1.dll` (x86_64-w64-mingw32)
353+
- `windows/libssp-0.dll` (x86_64-w64-mingw32)
312354
- `ios/Frameworks/MoneroWallet.xcframework` (aarch64-apple-ios + aarch64-apple-iossimulator)
313355
314356
Built from [monero_c](https://github.com/vtnerd/monero_c) branch `lwsf`.

.github/workflows/release.yml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and Release
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
77
workflow_dispatch:
88

99
permissions:
@@ -114,6 +114,43 @@ jobs:
114114
dist/*.deb
115115
dist/*.AppImage
116116
117+
build-windows:
118+
name: Windows (x64)
119+
runs-on: windows-latest
120+
environment: Release
121+
needs: version
122+
steps:
123+
- name: Checkout repository
124+
uses: actions/checkout@v4
125+
with:
126+
submodules: recursive
127+
128+
- name: Set up Flutter
129+
uses: subosito/flutter-action@v2
130+
with:
131+
channel: stable
132+
flutter-version: 3.38.7
133+
134+
- name: Install dependencies
135+
run: flutter pub get
136+
137+
- name: Install Inno Setup and Rust
138+
run: choco install innosetup rust -y
139+
140+
- name: Build Windows release
141+
run: flutter build windows --release
142+
143+
- name: Create installer
144+
run: |
145+
$version = '${{ needs.version.outputs.version }}'.TrimStart('v')
146+
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /DAppVersion=$version windows\installer.iss
147+
148+
- name: Upload artifacts
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: windows-x64
152+
path: windows/Output/*.exe
153+
117154
release:
118155
name: Sign + Release
119156
runs-on: ubuntu-latest
@@ -122,6 +159,7 @@ jobs:
122159
- version
123160
- build-android
124161
- build-linux-x86_64
162+
- build-windows
125163
permissions:
126164
contents: write
127165
steps:
@@ -144,7 +182,7 @@ jobs:
144182
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
145183
run: |
146184
set -euo pipefail
147-
find dist -type f \( -name "*.apk" -o -name "*.aab" -o -name "*.deb" -o -name "*.AppImage" \) -print0 | while IFS= read -r -d '' file; do
185+
find dist -type f \( -name "*.apk" -o -name "*.aab" -o -name "*.deb" -o -name "*.AppImage" -o -name "*.exe" \) -print0 | while IFS= read -r -d '' file; do
148186
echo "$GPG_PASSPHRASE" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor "$file"
149187
echo "Signed: $file"
150188
done
@@ -168,5 +206,7 @@ jobs:
168206
dist/**/*.deb.asc
169207
dist/**/*.AppImage
170208
dist/**/*.AppImage.asc
209+
dist/**/*.exe
210+
dist/**/*.exe.asc
171211
env:
172212
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

assets/app_icon.ico

1.45 KB
Binary file not shown.

lib/main.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ void main() async {
6565

6666
if (Platform.isLinux) {
6767
await createAppDir();
68+
NotificationService().init();
69+
}
70+
71+
if (Platform.isWindows) {
72+
NotificationService().init();
6873
}
6974

7075
if (Platform.isAndroid) {

lib/screens/settings.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,13 +470,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
470470
),
471471
],
472472
),
473-
Row(
474-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
475-
children: [
476-
Text(i18n.settingsAppLockLabel, style: TextStyle(fontSize: 18)),
477-
Switch(value: _appLockEnabled, onChanged: _setAppLockEnabled),
478-
],
479-
),
473+
if (Platform.isAndroid || Platform.isIOS)
474+
Row(
475+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
476+
children: [
477+
Text(i18n.settingsAppLockLabel, style: TextStyle(fontSize: 18)),
478+
Switch(value: _appLockEnabled, onChanged: _setAppLockEnabled),
479+
],
480+
),
480481
if (Platform.isAndroid)
481482
Row(
482483
mainAxisAlignment: MainAxisAlignment.spaceBetween,

lib/services/notifications_service.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:io';
22
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
3+
import 'package:path/path.dart' as p;
34

45
class NotificationService {
56
final notificationsPlugin = FlutterLocalNotificationsPlugin();
@@ -14,10 +15,21 @@ class NotificationService {
1415
);
1516
const initSettingsLinux = LinuxInitializationSettings(defaultActionName: 'Open wallet');
1617

17-
const initSettings = InitializationSettings(
18+
// Windows requires an absolute path to an .ico file
19+
final initSettingsWindows = WindowsInitializationSettings(
20+
appName: 'Skylight Wallet',
21+
appUserModelId: 'org.magicgrants.skylight',
22+
guid: '6dcf17a9-fb5f-4f47-b0b9-6d655e90adbf',
23+
iconPath: Platform.isWindows
24+
? p.join(p.dirname(Platform.resolvedExecutable), 'data', 'flutter_assets', 'assets', 'app_icon.ico')
25+
: null,
26+
);
27+
28+
final initSettings = InitializationSettings(
1829
android: initSettingsAndroid,
1930
iOS: initSettingsIOS,
2031
linux: initSettingsLinux,
32+
windows: initSettingsWindows,
2133
);
2234

2335
await notificationsPlugin.initialize(initSettings);

lib/util/dirs.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ Future<Directory> getAppDir() async {
4949
} else {
5050
throw Exception('HOME environment variable is not set');
5151
}
52+
} else if (Platform.isWindows) {
53+
final appData = Platform.environment['APPDATA'];
54+
55+
if (appData != null) {
56+
appDir = Directory('$appData/MAGIC Grants/Skylight Wallet');
57+
} else {
58+
throw Exception('APPDATA environment variable is not set');
59+
}
5260
}
5361

5462
return appDir;

pubspec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ environment:
2424
flutter_launcher_icons:
2525
android: true
2626
ios: true
27+
windows:
28+
generate: true
29+
image_path: "assets/launcher_icon.png"
30+
icon_size: 48
2731
image_path: "assets/launcher_icon.png"
2832
adaptive_icon_background: "#263F5F"
2933
adaptive_icon_foreground: "assets/launcher_icon.png"
@@ -111,6 +115,7 @@ flutter:
111115
assets:
112116
- assets/icons/
113117
- assets/cacert.pem
118+
- assets/app_icon.ico
114119

115120
# An image asset can refer to one or more resolution-specific "variants", see
116121
# https://flutter.dev/to/resolution-aware-images

scripts/build-moneroc.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ apt upgrade -y
66
apt install -y build-essential pkg-config autoconf libtool ccache make cmake gcc g++ git curl \
77
lbzip2 libtinfo5 gperf unzip python-is-python3 llvm gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
88

9+
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
10+
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
11+
912
git config --global --add safe.directory '*'
1013
git config --global user.email "info@magicgrants.org"
1114
git config --global user.name "MAGIC Grants"

windows/CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ function(APPLY_STANDARD_SETTINGS TARGET)
4343
target_compile_options(${TARGET} PRIVATE /EHsc)
4444
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
4545
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
46-
target_compile_options(${TARGET} PRIVATE -Wno-deprecated)
4746
endfunction()
4847

4948
# Flutter library and tool build rules.
@@ -94,6 +93,24 @@ install(DIRECTORY "${NATIVE_ASSETS_DIR}"
9493
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
9594
COMPONENT Runtime)
9695

96+
# Install monero_libwallet2_api_c.dll and its MinGW runtime dependencies
97+
set(MONERO_LIB "${CMAKE_CURRENT_SOURCE_DIR}/monero_libwallet2_api_c.dll")
98+
if(EXISTS "${MONERO_LIB}")
99+
install(FILES "${MONERO_LIB}"
100+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
101+
COMPONENT Runtime)
102+
endif()
103+
104+
# MinGW runtime DLLs required by monero_libwallet2_api_c.dll
105+
foreach(MINGW_DLL libwinpthread-1.dll libssp-0.dll)
106+
set(MINGW_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${MINGW_DLL}")
107+
if(EXISTS "${MINGW_DLL_PATH}")
108+
install(FILES "${MINGW_DLL_PATH}"
109+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
110+
COMPONENT Runtime)
111+
endif()
112+
endforeach()
113+
97114
# Fully re-copy the assets directory on each build to avoid having stale files
98115
# from a previous install.
99116
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")

0 commit comments

Comments
 (0)