Add automatic ANGLE downloads

This commit is contained in:
Ben Visness 2023-07-08 09:22:29 -05:00
parent 76e007ee72
commit fbba6330e9
3 changed files with 46 additions and 3 deletions

1
.gitignore vendored
View File

@ -26,3 +26,4 @@ sdk/orca_surface.c
.vscode/settings.json
__pycache__
scripts/files

View File

@ -1,7 +1,11 @@
import argparse
import glob
import os
import platform
import urllib.request
import shutil
import subprocess
from zipfile import ZipFile
import checksum
from log import *
@ -173,4 +177,40 @@ def ensure_angle():
exit(1)
if not angle_exists:
pass
download_angle()
def download_angle():
print("Downloading ANGLE...")
if platform.system() == "Windows":
build = "win"
checksumkey = "angle.zip-win"
extension = "dll"
elif platform.system() == "Darwin":
extension = "dylib"
build = "macos-12"
checksumkey = "angle.zip-mac"
# TODO(ben): make universal dylibs
if platform.machine() == "arm64":
log_error(f"automated ANGLE builds are not yet available for Apple silicon")
return
else:
log_error(f"could not automatically download ANGLE for unknown platform {platform.system()}")
return
url = f"https://github.com/HandmadeNetwork/build-angle/releases/download/{ANGLE_VERSION}/angle-{build}-{ANGLE_VERSION}.zip"
with urllib.request.urlopen(url) as response:
os.makedirs("scripts/files", exist_ok=True)
with open("scripts/files/angle.zip", "wb") as out:
shutil.copyfileobj(response, out)
if not checksum.checkfile(checksumkey, "scripts/files/angle.zip"):
log_error(f"ANGLE download did not match checksum")
exit(1)
with ZipFile("scripts/files/angle.zip", "r") as anglezip:
anglezip.extractall(path="scripts/files")
for filepath in glob.glob(f"scripts/files/angle/bin/*.{extension}"):
shutil.copy(filepath, "milepost/lib")

View File

@ -1,6 +1,8 @@
{
"angle.zip-win": "pizza",
"angle.zip-mac-x64": "a3422c456278ff037ef89a7808e0ba256d972d4832d5272fc3d4aa4f7912c1e0",
"libEGL-win": "3c8b22317664650deba704dd40bbd56447c579ee3a3de18a9c114449a883a36d",
"libGLESv2-win": "a10e0ce850a981b11d3d0f01a7efbf8ce46ac74e5fa763b5c43a80c4238da389",
"libEGL-mac-arm64": "227445d896047207d1dcef91a8182d886692bc470f402033a6f0831eacb82592",
"libGLESv2-mac-arm64": "c814948060494796cda4a3febd8652e1bbf0787a69c2f7e9afd41fc666dc91fe"
"libEGL-mac": "227445d896047207d1dcef91a8182d886692bc470f402033a6f0831eacb82592",
"libGLESv2-mac": "c814948060494796cda4a3febd8652e1bbf0787a69c2f7e9afd41fc666dc91fe"
}