Add Qt6 setup helpers and comprehensive build instructions

- Improved build.bat with auto-detection of Qt6 installation
  - Checks common Qt6 paths automatically
  - Provides helpful error messages with paths to check
  - Works with Qt6.4 through Qt6.8

- Added check-setup.bat verification script
  - Verifies CMake, Visual Studio 2022, and Qt6 installation
  - Reports found/missing prerequisites
  - Quick setup validation before building

- Added comprehensive SETUP.md documentation
  - Quick 3-step setup guide
  - Detailed manual setup instructions
  - Qt6 download and installation steps
  - Troubleshooting for common issues
  - Manual CMake command reference
  - Environment variable setup

- Updated README.md
  - Links to SETUP.md for first-time users
  - Quick build instructions
  - Clear prerequisites with download links
  - Better organized for both quick and manual builds

Fixes CMake Qt6 detection errors by:
1. Auto-searching common Qt6 installation paths
2. Providing fallback manual build instructions
3. Detecting missing prerequisites with helpful links

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-09 20:55:44 +12:00
co-authored by Cursor
parent 911ee1aca8
commit 22bbfceeb8
4 changed files with 452 additions and 28 deletions
+79 -9
View File
@@ -3,7 +3,7 @@ setlocal enabledelayedexpansion
echo.
echo ================================================================================
echo Commonwealth Online - Qt GUI Build Script
echo Commonwealth Online - Qt GUI Build Script (with Qt6 Auto-Detection)
echo ================================================================================
echo.
@@ -12,27 +12,83 @@ 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.8.0\msvc2022_64
set PATHS_TO_CHECK[1]=C:\Qt\6.7.0\msvc2022_64
set PATHS_TO_CHECK[2]=C:\Qt\6.6.0\msvc2022_64
set PATHS_TO_CHECK[3]=C:\Qt\6.5.0\msvc2022_64
set PATHS_TO_CHECK[4]=C:\Qt\6.4.0\msvc2022_64
set PATHS_TO_CHECK[5]=C:\Qt\6.8.0\msvc2019_64
set PATHS_TO_CHECK[6]=C:\Qt\6.7.0\msvc2019_64
set PATHS_TO_CHECK[7]=C:\Qt\6.6.0\msvc2019_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 Configuring Qt6 project with CMake...
cmake .. -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH="C:\Qt\6.4.0\msvc2019_64"
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 Make sure:
echo 1. Qt6 is installed
echo 2. Visual Studio 2022 is installed
echo 3. CMAKE_PREFIX_PATH points to your Qt6 installation
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
)
@@ -40,11 +96,20 @@ if errorlevel 1 (
echo.
echo Configuration successful!
echo.
echo Building project...
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
)
@@ -54,6 +119,11 @@ echo ===========================================================================
echo Build successful!
echo ================================================================================
echo.
echo Executable: %cd%\bin\Release\CommonwealthOnlineHost.exe
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