新增sql连接,目前支持mysql、sqlite、oracle连接以及相关数据库操作
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
@echo off
|
||||
chcp 65001 >nul 2>&1
|
||||
title Build Omnitool (MinGW)
|
||||
|
||||
echo.
|
||||
echo ==========================================
|
||||
echo Build Omnitool (MinGW)
|
||||
echo ==========================================
|
||||
echo.
|
||||
|
||||
REM ====================== Parameters ======================
|
||||
set "CLEAN=0"
|
||||
if /I "%~1"=="clean" set "CLEAN=1"
|
||||
if /I "%~1"=="rebuild" set "CLEAN=1"
|
||||
if /I "%~1"=="-c" set "CLEAN=1"
|
||||
|
||||
REM ====================== Path Config ======================
|
||||
set "QT_PATH=D:\01.InstallInfo\InstallPath\QT\6.6.2\mingw_64"
|
||||
set "MINGW_PATH=D:\01.InstallInfo\InstallPath\QT\Tools\mingw1120_64"
|
||||
set "PROJ_ROOT=%~dp0"
|
||||
|
||||
if not exist "%QT_PATH%\bin\qmake.exe" (
|
||||
echo ERROR: Cannot find qmake.exe
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
if not exist "%MINGW_PATH%\bin\g++.exe" (
|
||||
echo ERROR: Cannot find g++.exe
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [1/6] Configuring MinGW environment...
|
||||
set "PATH=%MINGW_PATH%\bin;%QT_PATH%\bin;%PATH%"
|
||||
echo QT: %QT_PATH%
|
||||
echo MinGW: %MINGW_PATH%
|
||||
|
||||
REM ====================== Kill running program ======================
|
||||
echo.
|
||||
echo [2/6] Checking running program...
|
||||
tasklist /FI "IMAGENAME eq Omnitool.exe" 2>NUL | find /I "Omnitool.exe" >NUL 2>&1
|
||||
if not errorlevel 1 (
|
||||
echo Program is running, closing...
|
||||
taskkill /F /IM "Omnitool.exe" >nul 2>&1
|
||||
timeout /t 1 /nobreak >nul
|
||||
)
|
||||
|
||||
REM ====================== Clean (only in clean mode) ======================
|
||||
echo.
|
||||
if "%CLEAN%"=="1" (
|
||||
echo [3/6] Full clean rebuild...
|
||||
if exist "Makefile" del /Q "Makefile" 2>nul
|
||||
if exist "Makefile.Debug" del /Q "Makefile.Debug" 2>nul
|
||||
if exist "Makefile.Release" del /Q "Makefile.Release" 2>nul
|
||||
if exist ".qmake.stash" del /Q ".qmake.stash" 2>nul
|
||||
if exist "debug" rmdir /S /Q "debug" 2>nul
|
||||
if exist "release" rmdir /S /Q "release" 2>nul
|
||||
if exist "build" rmdir /S /Q "build" 2>nul
|
||||
if exist "bin\Omnitool.exe" del /Q "bin\Omnitool.exe" 2>nul
|
||||
echo Build artifacts cleaned (bin DLLs preserved)
|
||||
) else (
|
||||
echo [3/6] Incremental build (use: build.bat clean for full rebuild)
|
||||
)
|
||||
|
||||
REM ====================== qmake ======================
|
||||
echo.
|
||||
if not exist "Makefile.Release" (
|
||||
echo Running qmake...
|
||||
qmake Omnitool.pro -spec win32-g++ CONFIG+=release
|
||||
if errorlevel 1 (
|
||||
echo ERROR: qmake failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo [OK] qmake done
|
||||
) else (
|
||||
echo [OK] Makefile.Release exists, skip qmake
|
||||
)
|
||||
|
||||
REM ====================== Compile ======================
|
||||
echo.
|
||||
echo [4/6] Compiling Release...
|
||||
mingw32-make -f Makefile.Release -j%NUMBER_OF_PROCESSORS%
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo ERROR: Compilation failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo [OK] Compilation done
|
||||
|
||||
REM ====================== Dependencies ======================
|
||||
echo.
|
||||
echo [5/6] Ensuring dependencies...
|
||||
|
||||
if not exist "bin" mkdir "bin"
|
||||
|
||||
REM ---- 3rd party DLLs ----
|
||||
set "NEED_WINDEPLOYQT=0"
|
||||
|
||||
if exist "3rd\ElaWidgetTools\bin\ElaWidgetTools.dll" (
|
||||
if not exist "bin\ElaWidgetTools.dll" (
|
||||
copy /Y "3rd\ElaWidgetTools\bin\ElaWidgetTools.dll" "bin\" >nul
|
||||
echo [+] ElaWidgetTools.dll
|
||||
)
|
||||
) else (
|
||||
echo [!] WARNING: ElaWidgetTools.dll not found
|
||||
)
|
||||
|
||||
if exist "3rd\qscintilla\bin\qscintilla2_qt6.dll" (
|
||||
if not exist "bin\qscintilla2_qt6.dll" (
|
||||
copy /Y "3rd\qscintilla\bin\qscintilla2_qt6.dll" "bin\" >nul
|
||||
echo [+] qscintilla2_qt6.dll
|
||||
)
|
||||
) else (
|
||||
echo [!] WARNING: qscintilla2_qt6.dll not found
|
||||
)
|
||||
|
||||
REM ---- windeployqt (only when Qt core DLLs missing) ----
|
||||
if not exist "bin\Qt6Core.dll" set "NEED_WINDEPLOYQT=1"
|
||||
if not exist "bin\Qt6Gui.dll" set "NEED_WINDEPLOYQT=1"
|
||||
if not exist "bin\Qt6Widgets.dll" set "NEED_WINDEPLOYQT=1"
|
||||
|
||||
if "%NEED_WINDEPLOYQT%"=="1" (
|
||||
echo Running windeployqt...
|
||||
windeployqt "bin\Omnitool.exe" --release --no-translations --no-system-d3d-compiler --no-opengl-sw
|
||||
echo [OK] Qt DLLs deployed
|
||||
) else (
|
||||
echo [OK] Qt DLLs already present, skip windeployqt
|
||||
)
|
||||
|
||||
REM ---- SQL Drivers ----
|
||||
if not exist "bin\sqldrivers" mkdir "bin\sqldrivers"
|
||||
set "SQLDRV=%QT_PATH%\plugins\sqldrivers"
|
||||
if not exist "bin\sqldrivers\qsqlodbc.dll" (
|
||||
if exist "%SQLDRV%\qsqlodbc.dll" (
|
||||
copy /Y "%SQLDRV%\qsqlodbc.dll" "bin\sqldrivers\" >nul
|
||||
echo [+] sqldrivers\qsqlodbc.dll
|
||||
)
|
||||
)
|
||||
if not exist "bin\sqldrivers\qsqlite.dll" (
|
||||
if exist "%SQLDRV%\qsqlite.dll" (
|
||||
copy /Y "%SQLDRV%\qsqlite.dll" "bin\sqldrivers\" >nul
|
||||
echo [+] sqldrivers\qsqlite.dll
|
||||
)
|
||||
)
|
||||
if not exist "bin\sqldrivers\qsqlpsql.dll" (
|
||||
if exist "%SQLDRV%\qsqlpsql.dll" (
|
||||
copy /Y "%SQLDRV%\qsqlpsql.dll" "bin\sqldrivers\" >nul
|
||||
echo [+] sqldrivers\qsqlpsql.dll
|
||||
)
|
||||
)
|
||||
|
||||
REM ---- QtPrintSupport.dll ----
|
||||
if not exist "bin\Qt6PrintSupport.dll" (
|
||||
if exist "%QT_PATH%\bin\Qt6PrintSupport.dll" (
|
||||
copy /Y "%QT_PATH%\bin\Qt6PrintSupport.dll" "bin\" >nul
|
||||
echo [+] Qt6PrintSupport.dll
|
||||
)
|
||||
)
|
||||
|
||||
REM ---- Platforms plugin (critical) ----
|
||||
if not exist "bin\platforms" mkdir "bin\platforms"
|
||||
if not exist "bin\platforms\qwindows.dll" (
|
||||
if exist "%QT_PATH%\plugins\platforms\qwindows.dll" (
|
||||
copy /Y "%QT_PATH%\plugins\platforms\qwindows.dll" "bin\platforms\" >nul
|
||||
echo [+] platforms\qwindows.dll
|
||||
)
|
||||
)
|
||||
|
||||
REM ---- Styles plugin ----
|
||||
if not exist "bin\styles" mkdir "bin\styles"
|
||||
if not exist "bin\styles\qmodernwindowsstyle.dll" (
|
||||
if exist "%QT_PATH%\plugins\styles\qmodernwindowsstyle.dll" (
|
||||
copy /Y "%QT_PATH%\plugins\styles\qmodernwindowsstyle.dll" "bin\styles\" >nul
|
||||
echo [+] styles\qmodernwindowsstyle.dll
|
||||
)
|
||||
)
|
||||
|
||||
echo [OK] Dependencies checked
|
||||
|
||||
REM ====================== Resources ======================
|
||||
echo.
|
||||
echo [6/6] Copying resources...
|
||||
if not exist "bin\resources" mkdir "bin\resources"
|
||||
if exist "resources\*" xcopy /E /Y /Q "resources\*" "bin\resources\" >nul 2>&1
|
||||
echo [OK] Resources copied
|
||||
|
||||
REM ====================== Done ======================
|
||||
echo.
|
||||
echo ==========================================
|
||||
echo Build SUCCESSFUL!
|
||||
echo ==========================================
|
||||
echo.
|
||||
echo Output: bin\Omnitool.exe
|
||||
echo Tip: "build.bat clean" for full rebuild
|
||||
echo.
|
||||
pause
|
||||
Reference in New Issue
Block a user