更新:1、调整构建脚本,去除扫描模式配置项;

Signed-off-by: waiwaylee <waiwaylee@foxmail.com>
This commit is contained in:
2026-10-27 14:48:16 +08:00
parent 019af7a229
commit 76b0b460a5
18 changed files with 231 additions and 288 deletions
+6 -8
View File
@@ -3,23 +3,21 @@ rem ===========================================================================
rem CMake build script (MSVC 2022 / v143, C++17, x64)
rem
rem Usage:
rem build.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem build.bat ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem
rem Examples:
rem build.bat PHASE_SCANNING Release OFF
rem build.bat MECHANICAL_SCANNING Debug ON
rem build.bat Release OFF
rem build.bat Debug ON
rem
rem The build tree must have been configured by configure.bat first (same
rem configuration tuple):
rem build\<X256_PS^|X256_MS^>\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem configuration): build\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem
rem Encoding: keep this file ASCII-only (see msvc_env.bat).
rem ===========================================================================
setlocal
if "%~1"=="" goto :usage
if "%~2"=="" goto :usage
call "%~dp0config_paths.bat" "%~1" "%~2" "%~3"
call "%~dp0config_paths.bat" "%~1" "%~2"
if errorlevel 1 exit /b 1
rem Load the MSVC 2022 environment (vcvarsall.bat + cl.exe existence check).
@@ -40,5 +38,5 @@ popd
exit /b %CMAKE_EXIT%
:usage
echo Usage: build.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF^]
echo Usage: build.bat ^<Debug^|Release^> [AUTO^|ON^|OFF^]
exit /b 1
-49
View File
@@ -1,49 +0,0 @@
@echo off
rem ===========================================================================
rem Configure and build both scan modes for one build type / record mode.
rem
rem Usage:
rem build_all.bat ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem
rem Examples:
rem build_all.bat Release OFF
rem build_all.bat Debug ON
rem build_all.bat Release AUTO
rem
rem Runs configure.bat + build.bat for both scan modes:
rem PHASE_SCANNING -^> build\X256_PS\<Debug^|Release^>\<REC_*>
rem MECHANICAL_SCANNING -^> build\X256_MS\<Debug^|Release^>\<REC_*>
rem The run stops at the first failing configuration and returns non-zero.
rem
rem Encoding: keep this file ASCII-only (see msvc_env.bat).
rem ===========================================================================
setlocal EnableExtensions
set "BUILD_TYPE=%~1"
set "RECORD_MODE=%~2"
if not defined BUILD_TYPE goto :usage
if not defined RECORD_MODE set "RECORD_MODE=AUTO"
rem Validate + normalize the tuple once (also resolves the X256_* aliases).
call "%~dp0config_paths.bat" PHASE_SCANNING "%BUILD_TYPE%" "%RECORD_MODE%"
if errorlevel 1 exit /b 1
for %%S in (PHASE_SCANNING MECHANICAL_SCANNING) do (
echo.
echo [build_all] ==================== %%S / %BUILD_TYPE% / %RECORD_MODE% ====================
call "%~dp0configure.bat" %%S "%BUILD_TYPE%" "%RECORD_MODE%"
if errorlevel 1 goto :failed
call "%~dp0build.bat" %%S "%BUILD_TYPE%" "%RECORD_MODE%"
if errorlevel 1 goto :failed
)
echo.
echo [build_all] all done: %BUILD_TYPE% / %RECORD_MODE%
exit /b 0
:failed
echo.
echo [build_all] FAILED - stopped at the first failing configuration, see the log above
exit /b 1
:usage
echo Usage: build_all.bat ^<Debug^|Release^> [AUTO^|ON^|OFF^]
exit /b 1
+49
View File
@@ -0,0 +1,49 @@
@echo off
rem ===========================================================================
rem Configure and build one build configuration (build type + record mode).
rem
rem Usage:
rem build_config.bat ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem
rem Examples:
rem build_config.bat Release OFF
rem build_config.bat Debug ON
rem build_config.bat Release AUTO
rem
rem Runs configure.bat + build.bat for the same configuration:
rem build\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem The mechanical-scanning and phase-scanning variants are merged into one
rem build; the scan mode is a runtime config item (TOML [radar_params] scan_mode).
rem The run stops at the first failure and returns non-zero.
rem
rem Encoding: keep this file ASCII-only (see msvc_env.bat).
rem ===========================================================================
setlocal EnableExtensions
set "BUILD_TYPE=%~1"
set "RECORD_MODE=%~2"
if not defined BUILD_TYPE goto :usage
if not defined RECORD_MODE set "RECORD_MODE=AUTO"
rem Validate + normalize the configuration once.
call "%~dp0config_paths.bat" "%BUILD_TYPE%" "%RECORD_MODE%"
if errorlevel 1 exit /b 1
echo.
echo [build_config] ==================== %BUILD_TYPE% / %RECORD_MODE% ====================
call "%~dp0configure.bat" "%BUILD_TYPE%" "%RECORD_MODE%"
if errorlevel 1 goto :failed
call "%~dp0build.bat" "%BUILD_TYPE%" "%RECORD_MODE%"
if errorlevel 1 goto :failed
echo.
echo [build_config] all done: %BUILD_TYPE% / %RECORD_MODE%
exit /b 0
:failed
echo.
echo [build_config] FAILED - stopped at the first failure, see the log above
exit /b 1
:usage
echo Usage: build_config.bat ^<Debug^|Release^> [AUTO^|ON^|OFF^]
exit /b 1
+6 -7
View File
@@ -3,23 +3,22 @@ rem ===========================================================================
rem CMake clean script - remove the build output of one configuration.
rem
rem Usage:
rem clean.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem clean.bat ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem
rem Examples:
rem clean.bat PHASE_SCANNING Release OFF
rem clean.bat MECHANICAL_SCANNING Debug ON
rem clean.bat Release OFF
rem clean.bat Debug ON
rem
rem The directory removed is the same one configure.bat/build.bat use:
rem build\<X256_PS^|X256_MS^>\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem build\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem Use clean_all.bat to clean every configuration at once.
rem
rem Encoding: keep this file ASCII-only (see msvc_env.bat).
rem ===========================================================================
setlocal
if "%~1"=="" goto :usage
if "%~2"=="" goto :usage
call "%~dp0config_paths.bat" "%~1" "%~2" "%~3"
call "%~dp0config_paths.bat" "%~1" "%~2"
if errorlevel 1 exit /b 1
pushd "%~dp0..\.."
@@ -40,5 +39,5 @@ popd
exit /b 0
:usage
echo Usage: clean.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF^]
echo Usage: clean.bat ^<Debug^|Release^> [AUTO^|ON^|OFF^]
exit /b 1
+16 -14
View File
@@ -6,10 +6,10 @@ rem Usage:
rem clean_all.bat
rem
rem Build layout (see config_paths.bat):
rem build\<X256_PS^|X256_MS^>\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem build\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem
rem A legacy single-configuration build tree (build\X256_PS or build\X256_MS
rem containing CMakeCache.txt directly) is removed as a whole as well.
rem The legacy per-scan-mode roots build\X256_PS and build\X256_MS (used before
rem the mechanical/phase variants were merged) are removed as a whole as well.
rem build\output (archived package export) is never touched.
rem
rem Encoding: keep this file ASCII-only (see msvc_env.bat).
@@ -17,19 +17,21 @@ rem ===========================================================================
setlocal EnableExtensions
pushd "%~dp0..\.."
set "FAILED="
rem legacy layout: one root per scan mode (contains its own build tree directly)
for %%S in (X256_PS X256_MS) do (
if exist "build\%%S\CMakeCache.txt" (
call :remove "build\%%S"
) else (
for %%T in (Debug Release) do (
for %%R in (REC_AUTO REC_OFF REC_ON) do (
call :remove "build\%%S\%%T\%%R"
)
)
rem drop the directory root when every configuration is gone
rmdir "build\%%S" 2>nul
)
call :remove "build\%%S"
)
rem current layout: build\<Debug|Release>\<REC_*>
for %%T in (Debug Release) do (
for %%R in (REC_AUTO REC_OFF REC_ON) do (
call :remove "build\%%T\%%R"
)
rem drop the build type root when every configuration is gone
rmdir "build\%%T" 2>nul
)
echo.
echo [clean_all] archived package export "build\output" left untouched
if defined FAILED (
+13 -28
View File
@@ -3,54 +3,39 @@ rem ===========================================================================
rem Derive the build directory of one build configuration.
rem
rem Internal helper, called by configure.bat / build.bat / clean.bat /
rem build_all.bat as:
rem call config_paths.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem build_config.bat as:
rem call config_paths.bat ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem
rem Accepted aliases: X256_PS = PHASE_SCANNING, X256_MS = MECHANICAL_SCANNING.
rem The mechanical-scanning and phase-scanning variants are merged into one
rem build since V1.5.9, so a configuration is only build type + record mode.
rem The scan mode is a runtime config item (TOML [radar_params] scan_mode).
rem
rem On success the following variables are exported into the caller scope:
rem SCAN_MODE PHASE_SCANNING / MECHANICAL_SCANNING
rem SCAN_TAG X256_PS / X256_MS
rem BUILD_TYPE Debug / Release
rem RECORD_MODE AUTO / ON / OFF
rem REC_TAG REC_AUTO / REC_OFF / REC_ON
rem BUILD_DIR build\<SCAN_TAG>\<BUILD_TYPE>\<REC_TAG>
rem BUILD_DIR build\<BUILD_TYPE>\<REC_TAG>
rem
rem Exit code: 0 = ok, 1 = invalid configuration.
rem
rem Encoding: keep this file ASCII-only (see msvc_env.bat).
rem ===========================================================================
set "SCAN_MODE="
set "SCAN_TAG="
set "BUILD_TYPE="
set "RECORD_MODE="
set "REC_TAG="
set "BUILD_DIR="
if "%~1"=="" goto :usage
if "%~2"=="" goto :usage
if /i "%~1"=="PHASE_SCANNING" set "SCAN_MODE=PHASE_SCANNING"
if /i "%~1"=="X256_PS" set "SCAN_MODE=PHASE_SCANNING"
if /i "%~1"=="MECHANICAL_SCANNING" set "SCAN_MODE=MECHANICAL_SCANNING"
if /i "%~1"=="X256_MS" set "SCAN_MODE=MECHANICAL_SCANNING"
if not defined SCAN_MODE (
echo [ERROR] invalid scan mode: "%~1"
echo expected PHASE_SCANNING / X256_PS or MECHANICAL_SCANNING / X256_MS
exit /b 1
)
if "%SCAN_MODE%"=="PHASE_SCANNING" set "SCAN_TAG=X256_PS"
if "%SCAN_MODE%"=="MECHANICAL_SCANNING" set "SCAN_TAG=X256_MS"
if /i "%~2"=="Debug" set "BUILD_TYPE=Debug"
if /i "%~2"=="Release" set "BUILD_TYPE=Release"
if /i "%~1"=="Debug" set "BUILD_TYPE=Debug"
if /i "%~1"=="Release" set "BUILD_TYPE=Release"
if not defined BUILD_TYPE (
echo [ERROR] invalid build type: "%~2"
echo [ERROR] invalid build type: "%~1"
echo expected Debug or Release
exit /b 1
)
if not "%~3"=="" set "RECORD_MODE=%~3"
if not "%~2"=="" set "RECORD_MODE=%~2"
if not defined RECORD_MODE set "RECORD_MODE=AUTO"
if /i "%RECORD_MODE%"=="AUTO" set "RECORD_MODE=AUTO"
if /i "%RECORD_MODE%"=="ON" set "RECORD_MODE=ON"
@@ -59,14 +44,14 @@ if "%RECORD_MODE%"=="AUTO" set "REC_TAG=REC_AUTO"
if "%RECORD_MODE%"=="ON" set "REC_TAG=REC_ON"
if "%RECORD_MODE%"=="OFF" set "REC_TAG=REC_OFF"
if not defined REC_TAG (
echo [ERROR] invalid record mode: "%~3"
echo [ERROR] invalid record mode: "%~2"
echo expected AUTO or ON or OFF
exit /b 1
)
set "BUILD_DIR=build\%SCAN_TAG%\%BUILD_TYPE%\%REC_TAG%"
set "BUILD_DIR=build\%BUILD_TYPE%\%REC_TAG%"
exit /b 0
:usage
echo Usage: config_paths.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF^]
echo Usage: config_paths.bat ^<Debug^|Release^> [AUTO^|ON^|OFF^]
exit /b 1
+11 -12
View File
@@ -3,17 +3,18 @@ rem ===========================================================================
rem CMake configure script (MSVC 2022 / v143, C++17, x64, NMake Makefiles)
rem
rem Usage:
rem configure.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem configure.bat ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem
rem Examples:
rem configure.bat PHASE_SCANNING Release OFF
rem configure.bat MECHANICAL_SCANNING Debug ON
rem configure.bat Release OFF
rem configure.bat Debug ON
rem
rem The build directory is derived from the configuration tuple (see
rem config_paths.bat), so every configuration has its own build tree:
rem build\<X256_PS^|X256_MS^>\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem The build directory is derived from the configuration (see
rem config_paths.bat): build\<Debug^|Release^>\<REC_AUTO^|REC_OFF^|REC_ON^>
rem The mechanical-scanning and phase-scanning variants are merged into one
rem build; the scan mode is a runtime config item (TOML [radar_params] scan_mode).
rem
rem The 3rd argument selects the optional data-recording debug feature
rem The 2nd argument selects the optional data-recording debug feature
rem (CMake cache variable RDP_DATA_RECORD). When it is omitted, CMake's AUTO
rem default applies: Debug = enabled, Release = disabled.
rem See docs/data_record_debug.md.
@@ -26,13 +27,12 @@ rem Encoding: keep this file ASCII-only (see msvc_env.bat).
rem ===========================================================================
setlocal
if "%~1"=="" goto :usage
if "%~2"=="" goto :usage
call "%~dp0config_paths.bat" "%~1" "%~2" "%~3"
call "%~dp0config_paths.bat" "%~1" "%~2"
if errorlevel 1 exit /b 1
echo [configure] build dir : %BUILD_DIR%
echo [configure] settings : %SCAN_MODE% / %BUILD_TYPE% / RDP_DATA_RECORD=%RECORD_MODE%
echo [configure] settings : %BUILD_TYPE% / RDP_DATA_RECORD=%RECORD_MODE%
rem Load the MSVC 2022 environment (vcvarsall.bat + cl.exe existence check).
call "%~dp0msvc_env.bat"
@@ -56,7 +56,6 @@ if exist "%BUILD_DIR%" (
echo [configure] compiler : %MSVC_CXX_COMPILER%
cmake -S . -B "%BUILD_DIR%" -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DRADAR_SCAN_MODE=%SCAN_MODE% ^
-DRDP_DATA_RECORD=%RECORD_MODE% ^
-DCMAKE_CXX_COMPILER="%MSVC_CXX_COMPILER%"
set "CMAKE_EXIT=%errorlevel%"
@@ -71,5 +70,5 @@ popd
exit /b 0
:usage
echo Usage: configure.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF^]
echo Usage: configure.bat ^<Debug^|Release^> [AUTO^|ON^|OFF^]
exit /b 1