Convert build scripts to Python #31

Merged
MartinFouilleul merged 24 commits from build-python into main 2023-08-08 09:38:44 +00:00
1 changed files with 33 additions and 0 deletions
Showing only changes of commit 25f660227f - Show all commits

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: