nim-circom-compat/circomcompat.nim

31 lines
915 B
Nim
Raw Normal View History

2024-01-19 14:29:03 -06:00
import std/os
import std/strutils
import std/macros
const
currentDir = currentSourcePath().parentDir()
libDir* = currentDir/"vendor/circom-compat-ffi/target"/"release"
# libDir* = currentDir/"vendor/circom-compat-ffi/target"/"debug" # XXX: uncomment for debug build
2024-01-19 14:29:03 -06:00
libPath* = libDir/"libcircom_compat_ffi.a"
static:
2024-02-06 11:36:07 -06:00
let
cmd = "cargo build --release --manifest-path=vendor/circom-compat-ffi/Cargo.toml"
warning "\nBuilding circom compat ffi: "
warning cmd
2024-01-19 14:29:03 -06:00
let (output, exitCode) = gorgeEx cmd
if exitCode != 0:
2024-02-06 11:36:07 -06:00
for ln in output.splitLines():
warning("rust error> " & ln)
2024-01-19 14:29:03 -06:00
raiseAssert("Failed to build circom-compat-ffi")
2024-02-06 11:36:07 -06:00
warning "circom compat ffi built successfully\n"
2024-01-19 14:29:03 -06:00
2024-02-06 11:36:07 -06:00
when defined(windows):
{.passl: "-lcircom_compat_ffi -lm -lws2_32 -luserenv -lntdll -lbcrypt " & " -L" & libDir.}
else:
{.passl: "-lcircom_compat_ffi -lm" & " -L" & libDir.}
2024-01-19 14:29:03 -06:00
include circomcompatffi