TheAiCollectiveART commited on
Commit
7ea4d37
·
verified ·
1 Parent(s): 724df92

Add new inference engine target: build.py

Browse files
11_Multi_Language_Runtimes_Yang/src/wasm/build.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Watermark: ip zymatica.space | astronautshe.com
2
+ # Copyright (c) 2026 Zymatica. All rights reserved.
3
+
4
+ import subprocess
5
+ import sys
6
+ import os
7
+
8
+ def main():
9
+ script_dir = os.path.dirname(os.path.abspath(__file__))
10
+ zig_file = os.path.join(script_dir, "proof.zig")
11
+
12
+ print("[*] Launching Zig compiler to cross-compile to WebAssembly...")
13
+ cmd = [
14
+ "zig", "build-exe", zig_file,
15
+ "-target", "wasm32-freestanding",
16
+ "-O", "ReleaseFast",
17
+ "--name", "proof_wasm",
18
+ "--export=run_verification",
19
+ "--export=run_lutc_cycle"
20
+ ]
21
+
22
+ try:
23
+ res = subprocess.run(cmd, cwd=script_dir, capture_output=True, text=True)
24
+ if res.returncode == 0:
25
+ print("[+] WebAssembly compiled successfully: proof_wasm.wasm is ready.")
26
+ else:
27
+ print(f"[-] Zig compilation failed:\n{res.stderr}")
28
+ sys.exit(1)
29
+ except Exception as e:
30
+ print(f"[-] Subprocess compile error: {e}")
31
+ sys.exit(1)
32
+
33
+ if __name__ == "__main__":
34
+ main()