mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-09 14:00:17 +00:00
85 lines
2.2 KiB
Batchfile
85 lines
2.2 KiB
Batchfile
@rem QB64-PE Windows setup script
|
|
@rem
|
|
@rem This NT command script calls setup_mingw.cmd which downloads and installs MINGW if required
|
|
@rem It then proceeds to build QB64-PE
|
|
@rem
|
|
@rem If argument 1 is not blank, then qb64pe will not be started after compilation
|
|
@rem
|
|
@echo off
|
|
|
|
rem Enable cmd extensions and exit if not present
|
|
setlocal enableextensions
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo Error: Command Prompt extensions not available!
|
|
goto report_error
|
|
)
|
|
|
|
echo QB64-PE Setup
|
|
echo.
|
|
|
|
rem Change to the correct drive letter
|
|
%~d0
|
|
|
|
rem Change to the correct path
|
|
cd %~dp0
|
|
|
|
rem Check if the C++ compiler is there and skip MINGW setup if it exists
|
|
if exist "internal\c\c_compiler\bin\c++.exe" goto build_qb64pe
|
|
|
|
rem Check the processor type and then set the ARCH variable
|
|
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set ARCH=32 || set ARCH=64
|
|
|
|
rem If the OS is 32-bit then proceed to download right away
|
|
if %ARCH% == 32 goto setup_mingw
|
|
|
|
rem Check if the user wants to use 32-bit MINGW on a 64-bit system. Default to 64-bit after 60 seconds
|
|
choice /t 60 /c 12 /d 1 /m "Do you prefer to download MINGW [1] 64-bit (default) or [2] 32-bit"
|
|
if %errorlevel% == 2 set ARCH=32
|
|
|
|
:setup_mingw
|
|
|
|
rem Call the MINGW setup script using the ARCH variable
|
|
pushd .
|
|
call setup_mingw.cmd %ARCH%
|
|
popd
|
|
|
|
rem Finally check if the C++ compiler is there now
|
|
if not exist "internal\c\c_compiler\bin\c++.exe" (
|
|
echo.
|
|
echo Error: MINGW setup failed!
|
|
goto report_error
|
|
)
|
|
|
|
:build_qb64pe
|
|
|
|
rem Run make clean
|
|
echo Cleaning...
|
|
internal\c\c_compiler\bin\mingw32-make.exe OS=win clean > NUL 2> NUL
|
|
|
|
rem Now build QB64-PE
|
|
echo Building QB64-PE...
|
|
internal\c\c_compiler\bin\mingw32-make.exe OS=win BUILD_QB64=y || goto report_error
|
|
|
|
rem Execute QB64-PE only if there are no parameters
|
|
if "%~1"=="" (
|
|
echo.
|
|
echo Launching QB64-PE...
|
|
qb64pe.exe
|
|
) else (
|
|
echo.
|
|
pause
|
|
)
|
|
|
|
rem Jump to the end of the script
|
|
goto end
|
|
|
|
rem This is only executed if something on top fails
|
|
:report_error
|
|
echo.
|
|
echo Error compiling QB64-PE.
|
|
echo Please review above steps and report to https://github.com/QB64-Phoenix-Edition/QB64pe/issues if you can't get it to work.
|
|
|
|
rem The End!
|
|
:end
|
|
endlocal
|