Skip to content

Commit

Permalink
chore: improve DX, add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vivianjeng committed Mar 11, 2024
1 parent 2e82854 commit a98d6fe
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ By creating a `toml` configuration file you can specify what build settings you
[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
ios_device_type = "simulator" # Options: x86_64, simulator, device
# For Android device_type can be x86_64, x86, arm, arm64
android_device_type = "arm64" # Options: x86_64, x86, 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
Expand Down
13 changes: 13 additions & 0 deletions mopro-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Initialize and build an app with iOS support.

```
mopro init --platforms ios
cd mopro-example-app
mopro prepare
mopro build --platforms ios
Expand All @@ -66,6 +67,18 @@ mopro build --platforms ios
mopro test
```

### Android

Initialize and build an app with Android support.
> Currently support [Android Studio](https://developer.android.com/studio)
```
mopro init --platforms android
cd mopro-example-app
mopro prepare
mopro build --platforms android
```

### Exporting bindings

To export bindings to a different directory:
Expand Down
3 changes: 2 additions & 1 deletion mopro-cli/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ pub fn init_project(adapter: &str, platforms: &Vec<String>, project_name: &str)
entries_to_copy.push(source_path.join("README.md"));
if platforms.contains(&"ios".to_string()) {
entries_to_copy.push(source_path.join("ios"));
} else if platforms.contains(&"android".to_string()) {
}
if platforms.contains(&"android".to_string()) {
entries_to_copy.push(source_path.join("android"));
}

Expand Down
2 changes: 1 addition & 1 deletion mopro-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// Default configuration
let default_config = r#"
[build]
device_type = "simulator"
ios_device_type = "simulator"
build_mode = "release"
[circuit]
Expand Down
2 changes: 1 addition & 1 deletion mopro-ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ There are two ways to run tests for the example app:
1. `cd mopro-ffi/` and convert `default=[]` into `default=["gpu-benchmarks"]` to enable `gpu-benchmarks` feature flag
2. run `make` to build the mopro-ffi library
3. `cd mopro/` and run `./scripts/build_ios.sh config-example.toml` to build IOS app and link
* remember to alter the `device_type` in `config-example.toml`
* remember to alter the `ios_device_type` in `config-example.toml`
* `simulator`: running on the simulator (default)
* `device`: running on a real IOS device
4. Open `MoproKit/Example/MoproKit.xcworkspace` in Xcode and `cmd + R` for building
1 change: 1 addition & 0 deletions scripts/cli/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ main() {
generate_kotlin_bindings

print_action "Done! Please re-build your project in Android Studio."
print_action "Run \`open android -a Android\ Studio\` to do so."
}

main "$@"
2 changes: 1 addition & 1 deletion scripts/cli/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export BUILD_CONFIG_PATH="$(pwd)/$CONFIG_FILE"
echo "Using build configuration file: $BUILD_CONFIG_PATH"

# Read configurations from TOML file
DEVICE_TYPE=$(read_toml "$CONFIG_FILE" "build.device_type")
DEVICE_TYPE=$(read_toml "$CONFIG_FILE" "build.ios_device_type")
BUILD_MODE=$(read_toml "$CONFIG_FILE" "build.build_mode")
USE_DYLIB=$(read_toml "$CONFIG_FILE" "dylib.use_dylib")
DYLIB_NAME=$(read_toml "$CONFIG_FILE" "dylib.name")
Expand Down

0 comments on commit a98d6fe

Please sign in to comment.