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 19 additions and 4 deletions
Showing only changes of commit 062cd1e2de - Show all commits

View File

@ -188,13 +188,12 @@ def build_wasm3(release):
print("Building wasm3...")
os.makedirs("bin", exist_ok=True)
os.makedirs("bin\\obj", exist_ok=True)
os.makedirs("bin/obj", exist_ok=True)
if platform.system() == "Windows":
build_wasm3_lib_win(release)
elif platform.system() == "Darwin":
log_error("can't yet build wasm3 on Mac")
exit(1)
build_wasm3_lib_mac(release)
else:
log_error(f"can't build wasm3 for unknown platform '{platform.system()}'")
exit(1)
@ -217,6 +216,21 @@ def build_wasm3_lib_win(release):
], check=True)
def build_wasm3_lib_mac(release):
for f in glob.iglob("./ext/wasm3/source/*.c"):
name = os.path.splitext(os.path.basename(f))[0] + ".o"
subprocess.run([
"clang", "-c",
"-g", *(["/O2"] if release else []),
"-foptimize-sibling-calls", "-Wno-extern-initializer", "-Dd_m3VerboseErrorMessages",
"-I./ext/wasm3/source",
"-o", f"./bin/obj/{name}",
f,
], check=True)
subprocess.run(["ar", "-rcs", "./bin/libwasm3.a", *glob.glob("./bin/obj/*.o")], check=True)
subprocess.run(["rm", "-rf", "./bin/obj"], check=True)
def build_orca(release):
print("Building Orca...")
@ -225,7 +239,8 @@ def build_orca(release):
if platform.system() == "Windows":
build_orca_win(release)
elif platform.system() == "Darwin":
raise "can't yet build Orca on Mac"
log_error("can't yet build Orca on Mac")
exit(1)
else:
log_error(f"can't build Orca for unknown platform '{platform.system()}'")
exit(1)