forked from mmozeiko/build-angle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cmd
118 lines (91 loc) · 3.5 KB
/
build.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@echo off
setlocal enabledelayedexpansion
set PATH=%CD%\depot_tools;%PATH%
rem *** check dependencies ***
where /q python.exe || (
echo ERROR: "python.exe" not found
exit /b 1
)
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 (
where /q 7za.exe || (
echo ERROR: 7-Zip installation or "7za.exe" not found
exit /b 1
)
set SZIP=7za.exe
)
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [16.0^,17.0^) -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath`) do set VS=%%i
if "!VS!" equ "" (
echo ERROR: Visual Studio 2019 installation not found
exit /b 1
)
rem *** download depot_tools ***
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
popd
)
rem *** downlaod angle source ***
if exist angle.src (
pushd angle.src
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 ***
pushd angle.src
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 ***
mkdir angle
mkdir angle\bin
mkdir angle\lib
mkdir angle\include
copy /y angle.src\.git\refs\heads\main angle\commit.txt 1>nul 2>nul
copy /y "%ProgramFiles(x86)%\Windows Kits\10\Redist\D3D\x64\d3dcompiler_47.dll" angle\bin 1>nul 2>nul
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
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
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
del /Q /S angle\include\*.clang-format 1>nul 2>nul
rem *** done ***
rem output is in angle folder
if "%GITHUB_WORKFLOW%" neq "" (
set /p ANGLE_COMMIT=<angle\commit.txt
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%
%SZIP% a -mx=9 angle-%BUILD_DATE%.zip angle || exit /b 1
echo ::set-output name=ANGLE_COMMIT::%ANGLE_COMMIT%
echo ::set-output name=BUILD_DATE::%BUILD_DATE%
)