更新:1、升级编译器版本至MSVC2022,升级C++至C++17;

Signed-off-by: waiwaylee <waiwaylee@foxmail.com>
This commit is contained in:
2026-09-29 11:00:43 +08:00
parent 2934e3b59b
commit ff9b111d34
16 changed files with 270 additions and 77 deletions
+45 -3
View File
@@ -1,4 +1,19 @@
@echo off
rem ===========================================================================
rem CMake configure script (MSVC 2022 / v143, C++17, x64)
rem
rem Usage: configure.bat <build-dir> <PHASE_SCANNING^|MECHANICAL_SCANNING> [Debug^|Release]
rem e.g. configure.bat build\X256_PS PHASE_SCANNING Release
rem
rem The generator stays "NMake Makefiles" (the choice made during the VS Code
rem migration); cl.exe is pinned to the MSVC 2022 x64 toolset.
rem
rem A build directory that was configured by an older compiler (for example the
rem MSVC 2013 cache) is removed first: neither its CMake cache nor its object
rem files can be reused across a compiler upgrade.
rem
rem Encoding: keep this file ASCII-only (see msvc_env.bat).
rem ===========================================================================
setlocal
set "BUILD_DIR=%~1"
set "SCAN_MODE=%~2"
@@ -12,10 +27,37 @@ if "%SCAN_MODE%"=="" (
exit /b 1
)
if "%BUILD_TYPE%"=="" set "BUILD_TYPE=Release"
call D:\APP\VisualStudio2013\VC\vcvarsall.bat x86 >nul
rem Load the MSVC 2022 environment (vcvarsall.bat + cl.exe existence check).
call "%~dp0msvc_env.bat"
if errorlevel 1 exit /b %errorlevel%
rem Drop a build tree left behind by another toolset.
if not exist "%BUILD_DIR%\CMakeCache.txt" goto :configure
set "OLD_TOOLSET="
if exist "%BUILD_DIR%\.msvc_toolset" set /p OLD_TOOLSET=<"%BUILD_DIR%\.msvc_toolset"
if /i "%OLD_TOOLSET%"=="%MSVC_TOOLSET_VERSION%" goto :configure
echo [configure] "%BUILD_DIR%" was configured with MSVC toolset "%OLD_TOOLSET%" - rebuilding from scratch
rmdir /s /q "%BUILD_DIR%"
if exist "%BUILD_DIR%" (
echo [ERROR] cannot remove "%BUILD_DIR%", please delete it manually and retry.
exit /b 1
)
:configure
echo [configure] compiler : %MSVC_CXX_COMPILER%
echo [configure] build dir: %BUILD_DIR%
echo [configure] mode : %SCAN_MODE% / %BUILD_TYPE%
pushd "%~dp0..\.."
cmake -S . -B "%BUILD_DIR%" -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DRADAR_SCAN_MODE=%SCAN_MODE%
cmake -S . -B "%BUILD_DIR%" -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DRADAR_SCAN_MODE=%SCAN_MODE% ^
-DCMAKE_CXX_COMPILER="%MSVC_CXX_COMPILER%"
set "CMAKE_EXIT=%errorlevel%"
popd
exit /b %CMAKE_EXIT%
if not "%CMAKE_EXIT%"=="0" exit /b %CMAKE_EXIT%
rem Remember which toolset produced this build tree (checked on the next run).
> "%BUILD_DIR%\.msvc_toolset" echo %MSVC_TOOLSET_VERSION%
exit /b 0