@echo off
setlocal

set "UV4=C:\Keil_v5\UV4\UV4.exe"
if not exist "%UV4%" set "UV4=D:\Keil_v5\UV4\UV4.exe"
if not exist "%UV4%" set "UV4=%ProgramFiles%\Keil_v5\UV4\UV4.exe"
if not exist "%UV4%" set "UV4=%ProgramFiles(x86)%\Keil_v5\UV4\UV4.exe"

if not exist "%UV4%" (
    echo Keil UV4 not found. Edit build.bat and set UV4 path.
    exit /b 1
)

pushd "%~dp0"
"%UV4%" -b QQT912_L012.uvprojx -o build.log
set "RC=%ERRORLEVEL%"
type build.log
popd
exit /b %RC%
