From 4b9194fa38f6d62606ac8affd2d82a6cdda15596 Mon Sep 17 00:00:00 2001 From: oskarth Date: Thu, 1 Feb 2024 11:03:12 +0800 Subject: [PATCH] docs: Update README with new config --- README.md | 36 +++++++++++++++++++++++++++++------- config-example.toml | 11 ++++++++--- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 46f34d35..f076690f 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,31 @@ Zooming in a bit: (Note that we require `uniffi-bindgen` to be `0.25`, if you have an older version you might need to remove this to re-install the latest). +### Configure settings + +By creating a `toml` configuration file you can specify what build settings you want to use. Example is provided in `config-example.toml`: + +``` +# config-example.toml + +[build] +# For iOS device_type can be x86_64, simulator, device +# For Android device_type can be x86_64, arm, arm64 +device_type = "simulator" # Options: x86_64, simulator, device, arm, arm64 + +# debug is for Rust library to be in debug mode and release for release mode +# We recommend release mode by default for performance +build_mode = "release" # Options: debug, release + +[circuit] +dir = "examples/circom/keccak256" # Directory of the circuit +name = "keccak256_256_test" # Name of the circuit + +[dylib] +use_dylib = true # Options: true, false +name = "keccak256.dylib" # Name of the dylib file, only used if use_dylib is true +``` + ### iOS #### Prepare @@ -39,20 +64,17 @@ Zooming in a bit: #### Build Bindings -To build bindings for iOS simulator debug mode, run +To build bindings for iOS, adjust settings in your config file (we recommend starting with `simulator` and `release`) and run: ```sh -./scripts/build_ios.sh simulator debug +./scripts/build_ios.sh config-example.toml ``` Open the `mopro-ios/MoproKit/Example/MoproKit.xcworkspace` in Xcode. #### Update Bindings -To update bindings, run `./scripts/update_bindings.sh simulator|device debug|release`. - -- `simulator` is for building library to run on iOS simulator, `device` is for running on a real device -- `debug` is for Rust library to be in debug mode and `release` for release mode +To update bindings, run `./scripts/update_bindings.sh config-example`. ### Android @@ -80,7 +102,7 @@ To update bindings, run `./scripts/update_bindings.sh simulator|device debug|rel To build bindings for android simulator debug mode, run ```sh -./scripts/build_android.sh arm64 debug +./scripts/build_android.sh config-example.toml ``` - **Device types:** `x86_64`, `x86`, `arm`, `arm64` diff --git a/config-example.toml b/config-example.toml index 795c1c56..f3d0b341 100644 --- a/config-example.toml +++ b/config-example.toml @@ -1,13 +1,18 @@ # config-example.toml [build] -device_type = "simulator" # Options: x86_64, simulator, device -build_mode = "release" # Options: debug, release +# For iOS device_type can be x86_64, simulator, device +# For Android device_type can be x86_64, arm, arm64 +device_type = "simulator" # Options: x86_64, simulator, device, arm, arm64 + +# debug is for Rust library to be in debug mode and release for release mode +# We recommend release mode by default for performance +build_mode = "release" # Options: debug, release [circuit] dir = "examples/circom/keccak256" # Directory of the circuit name = "keccak256_256_test" # Name of the circuit [dylib] -use_dylib = false # Options: true, false +use_dylib = true # Options: true, false name = "keccak256.dylib" # Name of the dylib file, only used if use_dylib is true