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

75 lines
2.6 KiB
Batchfile

@echo off
rem ===========================================================================
rem CMake configure script (MSVC 2022 / v143, C++17, x64, NMake Makefiles)
rem
rem Usage:
rem configure.bat ^<Debug^|Release^> [AUTO^|ON^|OFF]
rem
rem Examples:
rem configure.bat Release OFF
rem configure.bat Debug ON
rem
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 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.
rem
rem A build directory that was configured by an older compiler (for example
rem the MSVC 2013 cache) is removed first: neither its CMake cache nor its
rem object files can be reused across a compiler upgrade.
rem
rem Encoding: keep this file ASCII-only (see msvc_env.bat).
rem ===========================================================================
setlocal
if "%~1"=="" goto :usage
call "%~dp0config_paths.bat" "%~1" "%~2"
if errorlevel 1 exit /b 1
echo [configure] build dir : %BUILD_DIR%
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"
if errorlevel 1 exit /b 1
pushd "%~dp0..\.."
if not exist "%BUILD_DIR%\CMakeCache.txt" goto :do_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 :do_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.
popd
exit /b 1
)
:do_configure
echo [configure] compiler : %MSVC_CXX_COMPILER%
cmake -S . -B "%BUILD_DIR%" -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DRDP_DATA_RECORD=%RECORD_MODE% ^
-DCMAKE_CXX_COMPILER="%MSVC_CXX_COMPILER%"
set "CMAKE_EXIT=%errorlevel%"
if not "%CMAKE_EXIT%"=="0" (
popd
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%
popd
exit /b 0
:usage
echo Usage: configure.bat ^<Debug^|Release^> [AUTO^|ON^|OFF^]
exit /b 1