mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-18 23:32:54 +00:00
Merge pull request #345 from Laupetin/chore/premake-update
chore: remove premake5 executable from repo
This commit is contained in:
commit
fea4970b84
27
.github/workflows/ci.yaml
vendored
27
.github/workflows/ci.yaml
vendored
@ -8,20 +8,15 @@ on:
|
||||
branches:
|
||||
- "main"
|
||||
|
||||
env:
|
||||
PREMAKE_VERSION: "5.0.0-beta2"
|
||||
|
||||
jobs:
|
||||
build-test-linux:
|
||||
env:
|
||||
PREMAKE_CONFIG: gmake2
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu:24.04
|
||||
steps:
|
||||
- name: Install g++ and multilib
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y git make gcc-13 g++-13 gcc-13-multilib g++-13-multilib
|
||||
apt-get install -y wget tar git make gcc-13 g++-13 gcc-13-multilib g++-13-multilib
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
|
||||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
|
||||
update-alternatives --set gcc /usr/bin/gcc-13
|
||||
@ -32,14 +27,11 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup premake
|
||||
uses: abel0b/setup-premake@v2.4
|
||||
with:
|
||||
version: ${{ env.PREMAKE_VERSION }}
|
||||
|
||||
- name: Premake generate
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: premake5 ${{ env.PREMAKE_CONFIG }}
|
||||
env:
|
||||
PREMAKE_NO_PROMPT: 1
|
||||
run: ./generate.sh
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{ github.workspace }}
|
||||
@ -56,8 +48,6 @@ jobs:
|
||||
./ZoneCommonTests
|
||||
|
||||
build-test-windows:
|
||||
env:
|
||||
PREMAKE_CONFIG: vs2022
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@ -68,14 +58,11 @@ jobs:
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2.0.0
|
||||
|
||||
- name: Setup premake
|
||||
uses: abel0b/setup-premake@v2.4
|
||||
with:
|
||||
version: ${{ env.PREMAKE_VERSION }}
|
||||
|
||||
- name: Premake generate
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: premake5 ${{ env.PREMAKE_CONFIG }}
|
||||
env:
|
||||
PREMAKE_NO_PROMPT: 1
|
||||
run: ./generate.bat
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{ github.workspace }}
|
||||
|
35
.github/workflows/release.yaml
vendored
35
.github/workflows/release.yaml
vendored
@ -5,20 +5,15 @@ on:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
env:
|
||||
PREMAKE_VERSION: "5.0.0-beta2"
|
||||
|
||||
jobs:
|
||||
build-release-linux:
|
||||
env:
|
||||
PREMAKE_CONFIG: gmake2
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu:24.04
|
||||
steps:
|
||||
- name: Install g++ and multilib
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y git make gcc-13 g++-13 gcc-13-multilib g++-13-multilib
|
||||
apt-get install -y wget tar git make gcc-13 g++-13 gcc-13-multilib g++-13-multilib
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
|
||||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
|
||||
update-alternatives --set gcc /usr/bin/gcc-13
|
||||
@ -29,14 +24,11 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup premake
|
||||
uses: abel0b/setup-premake@v2.4
|
||||
with:
|
||||
version: ${{ env.PREMAKE_VERSION }}
|
||||
|
||||
- name: Premake generate
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: premake5 ${{ env.PREMAKE_CONFIG }}
|
||||
env:
|
||||
PREMAKE_NO_PROMPT: 1
|
||||
run: ./generate.sh
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{ github.workspace }}
|
||||
@ -50,8 +42,6 @@ jobs:
|
||||
${{ github.workspace }}/build/bin/Release_x86
|
||||
|
||||
build-release-windows:
|
||||
env:
|
||||
PREMAKE_CONFIG: vs2022
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@ -62,28 +52,25 @@ jobs:
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2.0.0
|
||||
|
||||
- name: Setup premake
|
||||
uses: abel0b/setup-premake@v2.4
|
||||
with:
|
||||
version: ${{ env.PREMAKE_VERSION }}
|
||||
|
||||
- name: Premake generate
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: premake5 ${{ env.PREMAKE_CONFIG }}
|
||||
env:
|
||||
PREMAKE_NO_PROMPT: 1
|
||||
run: ./generate.bat
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: msbuild /m /p:Configuration=Release /p:Platform=Win32 build
|
||||
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: oat-windows
|
||||
path: |
|
||||
${{ github.workspace }}/build/bin/Release_x86
|
||||
|
||||
|
||||
release:
|
||||
needs:
|
||||
needs:
|
||||
- build-release-linux
|
||||
- build-release-windows
|
||||
runs-on: ubuntu-latest
|
||||
@ -106,4 +93,4 @@ jobs:
|
||||
allowUpdates: true
|
||||
draft: true
|
||||
omitBodyDuringUpdate: true
|
||||
omitDraftDuringUpdate: true
|
||||
omitDraftDuringUpdate: true
|
||||
|
82
generate.bat
82
generate.bat
@ -1,6 +1,86 @@
|
||||
@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"
|
||||
|
||||
@REM The following variables can be set:
|
||||
@REM PREMAKE_NO_GLOBAL - Ignore premake5 executable from path
|
||||
@REM PREMAKE_NO_PROMPT - Download premake5 without prompting
|
||||
|
||||
goto start
|
||||
|
||||
:downloadpremake
|
||||
|
||||
if not exist "build" mkdir "build"
|
||||
|
||||
where /q "pwsh"
|
||||
IF NOT ERRORLEVEL 1 (
|
||||
set POWERSHELL_BIN="pwsh"
|
||||
) else (
|
||||
set POWERSHELL_BIN="powershell"
|
||||
)
|
||||
|
||||
echo Downloading...
|
||||
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "Invoke-WebRequest %PREMAKE_URL% -OutFile build/premake.zip"
|
||||
IF ERRORLEVEL 1 (
|
||||
echo Download failed >&2
|
||||
exit 2
|
||||
)
|
||||
|
||||
echo Extracting...
|
||||
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "Expand-Archive -LiteralPath build/premake.zip -DestinationPath build"
|
||||
IF ERRORLEVEL 1 (
|
||||
echo Extraction failed >&2
|
||||
exit 2
|
||||
)
|
||||
|
||||
rm build/premake.zip
|
||||
|
||||
echo Verifying hash...
|
||||
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "if ((Get-FileHash -LiteralPath build/premake5.exe -Algorithm SHA256).Hash -eq \"%PREMAKE_HASH%\") { exit 0 } else { exit 1 }"
|
||||
IF ERRORLEVEL 1 (
|
||||
echo Hash verification failed >&2
|
||||
rm build/premake5.exe
|
||||
exit 2
|
||||
)
|
||||
|
||||
exit /B 0
|
||||
|
||||
cd %~dp0
|
||||
|
||||
:start
|
||||
|
||||
IF "%PREMAKE_NO_GLOBAL%" EQU "" (
|
||||
where /Q "premake5.exe"
|
||||
IF NOT ERRORLEVEL 1 (
|
||||
echo success
|
||||
set PREMAKE_BIN="premake5.exe"
|
||||
goto runpremake
|
||||
)
|
||||
)
|
||||
|
||||
IF EXIST build/premake5.exe (
|
||||
set PREMAKE_BIN="build/premake5.exe"
|
||||
goto runpremake
|
||||
)
|
||||
|
||||
if "%PREMAKE_NO_PROMPT%" NEQ "" (
|
||||
call:downloadpremake
|
||||
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
|
||||
|
70
generate.sh
70
generate.sh
@ -1,7 +1,75 @@
|
||||
#!/bin/bash
|
||||
|
||||
PREMAKE_URL='https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/premake-5.0.0-beta4-linux.tar.gz'
|
||||
PREMAKE_HASH='4356ab7cdec6085183d68fb240089376eacdc2fb751ffbd8063d797ae43abeb3'
|
||||
|
||||
# The following variables can be set:
|
||||
# PREMAKE_NO_GLOBAL - Ignore premake5 executable from path
|
||||
# PREMAKE_NO_PROMPT - Download premake5 without prompting
|
||||
|
||||
function install_premake {
|
||||
if [[ ! -x "$(command -v wget)" ]]; then
|
||||
echo "Failed: Installation requires wget" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [[ ! -x "$(command -v tar)" ]]; then
|
||||
echo "Failed: Installation requires tar" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [[ ! -x "$(command -v sha256sum)" ]]; then
|
||||
echo "Failed: Installation requires sha256sum" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
mkdir -p build
|
||||
wget -nd -O build/premake.tar.gz "$PREMAKE_URL"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Download failed" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
tar -xf build/premake.tar.gz -C build
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Extraction failed" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rm build/premake.tar.gz
|
||||
|
||||
echo "${PREMAKE_HASH} build/premake5" | sha256sum -c
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Hash verification failed" >&2
|
||||
rm build/premake5
|
||||
exit 2
|
||||
fi
|
||||
|
||||
chmod +x build/premake5
|
||||
}
|
||||
|
||||
# Go to repository root
|
||||
cd "$(dirname "$0")" || exit 2
|
||||
|
||||
if [[ ! -d ".git" ]]; then
|
||||
echo "You must clone the OpenAssetTools repository using 'git clone'. Please read README.md." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PREMAKE_BIN=''
|
||||
if [[ -z "$PREMAKE_NO_GLOBAL" ]] && [[ -x "$(command -v premake5)" ]]; then
|
||||
PREMAKE_BIN='premake5'
|
||||
elif [[ -x "$(command -v build/premake5)" ]]; then
|
||||
PREMAKE_BIN='build/premake5'
|
||||
else
|
||||
echo "Could not find premake5. You can either install it yourself or this script download it for you."
|
||||
if [[ ! -z "$PREMAKE_NO_PROMPT" ]] || [[ "$(read -e -p 'Do you wish to download it automatically? [y/N]> '; echo $REPLY)" == [Yy]* ]]; then
|
||||
echo "Installing premake"
|
||||
install_premake
|
||||
PREMAKE_BIN='build/premake5'
|
||||
else
|
||||
echo "Please install premake5 and try again"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
git submodule update --init --recursive
|
||||
tools/premake5 $@ gmake2
|
||||
$PREMAKE_BIN $@ gmake2
|
||||
|
@ -1,3 +1,5 @@
|
||||
require("premake", ">=5.0.0-beta4")
|
||||
|
||||
include "tools/scripts/folders.lua"
|
||||
include "tools/scripts/including.lua"
|
||||
include "tools/scripts/linking.lua"
|
||||
@ -56,9 +58,7 @@ workspace "OpenAssetTools"
|
||||
defines "NDEBUG"
|
||||
optimize "Full"
|
||||
symbols "Off"
|
||||
flags {
|
||||
"FatalWarnings"
|
||||
}
|
||||
fatalwarnings { "All" }
|
||||
filter {}
|
||||
|
||||
defines {
|
||||
|
BIN
tools/premake5
BIN
tools/premake5
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user