106 lines
3.4 KiB
Batchfile
106 lines
3.4 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
echo.
|
|
echo ================================================================================
|
|
echo Commonwealth Online GUI - Qt6 DLL Deployment
|
|
echo ================================================================================
|
|
echo.
|
|
|
|
REM Find Qt6 installation (prefer the newest match; do not overwrite).
|
|
set QT6_PATH=
|
|
|
|
if exist "C:\Qt\6.11.1\msvc2022_64\bin" (
|
|
set QT6_PATH=C:\Qt\6.11.1\msvc2022_64
|
|
) else if exist "C:\Qt\6.10.2\msvc2022_64\bin" (
|
|
set QT6_PATH=C:\Qt\6.10.2\msvc2022_64
|
|
) else if exist "C:\Qt\6.8.0\msvc2022_64\bin" (
|
|
set QT6_PATH=C:\Qt\6.8.0\msvc2022_64
|
|
)
|
|
|
|
if "!QT6_PATH!"=="" (
|
|
echo ERROR: Could not find Qt6 installation.
|
|
echo Please ensure Qt6 is installed to one of these paths:
|
|
echo - C:\Qt\6.11.1\msvc2022_64
|
|
echo - C:\Qt\6.10.2\msvc2022_64
|
|
echo - C:\Qt\6.8.0\msvc2022_64
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Found Qt6 at: !QT6_PATH!
|
|
echo.
|
|
echo Deploying Qt6 DLLs to release directory...
|
|
echo.
|
|
|
|
set DEPLOY_DIR=%cd%\build\bin\Release
|
|
|
|
REM Required DLLs
|
|
set DLLs=^
|
|
Qt6Core.dll ^
|
|
Qt6Gui.dll ^
|
|
Qt6Widgets.dll ^
|
|
Qt6Network.dll ^
|
|
Qt6Concurrent.dll ^
|
|
Qt6DBus.dll ^
|
|
Qt6Xml.dll
|
|
|
|
REM Copy DLLs
|
|
for %%D in (%DLLs%) do (
|
|
if exist "!QT6_PATH!\bin\%%D" (
|
|
echo Copying %%D...
|
|
copy /Y "!QT6_PATH!\bin\%%D" "!DEPLOY_DIR!\%%D" >nul
|
|
) else (
|
|
echo WARNING: %%D not found (may not be required)
|
|
)
|
|
)
|
|
|
|
REM Copy plugins directory
|
|
if not exist "!DEPLOY_DIR!\plugins" mkdir "!DEPLOY_DIR!\plugins"
|
|
|
|
echo Copying Qt plugins...
|
|
xcopy /Y /Q "!QT6_PATH!\plugins\platforms" "!DEPLOY_DIR!\plugins\platforms\"
|
|
xcopy /Y /Q "!QT6_PATH!\plugins\styles" "!DEPLOY_DIR!\plugins\styles\" 2>nul
|
|
xcopy /Y /Q "!QT6_PATH!\plugins\imageformats" "!DEPLOY_DIR!\plugins\imageformats\" 2>nul
|
|
|
|
REM Stage Python relay server next to the executable (bundled from repo server\)
|
|
set SERVER_SRC=%cd%\server
|
|
set SERVER_DST=!DEPLOY_DIR!\server
|
|
set SERVER_CFG=!SERVER_DST!\commonwealth-server.json
|
|
set SERVER_CFG_BAK=%TEMP%\co-host-server-config.json
|
|
if exist "!SERVER_SRC!\consumer_server_cli.py" (
|
|
echo Copying Python server from "!SERVER_SRC!"...
|
|
if exist "!SERVER_CFG!" copy /Y "!SERVER_CFG!" "!SERVER_CFG_BAK!" >nul
|
|
if not exist "!SERVER_DST!" mkdir "!SERVER_DST!"
|
|
robocopy "!SERVER_SRC!" "!SERVER_DST!" /E /XD __pycache__ .pytest_cache /XF *.pyc /NFL /NDL /NJH /NJS /nc /ns /np
|
|
if errorlevel 8 (
|
|
echo WARNING: Failed to copy server directory from "!SERVER_SRC!"
|
|
) else (
|
|
if exist "!SERVER_CFG_BAK!" (
|
|
copy /Y "!SERVER_CFG_BAK!" "!SERVER_CFG!" >nul
|
|
del /Q "!SERVER_CFG_BAK!" >nul 2>&1
|
|
echo Preserved existing commonwealth-server.json
|
|
)
|
|
echo Server directory staged at: !SERVER_DST!
|
|
)
|
|
) else (
|
|
echo WARNING: Server source not found at "!SERVER_SRC!"
|
|
echo Expected repo-local server\consumer_server_cli.py.
|
|
echo Rebuild with CMake post-build copy, or copy server\ manually.
|
|
)
|
|
|
|
echo.
|
|
echo ================================================================================
|
|
echo Deployment Complete!
|
|
echo ================================================================================
|
|
echo.
|
|
echo Executable is now ready to run:
|
|
echo !DEPLOY_DIR!\CommonwealthOnlineHost.exe
|
|
echo.
|
|
echo You can now:
|
|
echo 1. Double-click CommonwealthOnlineHost.exe to run
|
|
echo 2. Or copy the entire Release folder to another machine
|
|
echo 3. Include all DLLs, plugins\, and server\ when distributing
|
|
echo.
|
|
pause
|