@echo off REM Check if exactly two arguments are provided and not empty if "%~2"=="" ( echo Usage: build.bat ^ ^ exit /b 1 ) if not "%~3"=="" ( echo Usage: build.bat ^ ^ exit /b 1 ) REM Check if the config file exists set "config=%1" if not exist "%config%" ( echo Error: Config file "%config%" does not exist. exit /b 1 ) REM Check if the build directory already exists set "work_dir=%2" if exist "%work_dir%" ( echo Error: The build folder already exists. echo "%work_dir%" folder needs to be deleted before the project can be recreated. exit /b 1 ) REM Create the build directory mkdir "%work_dir%" if "%ERRORLEVEL%" neq "0" ( echo Error: Failed to create the build directory: "%work_dir%". exit /b 1 ) REM Start xsct and wait for it to finish echo Invoking project build... @REM cmd /c "cd /d %~dp0 && xsct util.tcl create_project \"%config%\" \"%work_dir%\" || exit /b %errorlevel%" xsct %~dp0util.tcl create_project "%config%" "%work_dir%" if %errorlevel% NEQ 0 ( echo Error: xsct execution failed with error code %ERRORLEVEL%. echo Please check your configurations. exit /b %ERRORLEVEL% ) exit /b 0