-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.bat
More file actions
120 lines (103 loc) · 2.97 KB
/
build.bat
File metadata and controls
120 lines (103 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
@echo off
setlocal EnableDelayedExpansion
echo ========================================
echo SysProxyBar Build Script
echo ========================================
echo.
REM ========================================
REM Step 1: Read version from CMakeLists.txt
REM ========================================
echo Reading version...
for /f "tokens=3" %%V in ('type CMakeLists.txt ^| findstr /C:"project" ^| findstr /C:"VERSION"') do (
set "VERSION=%%V"
goto :version_found
)
:version_found
if "!VERSION!"=="" (
echo ERROR: Failed to read version from CMakeLists.txt
pause
exit /b 1
)
echo Version: !VERSION!
echo.
REM ========================================
REM Step 2: Detect TDM-GCC
REM ========================================
set "TDM_GCC=D:\env\Scoop\apps\tdm-gcc\10.3.0\bin"
if not exist "!TDM_GCC!\gcc.exe" (
echo ERROR: TDM-GCC not found at !TDM_GCC!
echo Please install: scoop install tdm-gcc
pause
exit /b 1
)
echo Found TDM-GCC
echo.
REM ========================================
REM Step 3: Generate Mihomo manifest
REM ========================================
echo Generating Mihomo manifest...
pixi run python tools/generate_mihomo_manifest.py
if errorlevel 1 (
echo Failed to generate Mihomo manifest!
pause
exit /b 1
)
echo.
REM ========================================
REM Step 4: Generate WebUI resources
REM ========================================
echo Generating WebUI resources...
pixi run python generate_resources.py
if errorlevel 1 (
echo Failed to generate resources!
pause
exit /b 1
)
echo.
REM ========================================
REM Step 5: Build project
REM ========================================
echo Building...
REM Use forward slashes for CMake paths
set "GCC_EXE=D:/env/Scoop/apps/tdm-gcc/10.3.0/bin/g++.exe"
set "MAKE_EXE=D:/env/Scoop/apps/tdm-gcc/10.3.0/bin/mingw32-make.exe"
set "WINDRES_EXE=D:/env/Scoop/apps/tdm-gcc/10.3.0/bin/windres.exe"
if not exist build mkdir build
cd build
if exist CMakeCache.txt del /Q CMakeCache.txt
cmake .. -G "MinGW Makefiles" -DCMAKE_CXX_COMPILER="%GCC_EXE%" -DCMAKE_MAKE_PROGRAM="%MAKE_EXE%" -DCMAKE_RC_COMPILER="%WINDRES_EXE%" -DCMAKE_BUILD_TYPE=Release
if errorlevel 1 (
echo Configuration FAILED!
cd ..
pause
exit /b 1
)
"%TDM_GCC%\mingw32-make.exe"
if errorlevel 1 (
echo Build FAILED!
cd ..
pause
exit /b 1
)
cd ..
echo Build complete!
echo.
REM ========================================
REM Step 6: Verify output
REM ========================================
set "OUTPUT_DIR=release\v!VERSION!"
if exist "!OUTPUT_DIR!\SysProxyBar.exe" (
echo.
echo ========================================
echo SUCCESS!
echo ========================================
echo Version: !VERSION!
echo Output: !OUTPUT_DIR!\SysProxyBar.exe
dir "!OUTPUT_DIR!\SysProxyBar.exe" | findstr "SysProxyBar.exe"
echo ========================================
) else (
echo ERROR: Output not found at !OUTPUT_DIR!\SysProxyBar.exe
)
echo.
endlocal
pause