mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-26 06:11:53 +00:00
chore: update and automatically install premake5
This commit is contained in:
58
generate.bat
58
generate.bat
@ -1,6 +1,62 @@
|
||||
@echo off
|
||||
|
||||
set PREMAKE_URL="https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-windows.zip"
|
||||
set PREMAKE_HASH="12d741d3b70445b025c03e26148e2d129801041fa5ddde61b4ac888a76017395"
|
||||
|
||||
goto start
|
||||
|
||||
:downloadpremake
|
||||
|
||||
if not exist "build" mkdir "build"
|
||||
|
||||
powershell -Command "Invoke-WebRequest %PREMAKE_URL% -OutFile build/premake.zip"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo Download failed >&2
|
||||
exit 2
|
||||
)
|
||||
|
||||
powershell -Command "Expand-Archive -LiteralPath build/premake.zip -DestinationPath build"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo Extraction failed >&2
|
||||
exit 2
|
||||
)
|
||||
|
||||
rm build/premake.zip
|
||||
|
||||
powershell -Command "if ((Get-FileHash -LiteralPath build/premake5.exe -Algorithm SHA256).Hash -eq \"%PREMAKE_HASH%\") { exit 0 } else { exit 1 }"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo Hash verification failed >&2
|
||||
rm build/premake5.exe
|
||||
exit 2
|
||||
)
|
||||
|
||||
exit /B 0
|
||||
|
||||
cd %~dp0
|
||||
|
||||
:start
|
||||
where /q "premake5.exe"
|
||||
IF %ERRORLEVEL% EQU 0 (
|
||||
set PREMAKE_BIN="premake5.exe"
|
||||
goto runpremake
|
||||
)
|
||||
|
||||
IF EXIST build/premake5.exe (
|
||||
set PREMAKE_BIN="build/premake5.exe"
|
||||
goto runpremake
|
||||
)
|
||||
|
||||
echo Could not find premake5. You can either install it yourself or this script download it for you.
|
||||
set /p choice="Do you wish to download it automatically? [y/N]> "
|
||||
if /i "%choice%"=="y" (
|
||||
call:downloadpremake
|
||||
set PREMAKE_BIN="build/premake5.exe"
|
||||
goto runpremake
|
||||
)
|
||||
|
||||
echo Please install premake5 and try again
|
||||
exit 1
|
||||
|
||||
:runpremake
|
||||
git submodule update --init --recursive
|
||||
tools\premake5.exe %* vs2022
|
||||
%PREMAKE_BIN% %* vs2022
|
||||
|
Reference in New Issue
Block a user