From a5e4f04bd9af9f9810617f92a0b5871f461391f0 Mon Sep 17 00:00:00 2001 From: gaozheng Date: Tue, 16 Jun 2026 09:38:07 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E5=8A=A0=20rebuild=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4(--clean-first=20=E5=BC=BA=E5=88=B6=E5=85=A8=E9=87=8F?= =?UTF-8?q?=E9=87=8D=E7=BC=96+=E5=90=AF=E5=8A=A8),=E8=A7=84=E9=81=BF=20nin?= =?UTF-8?q?ja=20=E5=A2=9E=E9=87=8F=E5=81=B6=E5=8F=91=E6=BC=8F=E7=BC=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.bat | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) 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%