Add Windows wasm3 build

This commit is contained in:
Ben Visness 2023-07-19 18:14:27 -05:00 committed by Ben Visness
parent b398b74ac9
commit 25f660227f
1 changed files with 33 additions and 0 deletions

View File

@ -27,6 +27,7 @@ def build_runtime(args):
ensure_angle()
build_milepost("lib", args.release)
build_wasm3(args.release)
def build_milepost(target, release):
@ -180,6 +181,38 @@ def build_milepost_lib_mac(release):
], check=True)
def build_wasm3(release):
print("Building wasm3...")
os.makedirs("bin", exist_ok=True)
os.makedirs("bin\\obj", exist_ok=True)
if platform.system() == "Windows":
build_wasm3_lib_win(release)
elif platform.system() == "Darwin":
raise "can't yet build wasm3 on Mac"
else:
log_error(f"can't build wasm3 for unknown platform '{platform.system()}'")
exit(1)
def build_wasm3_lib_win(release):
for f in glob.iglob(".\\ext\\wasm3\\source\\*.c"):
name = os.path.splitext(os.path.basename(f))[0]
subprocess.run([
"cl", "/nologo",
"/Zi", "/Zc:preprocessor", "/c",
*(["/O2"] if release else []),
f"/Fo:bin\\obj\\{name}.obj",
"/I", ".\\ext\\wasm3\\source",
f,
], check=True)
subprocess.run([
"lib", "/nologo", "/out:bin\\wasm3.lib",
"bin\\obj\\*.obj",
], check=True)
def ensure_programs():
if platform.system() == "Windows":
try: