Files
Commonwealth-Online-Server/build.bat
T

56 lines
1.9 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
echo.
echo ================================================================================
echo Commonwealth Online - Qt Host and C# Server Build
echo ================================================================================
echo.
cmake --version >nul 2>&1 || (
echo ERROR: CMake is not installed or not in PATH.
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
)
set QT6_PATH=
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
set PATHS_TO_CHECK[3]=C:\Qt\6.7.0\msvc2022_64
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,6) do (
if exist "!PATHS_TO_CHECK[%%i]!\lib\cmake\Qt6" if "!QT6_PATH!"=="" set QT6_PATH=!PATHS_TO_CHECK[%%i]!
)
if "!QT6_PATH!"=="" (
echo ERROR: Qt6 not found at standard C:\Qt paths.
exit /b 1
)
echo Qt6: !QT6_PATH!
echo .NET:
dotnet --version
dotnet build server\CommonwealthOnline.Server.csproj -c Release --nologo || exit /b 1
dotnet run --project server\tests\CommonwealthOnline.Server.Tests.csproj -c Release || 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 Host GUI: build\bin\Release\CommonwealthOnlineHost.exe
echo CMake also published and staged the self-contained C# server beside the host.
exit /b 0