Files
radar_data_process/.vscode/scripts/config_paths.bat
T

58 lines
1.9 KiB
Batchfile

@echo off
rem ===========================================================================
rem Derive the build directory of one build configuration.
rem
rem Internal helper, called by configure.bat / build.bat / clean.bat /
rem build_config.bat as:
rem call config_paths.bat ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem
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 BUILD_TYPE Debug / Release
rem RECORD_MODE AUTO / ON / OFF
rem REC_TAG REC_AUTO / REC_OFF / REC_ON
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 "BUILD_TYPE="
set "RECORD_MODE="
set "REC_TAG="
set "BUILD_DIR="
if "%~1"=="" goto :usage
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: "%~1"
echo expected Debug or Release
exit /b 1
)
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"
if /i "%RECORD_MODE%"=="OFF" set "RECORD_MODE=OFF"
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: "%~2"
echo expected AUTO or ON or OFF
exit /b 1
)
set "BUILD_DIR=build\%BUILD_TYPE%\%REC_TAG%"
exit /b 0
:usage
echo Usage: config_paths.bat ^<Debug^|Release^> [AUTO^|ON^|OFF^]
exit /b 1