11@ echo off
2+ setlocal enabledelayedexpansion
23:: Run as Admin check
34net session > nul 2 >& 1
45if %errorlevel% neq 0 (
@@ -10,24 +11,42 @@ if %errorlevel% neq 0 (
1011title SurfManager Launcher
1112cd /d " %~dp0 "
1213
14+ :: Get version from app/__init__.py
15+ for /f " tokens=2 delims='" %%i in ('findstr " __version__" app\__init__.py') do set VERSION = %%i
16+
17+ :: Detect architecture
18+ if " %PROCESSOR_ARCHITECTURE% " == " AMD64" (
19+ set ARCH = x64
20+ ) else if " %PROCESSOR_ARCHITECTURE% " == " ARM64" (
21+ set ARCH = arm64
22+ ) else (
23+ set ARCH = x86
24+ )
25+
1326:menu
1427cls
1528echo ============================================
16- echo SurfManager Launcher
29+ echo SurfManager Launcher
1730echo ============================================
1831echo .
1932echo [1] Run Normal Mode
2033echo [2] Run Debug Mode (show terminal)
21- echo [3] Clean Build Artifacts
22- echo [4] Exit
34+ echo .
35+ echo [3] Build Windows Stable (Release)
36+ echo [4] Build Windows Debug
37+ echo .
38+ echo [5] Clean Build Artifacts
39+ echo [6] Exit
2340echo .
2441echo ============================================
2542set /p choice = " Select option: "
2643
2744if " %choice% " == " 1" goto normal
2845if " %choice% " == " 2" goto debug
29- if " %choice% " == " 3" goto clean
30- if " %choice% " == " 4" exit /b 0
46+ if " %choice% " == " 3" goto build_stable
47+ if " %choice% " == " 4" goto build_debug
48+ if " %choice% " == " 5" goto clean
49+ if " %choice% " == " 6" exit /b 0
3150goto menu
3251
3352:setup
@@ -69,6 +88,124 @@ python app/main.py
6988pause
7089goto menu
7190
91+ :build_stable
92+ call :setup
93+ echo .
94+ echo Building SurfManager Stable (Release)...
95+ echo Architecture: !ARCH!
96+ echo Version: !VERSION!
97+ echo .
98+ pip install pyinstaller -q
99+
100+ set FILENAME = SurfManager-windows-!ARCH! -!VERSION!
101+
102+ echo Generating executable (this may take 2-3 minutes)...
103+ echo Filename: %FILENAME%
104+
105+ pyinstaller --onefile --windowed --clean --icon=" %~dp0 app/icons/app.ico" --name=" %FILENAME% " --distpath=" dist/stable" --workpath=" build/stable" --specpath=" build/stable" ^
106+ --add-data " %~dp0 app/icons/app.ico;app/icons" ^
107+ --hidden-import PyQt6.QtCore ^
108+ --hidden-import PyQt6.QtWidgets ^
109+ --hidden-import PyQt6.QtGui ^
110+ --hidden-import PyQt6.QtNetwork ^
111+ --hidden-import qtawesome ^
112+ --hidden-import psutil ^
113+ --exclude-module tkinter ^
114+ --exclude-module matplotlib ^
115+ --exclude-module numpy ^
116+ --exclude-module pandas ^
117+ --exclude-module PyQt6.QtWebEngine ^
118+ --exclude-module PyQt6.QtWebEngineWidgets ^
119+ --exclude-module PyQt6.QtQml ^
120+ --exclude-module PyQt6.QtQuick ^
121+ --exclude-module PyQt6.QtMultimedia ^
122+ --exclude-module PyQt6.QtBluetooth ^
123+ --exclude-module PyQt6.QtPositioning ^
124+ --exclude-module PyQt6.QtPrintSupport ^
125+ --exclude-module PyQt6.QtTest ^
126+ --exclude-module PyQt6.QtSql ^
127+ --exclude-module PyQt6.QtOpenGL ^
128+ --exclude-module PIL ^
129+ --exclude-module IPython ^
130+ --exclude-module pytest ^
131+ --exclude-module unittest ^
132+ --exclude-module test ^
133+ --strip ^
134+ --noupx ^
135+ app/main.py
136+
137+ if %errorlevel% equ 0 (
138+ echo .
139+ echo ✓ Build successful!
140+ echo Executable: dist\stable\%FILENAME% .exe
141+ echo .
142+ ) else (
143+ echo .
144+ echo ✗ Build failed!
145+ echo .
146+ )
147+ pause
148+ goto menu
149+
150+ :build_debug
151+ call :setup
152+ echo .
153+ echo Building SurfManager Debug...
154+ echo Architecture: !ARCH!
155+ echo Version: !VERSION!
156+ echo .
157+ pip install pyinstaller -q
158+
159+ set FILENAME = SurfManager-windows-!ARCH! -!VERSION! -debug
160+
161+ echo Generating executable with debug info...
162+ echo Filename: %FILENAME%
163+
164+ pyinstaller --onefile --console --clean --icon=" %~dp0 app/icons/app.ico" --name=" %FILENAME% " --distpath=" dist/debug" --workpath=" build/debug" --specpath=" build/debug" ^
165+ --add-data " %~dp0 app/icons/app.ico;app/icons" ^
166+ --hidden-import PyQt6.QtCore ^
167+ --hidden-import PyQt6.QtWidgets ^
168+ --hidden-import PyQt6.QtGui ^
169+ --hidden-import PyQt6.QtNetwork ^
170+ --hidden-import qtawesome ^
171+ --hidden-import psutil ^
172+ --exclude-module tkinter ^
173+ --exclude-module matplotlib ^
174+ --exclude-module numpy ^
175+ --exclude-module pandas ^
176+ --exclude-module PyQt6.QtWebEngine ^
177+ --exclude-module PyQt6.QtWebEngineWidgets ^
178+ --exclude-module PyQt6.QtQml ^
179+ --exclude-module PyQt6.QtQuick ^
180+ --exclude-module PyQt6.QtMultimedia ^
181+ --exclude-module PyQt6.QtBluetooth ^
182+ --exclude-module PyQt6.QtPositioning ^
183+ --exclude-module PyQt6.QtPrintSupport ^
184+ --exclude-module PyQt6.QtTest ^
185+ --exclude-module PyQt6.QtSql ^
186+ --exclude-module PyQt6.QtOpenGL ^
187+ --exclude-module PIL ^
188+ --exclude-module IPython ^
189+ --exclude-module pytest ^
190+ --exclude-module unittest ^
191+ --exclude-module test ^
192+ --debug all ^
193+ --noupx ^
194+ app/main.py
195+
196+ if %errorlevel% equ 0 (
197+ echo .
198+ echo ✓ Build successful!
199+ echo Executable: dist\debug\%FILENAME% .exe
200+ echo .
201+ ) else (
202+ echo .
203+ echo ✗ Build failed!
204+ echo .
205+ )
206+ pause
207+ goto menu
208+
72209:clean
73210echo .
74211echo Cleaning build artifacts...
0 commit comments