Skip to content

Commit

Permalink
build script improvements, add arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
mmozeiko committed Sep 7, 2024
1 parent a4eae9a commit 6c2a717
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 107 deletions.
75 changes: 51 additions & 24 deletions .github/workflows/build-angle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,64 @@ on:
- main

jobs:
info:
runs-on: ubuntu-24.04
outputs:
ANGLE_COMMIT: ${{ steps.info.outputs.ANGLE_COMMIT }}
BUILD_DATE: ${{ steps.info.outputs.BUILD_DATE }}
steps:
- name: Get Latest Commit Id
id: info
run: |
echo ANGLE_COMMIT=`git ls-remote https://chromium.googlesource.com/angle/angle HEAD | awk '{ print $1 }'` >> ${GITHUB_OUTPUT}
echo BUILD_DATE=`date +'%Y-%m-%d'` >> ${GITHUB_OUTPUT}
build:
runs-on: windows-2022
needs: info
strategy:
matrix:
arch: [x64, arm64]
env:
ANGLE_COMMIT: ${{ needs.info.outputs.ANGLE_COMMIT }}
BUILD_DATE: ${{ needs.info.outputs.BUILD_DATE }}
steps:

- name: checkout
- name: Checkout
uses: actions/checkout@v4

- name: build
- name: Run Build Script
id: build
shell: cmd
run: call build.cmd

