Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/getting-started/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ cd SPR_Client_27

| CMD 命令 | 这步干什么 |
| --- | --- |
| `start-windows.bat check` | 检查 MSYS2。看到 `MSYS2 found` 再继续。 |
| `start-windows.bat check` | 检查 MSYS2。看到 `MSYS2 found` 和 `Using UCRT64` 再继续。 |
| `start-windows.bat update` | 更新 MSYS2。遇到 `[Y/n]` 输入 `Y` 回车。 |
| `start-windows.bat setup` | 下载编译器、Qt 等依赖。遇到 `[Y/n]` 输入 `Y` 回车。看到 `Build dependencies ready` 再继续。 |
| `start-windows.bat setup` | 下载 UCRT64 版编译器、Qt 等依赖。遇到 `[Y/n]` 输入 `Y` 回车。看到 `Build dependencies ready` 再继续。 |
| `start-windows.bat build` | 编译并打开客户端。看到客户端界面就完成了。 |

- **提示 `MSYS2 not found`** — 先安装 MSYS2。装在其他盘时,先执行 `set "MSYS2_ROOT=D:\msys64"`(换成实际路径),再跑 `check`。
- **找不到 `mingw-w64-x86_64-qt6-serialport` 等包** — 这是旧脚本。Git 克隆用户先执行 `git pull --ff-only` 更新源码,ZIP 用户重新下载最新版。再从 `check` 开始。
- **更新提示要关闭所有 MSYS2 进程** — 输入 `Y` 回车,它会结束这轮更新。回到 CMD 再跑一次 `update`。CMD 如果也关了,就从文件夹地址栏重新打开。更新结束后再跑 `setup`。
- **以后怎么打开** — 默认安装路径直接双击源码根目录的 [start-windows.bat](../../start-windows.bat)。用自定义安装路径时,从设好 `MSYS2_ROOT` 的 CMD 执行 `start-windows.bat`。改了源码就再跑 `build`。

Expand Down
16 changes: 8 additions & 8 deletions scripts/portable/windows/start-from-source.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ setlocal EnableExtensions DisableDelayedExpansion

if not defined MSYS2_ROOT set "MSYS2_ROOT=C:\msys64"
set "BASH=%MSYS2_ROOT%\usr\bin\bash.exe"
set "TOOLCHAIN=%MSYS2_ROOT%\mingw64"
set "TOOLCHAIN=%MSYS2_ROOT%\ucrt64"
if not exist "%BASH%" goto missing_msys2
if not exist "%MSYS2_ROOT%\usr\bin\pacman.exe" goto missing_msys2
set "MSYSTEM=MINGW64"
set "MSYSTEM=UCRT64"
set "CHERE_INVOKING=1"

if /i "%~1"=="check" goto check
if /i "%~1"=="update" goto update
if /i "%~1"=="setup" goto setup
if /i "%~1"=="build" goto build
if not "%~1"=="" goto usage
if not exist "%~dp0..\..\..\build\windows\RoboMasterClient2025.exe" goto build
if not exist "%~dp0..\..\..\build\windows-ucrt64\RoboMasterClient2025.exe" goto build
goto launch

:check
echo MSYS2 found at "%MSYS2_ROOT%".
echo MSYS2 found at "%MSYS2_ROOT%". Using UCRT64.
exit /b 0

:update
Expand All @@ -28,7 +28,7 @@ exit /b %errorlevel%

:setup
echo Installing the compiler, Qt and other build dependencies.
set "PACKAGES=mingw-w64-x86_64-{gcc,cmake,ninja,pkgconf,qt6-base,qt6-declarative,qt6-multimedia,qt6-serialport,qt6-svg,abseil-cpp,protobuf,paho.mqtt.c,ffmpeg}"
set "PACKAGES=mingw-w64-ucrt-x86_64-{gcc,cmake,ninja,pkgconf,qt6-base,qt6-declarative,qt6-multimedia,qt6-serialport,qt6-svg,abseil-cpp,protobuf,paho.mqtt.c,ffmpeg}"
"%BASH%" --login -c "pacman -S --needed %PACKAGES% && pacman -Q %PACKAGES% > /dev/null"
if errorlevel 1 exit /b 1
echo Build dependencies ready.
Expand All @@ -39,18 +39,18 @@ echo Building the SPR client.
if not exist "%TOOLCHAIN%\bin\cmake.exe" goto missing_deps
set "PATH=%TOOLCHAIN%\bin;%PATH%"
pushd "%~dp0..\..\.." || goto failed
cmake -S . -B build/windows -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF ^
cmake -S . -B build/windows-ucrt64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF ^
-DCMAKE_C_COMPILER="%TOOLCHAIN%\bin\gcc.exe" -DCMAKE_CXX_COMPILER="%TOOLCHAIN%\bin\g++.exe" ^
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON -DCMAKE_PREFIX_PATH="%TOOLCHAIN%" -DPAHO_MQTT_ROOT="%TOOLCHAIN%"
if errorlevel 1 goto failed_in_dir
cmake --build build/windows --parallel 4
cmake --build build/windows-ucrt64 --parallel 4
if errorlevel 1 goto failed_in_dir
popd

:launch
echo Opening the SPR client.
set "PATH=%TOOLCHAIN%\bin;%PATH%"
pushd "%~dp0..\..\..\build\windows" || goto failed
pushd "%~dp0..\..\..\build\windows-ucrt64" || goto failed
if not exist "RoboMasterClient2025.exe" goto failed_in_dir
start "" ".\RoboMasterClient2025.exe"
if errorlevel 1 goto failed_in_dir
Expand Down
Loading