@echo off
rem -----------------------------------------------------------
rem Setup C::B root folder (%DEVEL%, %CB_32%) of *binaries* (!)
rem -----------------------------------------------------------
call DevelFolder.bat WinLibs 13.2.0
rem -------------------------------------------
rem Usually below here no changes are required.
rem -------------------------------------------
set OLD_PATH=%PATH%
set CB_PARAMS=--multiple-instance --batch-build-notify --no-batch-window-close
set CB_CMD=--clean "%~dp0FitBio.workspace"
REM Check if 64bit clean only is requested
if "%1"=="64" goto 64Bit
if "%BUILD_32%"=="0" goto No32Bit
:32Bit
set PATH=%CB_32%;%MINGW_32%;%MINGW_32%\bin;%OLD_PATH%
set START_CMD=start "FitBio 32 bit clean" /D"%~dp0" /min /b
set CB_EXE="%CB_32%\codeblocks.exe"
set CB_TARGET=--target=All_32
if not exist "%CB_32%" goto ErrNoCB
if not exist "%CB_EXE%" goto ErrNoCBEXE
if not exist "%MINGW_32%" goto ErrNoGCC
%START_CMD% %CB_EXE% %CB_PARAMS% %CB_TARGET% %CB_CMD%
rem Check for 64 bit OS, on 32 bit %ProgramFiles(x86)% is not available
if not exist "%ProgramFiles(x86)%" goto EndBuild
:No32Bit
REM Check if 32bit clean only is requested
if "%1"=="32" goto EndBuild
if "%BUILD_64%"=="0" goto No64Bit
:64Bit
set PATH=%CB_64%;%MINGW_64%;%MINGW_64%\bin;%OLD_PATH%
set START_CMD=start "FitBio 64 bit clean" /D"%~dp0" /min /b
set CB_EXE="%CB_64%\codeblocks.exe"
set CB_TARGET=--target=All_64
if not exist "%CB_64%" goto ErrNoCB
if not exist "%CB_EXE%" goto ErrNoCBEXE
if not exist "%MINGW_64%" goto ErrNoGCC
%START_CMD% %CB_EXE% %CB_PARAMS% %CB_TARGET% %CB_CMD%
:No64Bit
:EndBuild
goto TheEnd
:ErrNoCB
echo Error: C::B root folder ("%CB_32%" or "%CB_64%") not found. Adjust batch file accordingly.
goto TheEnd
:ErrNoCBEXE
echo Error: C::B executable ("%CB_EXE%") not found. Adjust batch file accordingly.
goto TheEnd
:ErrNoGCC
echo Error: GCC root folder ("%MINGW_32%" or "%MINGW_64%") not found. Adjust batch file accordingly.
goto TheEnd
:TheEnd