change_code/build.bat

92 lines
2.1 KiB
Batchfile

@echo off
chcp 65001 >nul
title Build UFT30 ChangeCode
echo.
echo ==========================================
echo Building UFT30 ChangeCode
echo ==========================================
echo.
REM Set paths
set QT_PATH=D:\01.InstallInfo\InstallPath\QT\6.6.2\mingw_64
set MINGW_PATH=D:\01.InstallInfo\InstallPath\QT\Tools\mingw1120_64
REM Check if paths exist
if not exist "%QT_PATH%\bin\qmake.exe" (
echo ERROR: Cannot find qmake.exe
echo Please check QT_PATH variable
pause
exit /b 1
)
if not exist "%MINGW_PATH%\bin\mingw32-make.exe" (
echo ERROR: Cannot find mingw32-make.exe
echo Please check MINGW_PATH variable
pause
exit /b 1
)
REM Set PATH
set PATH=%QT_PATH%\bin;%MINGW_PATH%\bin;%PATH%
echo [OK] Environment configured
echo.
REM Check and close running program
echo [1/4] Checking running program...
tasklist /FI "IMAGENAME eq Uft30ChangeCode.exe" 2>NUL | find /I /N "Uft30ChangeCode.exe">NUL
if "%ERRORLEVEL%"=="0" (
echo [WARN] Program is running, closing...
taskkill /F /IM "Uft30ChangeCode.exe" >nul 2>&1
timeout /t 1 /nobreak >nul
echo [OK] Program closed
)
echo.
REM Clean old files
echo [2/4] Cleaning old build files...
if exist Makefile del /Q Makefile
if exist Makefile.Debug del /Q Makefile.Debug
if exist Makefile.Release del /Q Makefile.Release
if exist .qmake.stash del /Q .qmake.stash
if exist debug rmdir /S /Q debug 2>nul
if exist release rmdir /S /Q release 2>nul
echo [OK] Old files cleaned
echo.
REM Run qmake
echo [3/4] Running qmake...
qmake Uft30ChangeCode.pro -spec win32-g++
if errorlevel 1 (
echo ERROR: qmake failed
pause
exit /b 1
)
echo [OK] qmake done
echo.
REM Compile
echo [4/4] Compiling Debug version...
mingw32-make debug
if errorlevel 1 (
echo.
echo ERROR: Compilation failed
pause
exit /b 1
)
echo.
echo ==========================================
echo Build SUCCESSFUL!
echo ==========================================
echo.
echo Output: bin\Uft30ChangeCode.exe
echo.
if exist "bin\uf2touft3\uf2touft3.exe" (
echo [OK] uf2touft3.exe found, everything is ready!
) else (
echo [WARN] Please make sure bin\uf2touft3\uf2touft3.exe exists
)
echo.
pause