- name: release
id: release
if: steps.build.outputs.ANGLE_COMMIT != ''
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: call build.cmd ${{ matrix.arch }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
tag_name: ${{ steps.build.outputs.BUILD_DATE }}
release_name: ${{ steps.build.outputs.BUILD_DATE }}
body: |
[angle commit](https://github.com/google/angle/commit/${{ steps.build.outputs.ANGLE_COMMIT }})
- name: upload
id: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: angle-${{ matrix.arch }}-${{ needs.info.outputs.BUILD_DATE }}
path: angle-${{ matrix.arch }}-${{ needs.info.outputs.BUILD_DATE }}.zip
if-no-files-found: error
compression-level: 0

release:
runs-on: ubuntu-24.04
needs: [info, build]
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
steps:

- name: Create GitHub Release
run: |
echo '[angle commit](https://github.com/google/angle/commit/${{ needs.info.outputs.ANGLE_COMMIT }})' >>notes.txt
gh release create ${{ needs.info.outputs.BUILD_DATE }} -R "${GITHUB_REPOSITORY}" -t '${{ needs.info.outputs.BUILD_DATE }}' -F notes.txt
- name: Get Artifacts From Build Steps
uses: actions/download-artifact@v4
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: "angle-${{ steps.build.outputs.BUILD_DATE }}.zip"
asset_name: "angle-${{ steps.build.outputs.BUILD_DATE }}.zip"
asset_content_type: application/zip
pattern: angle-*-${{ needs.info.outputs.BUILD_DATE }}
merge-multiple: true

- name: Upload Artifacts to GitHub Release
run: gh release upload '${{ needs.info.outputs.BUILD_DATE }}' angle-*-${{ needs.info.outputs.BUILD_DATE }}.zip -R "${GITHUB_REPOSITORY}"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angle
angle.src
angle-*
depot_tools
*.zip
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Automatic weekly build of [angle][] OpenGL ES implementation for 64-bit Windows.
Automatic weekly build of [angle][] OpenGL ES implementation for 64-bit Windows (x64 and arm64).

Download binary build as zip archive from [latest release][] page.

Expand Down
13 changes: 0 additions & 13 deletions angle.patch

This file was deleted.

152 changes: 84 additions & 68 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
@echo off
setlocal enabledelayedexpansion

set PATH=%CD%\depot_tools;%PATH%

rem *** check dependencies ***

where /q python.exe || (
echo ERROR: "python.exe" not found
rem
rem build architecture
rem

if "%1" equ "x64" (
set ARCH=x64
) else if "%1" equ "arm64" (
set ARCH=arm64
) else if "%1" neq "" (
echo Unknown target "%1" architecture!
exit /b 1
) else if "%PROCESSOR_ARCHITECTURE%" equ "AMD64" (
set ARCH=x64
) else if "%PROCESSOR_ARCHITECTURE%" equ "ARM64" (
set ARCH=arm64
)

rem
rem dependencies
rem

where /q git.exe || (
echo ERROR: "git.exe" not found
exit /b 1
)

where /q curl.exe || (
echo ERROR: "curl.exe" not found
exit /b 1
)

if exist "%ProgramFiles%\7-Zip\7z.exe" (
set SZIP="%ProgramFiles%\7-Zip\7z.exe"
) else (
Expand All @@ -30,89 +37,98 @@ if exist "%ProgramFiles%\7-Zip\7z.exe" (
set SZIP=7za.exe
)

for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [17.0^,^) -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath`) do set VS=%%i
if "!VS!" equ "" (
echo ERROR: Visual Studio 2022 installation not found
exit /b 1
)
rem
rem get depot tools
rem

rem *** download depot_tools ***
set PATH=%CD%\depot_tools;%PATH%
set DEPOT_TOOLS_WIN_TOOLCHAIN=0

if not exist depot_tools (
mkdir depot_tools
pushd depot_tools
curl -LOsf https://storage.googleapis.com/chrome-infra/depot_tools.zip || exit /b 1
%SZIP% x -bb0 -y depot_tools.zip 1>nul 2>nul || exit /b 1
del depot_tools.zip 1>nul 2>nul
call git clone --depth=1 --no-tags --single-branch https://chromium.googlesource.com/chromium/tools/depot_tools.git || exit /b 1
)

rem
rem clone angle source
rem

if "%ANGLE_COMMIT%" equ "" (
for /f "tokens=1 usebackq" %%F IN (`git ls-remote https://chromium.googlesource.com/angle/angle HEAD`) do set ANGLE_COMMIT=%%F
)

if not exist angle (
mkdir angle
pushd angle
call git init . || exit /b 1
call git remote add origin https://chromium.googlesource.com/angle/angle || exit /b 1
popd
)

rem *** downlaod angle source ***
pushd angle

if exist angle.src (
pushd angle.src
if exist build (
pushd build
call git reset --hard HEAD
popd
call git pull --force --no-tags --depth 1
popd
) else (
call git clone --single-branch --no-tags --depth 1 https://chromium.googlesource.com/angle/angle angle.src || exit /b 1
pushd angle.src
python scripts\bootstrap.py || exit /b 1
popd
)

rem *** build angle ***
call git fetch origin %ANGLE_COMMIT% || exit /b 1
call git checkout --force FETCH_HEAD || exit /b 1

pushd angle.src
python.exe scripts\bootstrap.py || exit /b 1

"C:\Program Files\Git\usr\bin\sed.exe" -i.bak -e "/'third_party\/catapult'\: /,+3d" -e "/'third_party\/dawn'\: /,+3d" -e "/'third_party\/llvm\/src'\: /,+3d" -e "/'third_party\/SwiftShader'\: /,+3d" -e "/'third_party\/VK-GL-CTS\/src'\: /,+3d" -e "s/'tools\/rust\/update_rust.py'/'-c',''/" DEPS || exit /b 1
call gclient sync -f -D -R || exit /b 1

set DEPOT_TOOLS_WIN_TOOLCHAIN=0
call gclient sync || exit /b 1
call gn gen out/Release --args="angle_build_all=false is_debug=false angle_has_frame_capture=false angle_enable_gl=false angle_enable_vulkan=false angle_enable_d3d9=false angle_enable_null=false" || exit /b 1
call git apply -p0 ..\angle.patch || exit /b 1
call autoninja -C out/Release libEGL libGLESv2 libGLESv1_CM || exit /b 1
popd

rem *** prepare output folder ***
rem
rem build angle
rem

mkdir angle
mkdir angle\bin
mkdir angle\lib
mkdir angle\include
pushd angle

copy /y angle.src\.git\refs\heads\main angle\commit.txt 1>nul 2>nul
call gn gen out/%ARCH% --args="target_cpu=""%ARCH%"" angle_build_all=false is_debug=false angle_has_frame_capture=false angle_enable_gl=false angle_enable_vulkan=false angle_enable_wgpu=false angle_enable_d3d9=false angle_enable_null=false" || exit /b 1
"C:\Program Files\Git\usr\bin\sed.exe" -i.bak -e "s/\/MD/\/MT/" build\config\win\BUILD.gn || exit /b 1
call autoninja -C out/%ARCH% libEGL libGLESv2 libGLESv1_CM || exit /b 1

copy /y "%ProgramFiles(x86)%\Windows Kits\10\Redist\D3D\x64\d3dcompiler_47.dll" angle\bin 1>nul 2>nul
popd

copy /y angle.src\out\Release\libEGL.dll angle\bin 1>nul 2>nul
copy /y angle.src\out\Release\libGLESv1_CM.dll angle\bin 1>nul 2>nul
copy /y angle.src\out\Release\libGLESv2.dll angle\bin 1>nul 2>nul
rem *** prepare output folder ***

copy /y angle.src\out\Release\libEGL.dll.lib angle\lib 1>nul 2>nul
copy /y angle.src\out\Release\libGLESv1_CM.dll.lib angle\lib 1>nul 2>nul
copy /y angle.src\out\Release\libGLESv2.dll.lib angle\lib 1>nul 2>nul
mkdir angle-%ARCH%
mkdir angle-%ARCH%\bin
mkdir angle-%ARCH%\lib
mkdir angle-%ARCH%\include

xcopy /D /S /I /Q /Y angle.src\include\KHR angle\include\KHR 1>nul 2>nul
xcopy /D /S /I /Q /Y angle.src\include\EGL angle\include\EGL 1>nul 2>nul
xcopy /D /S /I /Q /Y angle.src\include\GLES angle\include\GLES 1>nul 2>nul
xcopy /D /S /I /Q /Y angle.src\include\GLES2 angle\include\GLES2 1>nul 2>nul
xcopy /D /S /I /Q /Y angle.src\include\GLES3 angle\include\GLES3 1>nul 2>nul
echo %ANGLE_COMMIT% > angle-%ARCH%\commit.txt

del /Q /S angle\include\*.clang-format 1>nul 2>nul
copy /y angle\out\%ARCH%\d3dcompiler_47.dll angle-%ARCH%\bin 1>nul 2>nul
copy /y angle\out\%ARCH%\libEGL.dll angle-%ARCH%\bin 1>nul 2>nul
copy /y angle\out\%ARCH%\libGLESv1_CM.dll angle-%ARCH%\bin 1>nul 2>nul
copy /y angle\out\%ARCH%\libGLESv2.dll angle-%ARCH%\bin 1>nul 2>nul

rem *** done ***
rem output is in angle folder
copy /y angle\out\%ARCH%\libEGL.dll.lib angle-%ARCH%\lib 1>nul 2>nul
copy /y angle\out\%ARCH%\libGLESv1_CM.dll.lib angle-%ARCH%\lib 1>nul 2>nul
copy /y angle\out\%ARCH%\libGLESv2.dll.lib angle-%ARCH%\lib 1>nul 2>nul

if "%GITHUB_WORKFLOW%" neq "" (
set /p ANGLE_COMMIT=<angle\commit.txt
xcopy /D /S /I /Q /Y angle\include\KHR angle-%ARCH%\include\KHR 1>nul 2>nul
xcopy /D /S /I /Q /Y angle\include\EGL angle-%ARCH%\include\EGL 1>nul 2>nul
xcopy /D /S /I /Q /Y angle\include\GLES angle-%ARCH%\include\GLES 1>nul 2>nul
xcopy /D /S /I /Q /Y angle\include\GLES2 angle-%ARCH%\include\GLES2 1>nul 2>nul
xcopy /D /S /I /Q /Y angle\include\GLES3 angle-%ARCH%\include\GLES3 1>nul 2>nul

for /F "skip=1" %%D in ('WMIC OS GET LocalDateTime') do (set LDATE=%%D & goto :dateok)
:dateok
set BUILD_DATE=%LDATE:~0,4%-%LDATE:~4,2%-%LDATE:~6,2%
del /Q /S angle-%ARCH%\include\*.clang-format angle-%ARCH%\include\*.md 1>nul 2>nul

rem
rem Done!
rem

if "%GITHUB_WORKFLOW%" neq "" (

%SZIP% a -mx=9 angle-%BUILD_DATE%.zip angle || exit /b 1
rem
rem GitHub actions stuff
rem

echo ::set-output name=ANGLE_COMMIT::%ANGLE_COMMIT%
echo ::set-output name=BUILD_DATE::%BUILD_DATE%
%SZIP% a -mx=9 angle-%ARCH%-%BUILD_DATE%.zip angle-%ARCH% || exit /b 1
)

0 comments on commit 6c2a717

Please sign in to comment.