From 625da3939de3c1ade9fdab9f614e905047f1d117 Mon Sep 17 00:00:00 2001 From: Daniel Kales <11509575+dkales@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:12:27 +0100 Subject: [PATCH] feat: also allow circom-compatible way to handle link library via cli --- co-circom/co-circom/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/co-circom/co-circom/src/lib.rs b/co-circom/co-circom/src/lib.rs index 51db0e092..4ad86c598 100644 --- a/co-circom/co-circom/src/lib.rs +++ b/co-circom/co-circom/src/lib.rs @@ -288,7 +288,11 @@ pub struct GenerateWitnessCli { /// The path to the circuit file #[arg(long)] #[serde(skip_serializing_if = "::std::option::Option::is_none")] - pub circuit: Option, + pub circuit: Option, + /// The path to the circuit file + #[arg(long, short = 'l')] + #[serde(skip_serializing_if = "::std::option::Option::is_none")] + pub link_library: Option>, /// The MPC protocol to be used #[arg(long, value_enum)] #[serde(skip_serializing_if = "::std::option::Option::is_none")] @@ -520,8 +524,9 @@ impl_config!(VerifyCli, VerifyConfig); // manual one since this is a bit more complex impl GenerateWitnessConfig { /// Parse config from file, env, cli - pub fn parse(cli: GenerateWitnessCli) -> Result { + pub fn parse(mut cli: GenerateWitnessCli) -> Result { let simplification_level = cli.simplification_level; + let link_library = cli.link_library.take().unwrap_or_default(); let mut config: GenerateWitnessConfig = if let Some(path) = &cli.config { Figment::new() .merge(Toml::file(path)) @@ -540,6 +545,7 @@ impl GenerateWitnessConfig { 2 => config.compiler.simplification = SimplificationLevel::O2(usize::MAX), _ => {} } + config.compiler.link_library.extend(link_library); Ok(config) } }