diff --git a/build.bat b/build.bat index 08ffc6e..375a495 100644 --- a/build.bat +++ b/build.bat @@ -2,11 +2,13 @@ REM ============================================================ REM geopro build helper (Windows / MSVC + Ninja, CMake presets) REM -REM Usage: build [app | all | test | run | configure] -REM app (default) build target geopro_desktop -REM all build all targets +REM Usage: build [app | all | test | run | rebuild | configure] +REM app (default) build target geopro_desktop (incremental) +REM all build all targets (incremental) REM test build + run unit tests via ctest -REM run build + launch geopro_desktop +REM run incremental build + launch geopro_desktop +REM rebuild FORCE clean rebuild (--clean-first) + launch — use when +REM incremental seems stale / changes not showing up REM configure force re-run CMake configure (after CMakeLists changes) REM REM Requires: Visual Studio 2022/2026 (Desktop C++ workload, ships @@ -48,7 +50,8 @@ if /i "%CMD%"=="app" goto :app if /i "%CMD%"=="all" goto :all if /i "%CMD%"=="test" goto :test if /i "%CMD%"=="run" goto :run -echo [build] unknown command "%CMD%". Use: app ^| all ^| test ^| run ^| configure +if /i "%CMD%"=="rebuild" goto :rebuild +echo [build] unknown command "%CMD%". Use: app ^| all ^| test ^| run ^| rebuild ^| configure exit /b 1 :ensure @@ -80,3 +83,11 @@ call :ensure "%CMAKE%" --build "%BUILDDIR%" --target geopro_desktop || exit /b 1 "%BUILDDIR%\src\app\geopro_desktop.exe" exit /b %errorlevel% + +:rebuild +REM 强制全量重编(--clean-first 先清后编),规避 ninja 增量偶发漏编;编后启动。 +REM 注意:若 geopro_desktop 正在运行,链接会因 exe 被占用失败(LNK1104)——先关掉 app。 +call :ensure +"%CMAKE%" --build "%BUILDDIR%" --target geopro_desktop --clean-first || exit /b 1 +"%BUILDDIR%\src\app\geopro_desktop.exe" +exit /b %errorlevel%