Fix some build issues on Windows

This commit is contained in:
Ben Visness 2023-07-15 16:23:05 -05:00 committed by Ben Visness
parent d97e69992b
commit 25782ccc77
3 changed files with 26 additions and 13 deletions

View File

@ -13,7 +13,7 @@ from log import *
from utils import pushd, removeall
ANGLE_VERSION = "2023-07-05"
ANGLE_VERSION = "2023-07-09"
def attach_build_runtime(subparsers):
@ -93,7 +93,6 @@ def build_milepost_lib_win(release):
"/DELAYLOAD:libGLESv2.dll",
]
# TODO(ben): check for cl
subprocess.run([
"cl",
"/we4013", "/Zi", "/Zc:preprocessor",
@ -182,13 +181,22 @@ def build_milepost_lib_mac(release):
def ensure_programs():
if platform.system() == "Windows":
try:
subprocess.run(["cl"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except FileNotFoundError:
msg = log_error("MSVC was not found on your system.")
msg.more("If you have already installed Visual Studio, make sure you are running in a")
msg.more("Visual Studio command prompt or you have run vcvarsall.bat. Otherwise, download")
msg.more("and install Visual Studio: https://visualstudio.microsoft.com/")
exit(1)
try:
subprocess.run(["clang", "-v"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except FileNotFoundError:
msg = log_error("clang was not found on your system.")
if platform.system() == "Windows":
msg.more("We recommend installing clang via the Visual Studio installer.")
# TODO(ben): Link to the Visual Studio download page (I have no internet right now)
elif platform.system() == "Darwin":
msg.more("Run the following to install it:")
msg.more()
@ -220,12 +228,11 @@ def ensure_angle():
angle_exists = True
for file in checkfiles:
key = file[0]
filepath = file[1]
if not os.path.isfile(filepath):
if not os.path.isfile(file):
print(f"Required ANGLE file {file} not found.")
angle_exists = False
break
if not checksum.checkfile(key, filepath):
if not checksum.checkfile(file):
angle_exists = False
log_warning("wrong version of ANGLE libraries installed")
break
@ -237,7 +244,7 @@ def ensure_angle():
def download_angle():
print("Downloading ANGLE...")
if platform.system() == "Windows":
build = "win"
build = "windows-2019"
extension = "dll"
elif platform.system() == "Darwin":
# TODO(ben): make universal dylibs
@ -259,10 +266,12 @@ def download_angle():
log_error(f"ANGLE download did not match checksum")
exit(1)
print("Extracting ANGLE...")
with ZipFile(filepath, "r") as anglezip:
anglezip.extractall(path="scripts/files")
for filepath in glob.glob(f"scripts/files/angle/bin/*.{extension}"):
os.makedirs("milepost/lib", exist_ok=True)
shutil.copy(filepath, "milepost/lib")

View File

@ -1,8 +1,8 @@
{
"scripts/files/angle-win-2023-07-05.zip": "pizza",
"scripts/files/angle-windows-2019-2023-07-09.zip": "f58ee3ba5bbc4a6aec08c1c3ef3b9ac7b991676862c641a9bff27b6cdc5519e4",
"scripts/files/angle-mac-2023-07-05.zip": "a3422c456278ff037ef89a7808e0ba256d972d4832d5272fc3d4aa4f7912c1e0",
"milepost/lib/libEGL.dll": "3c8b22317664650deba704dd40bbd56447c579ee3a3de18a9c114449a883a36d",
"milepost/lib/libGLESv2.dll": "a10e0ce850a981b11d3d0f01a7efbf8ce46ac74e5fa763b5c43a80c4238da389",
"milepost/lib/libEGL.dll": "5ed4d609ea11015473c89d3b5da91e831a0a8d9608608f840a77d49ccef6867a",
"milepost/lib/libGLESv2.dll": "f36811acdbc59f6cddd33f6a96b5d6e75559af76bdd73bcc56514455e9bffd16",
"milepost/lib/libEGL.dylib": "227445d896047207d1dcef91a8182d886692bc470f402033a6f0831eacb82592",
"milepost/lib/libGLESv2.dylib": "c814948060494796cda4a3febd8652e1bbf0787a69c2f7e9afd41fc666dc91fe"
}

View File

@ -1,5 +1,5 @@
import traceback
import subprocess
import sys
errors = []
@ -72,8 +72,12 @@ def shellish(func):
exitcode = err.returncode
except SystemExit as err:
exitcode = err.code
except Exception as err:
log_error(err)
print(traceback.format_exc())
exitcode = 1
except:
log_error(sys.exception())
print("something went REALLY wrong and also Ben does not know how to handle Python errors")
exitcode = 1
finally:
log_finish(exitcode == 0)