@echo off setlocal enabledelayedexpansion echo. echo ================================================================================ echo Commonwealth Online - Qt GUI Build Script (with Qt6 Auto-Detection) echo ================================================================================ echo. REM Check if CMake is installed cmake --version >nul 2>&1 if errorlevel 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 ) 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 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,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 ) ) :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 exit /b 1 ) REM Create build directory if not exist "build" ( echo. echo Creating build directory... mkdir build ) cd build 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 ) echo. echo ================================================================================ echo Build successful! echo ================================================================================ echo. echo Executable created at: echo %cd%\bin\Release\CommonwealthOnlineHost.exe echo. echo To run the application: echo cd .. echo start build\bin\Release\CommonwealthOnlineHost.exe echo. pause