73 lines
2.6 KiB
Batchfile
73 lines
2.6 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_all.bat as:
|
|
rem call config_paths.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF]
|
|
rem
|
|
rem Accepted aliases: X256_PS = PHASE_SCANNING, X256_MS = MECHANICAL_SCANNING.
|
|
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
|
|
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 not defined BUILD_TYPE (
|
|
echo [ERROR] invalid build type: "%~2"
|
|
echo expected Debug or Release
|
|
exit /b 1
|
|
)
|
|
|
|
if not "%~3"=="" set "RECORD_MODE=%~3"
|
|
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: "%~3"
|
|
echo expected AUTO or ON or OFF
|
|
exit /b 1
|
|
)
|
|
|
|
set "BUILD_DIR=build\%SCAN_TAG%\%BUILD_TYPE%\%REC_TAG%"
|
|
exit /b 0
|
|
|
|
:usage
|
|
echo Usage: config_paths.bat ^<PHASE_SCANNING^|MECHANICAL_SCANNING^> ^<Debug^|Release^> [AUTO^|ON^|OFF^]
|
|
exit /b 1
|