Complete C# server cutover

This commit is contained in:
Nomads_Reach
2026-08-16 02:36:32 -04:00
parent ddadf87423
commit 757e614cdd
79 changed files with 923 additions and 13129 deletions
+25 -101
View File
@@ -3,25 +3,20 @@ setlocal enabledelayedexpansion
echo.
echo ================================================================================
echo Commonwealth Online - Qt GUI Build Script (with Qt6 Auto-Detection)
echo Commonwealth Online - Qt Host and C# Server Build
echo ================================================================================
echo.
REM Check if CMake is installed
cmake --version >nul 2>&1
if errorlevel 1 (
cmake --version >nul 2>&1 || (
echo ERROR: CMake is not installed or not in PATH.
echo Please install CMake from https://cmake.org/download/
echo Then add it to your PATH and restart this script.
pause
exit /b 1
)
dotnet --version >nul 2>&1 || (
echo ERROR: .NET 8 SDK is not installed or dotnet is not in PATH.
exit /b 1
)
REM Auto-detect Qt6 installation
echo Searching for Qt6 installation...
set QT6_PATH=
REM Common Qt6 installation paths (check in order)
set PATHS_TO_CHECK[0]=C:\Qt\6.11.1\msvc2022_64
set PATHS_TO_CHECK[1]=C:\Qt\6.10.2\msvc2022_64
set PATHS_TO_CHECK[2]=C:\Qt\6.8.0\msvc2022_64
@@ -30,103 +25,32 @@ set PATHS_TO_CHECK[4]=C:\Qt\6.6.0\msvc2022_64
set PATHS_TO_CHECK[5]=C:\Qt\6.5.0\msvc2022_64
set PATHS_TO_CHECK[6]=C:\Qt\6.4.0\msvc2022_64
for /l %%i in (0,1,7) do (
if exist "!PATHS_TO_CHECK[%%i]!\lib\cmake\Qt6" (
set QT6_PATH=!PATHS_TO_CHECK[%%i]!
echo Found Qt6 at: !QT6_PATH!
goto found_qt6
)
for /l %%i in (0,1,6) do (
if exist "!PATHS_TO_CHECK[%%i]!\lib\cmake\Qt6" if "!QT6_PATH!"=="" set QT6_PATH=!PATHS_TO_CHECK[%%i]!
)
:found_qt6
if "!QT6_PATH!"=="" (
echo.
echo ERROR: Qt6 not found at common installation paths.
echo.
echo Please install Qt6 from https://www.qt.io/download-open-source
echo.
echo Common installation paths:
echo - C:\Qt\6.8.0\msvc2022_64
echo - C:\Qt\6.7.0\msvc2022_64
echo - C:\Qt\6.6.0\msvc2022_64
echo.
echo Alternatively, manually set Qt6 path by editing this script
echo or run CMake manually with:
echo cmake .. -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH="C:\path\to\Qt6"
echo.
pause
echo ERROR: Qt6 not found at standard C:\Qt paths.
exit /b 1
)
REM Create build directory
if not exist "build" (
echo.
echo Creating build directory...
mkdir build
)
echo Qt6: !QT6_PATH!
echo .NET:
dotnet --version
cd build
dotnet build server\CommonwealthOnline.Server.csproj -c Release --nologo || exit /b 1
dotnet run --project server\tests\CommonwealthOnline.Server.Tests.csproj -c Release --no-restore || exit /b 1
echo.
echo Configuring project with CMake...
echo CMake: %CMAKE_PREFIX_PATH%
echo Qt6: !QT6_PATH!
echo VS: Visual Studio 17 2022
echo.
cmake .. -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH="!QT6_PATH!"
if errorlevel 1 (
echo.
echo ERROR: CMake configuration failed.
echo.
echo Troubleshooting:
echo 1. Verify Qt6 is installed at: !QT6_PATH!
echo 2. Verify Visual Studio 2022 is installed with C++ tools
echo 3. Try running this script again
echo.
echo Manual configuration command:
echo cmake .. -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH="!QT6_PATH!"
echo.
pause
exit /b 1
)
echo.
echo Configuration successful!
echo.
echo Building project (this may take a few minutes)...
echo.
cmake --build . --config Release
if errorlevel 1 (
echo.
echo ERROR: Build failed.
echo.
echo Troubleshooting:
echo 1. Check that Visual Studio 2022 is installed
echo 2. Make sure C++ development tools are installed
echo 3. Try building again
echo.
pause
exit /b 1
)
if not exist build mkdir build
pushd build
cmake .. -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH="!QT6_PATH!" || (popd & exit /b 1)
cmake --build . --config Release || (popd & exit /b 1)
popd
echo.
echo ================================================================================
echo Build successful!
echo ================================================================================
echo.
echo Executable created at:
echo %cd%\bin\Release\CommonwealthOnlineHost.exe
echo.
echo The Python server\ folder is copied next to the exe by CMake post-build.
echo.
echo To run the application:
echo cd ..
echo start build\bin\Release\CommonwealthOnlineHost.exe
echo.
echo For a portable package, also run deploy.bat afterwards.
echo.
pause
echo Build successful
echo ================================================================================
echo Host GUI: build\bin\Release\CommonwealthOnlineHost.exe
echo CMake also published and staged the self-contained C# server beside the host.
echo Python is not required.
exit /b 0