Skip to content

Commit

Permalink
Merge pull request #5 from c4dt/use_1.46.0
Browse files Browse the repository at this point in the history
Add information for rust-bitcode
  • Loading branch information
ivnsch authored May 10, 2021
2 parents 7bcf06e + 51cec15 commit 6cadc3b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,26 @@ rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-and

## iOS specific steps

- Add targets
- Install rust 1.46.0 with MacOSX binary support

```
rustup target add x86_64-apple-ios aarch64-apple-ios
wget https://github.com/getditto/rust-bitcode/releases/download/v1.46.0/rust-ios-arm64-1.46.0.zip
unzip rust-ios-arm64-1.46.0.zip
cd rust-ios-arm64-1.46.0
./install.sh
```

As the binaries are not signed, you'll have to convince MacOSX that it's safe to run them.
One solution is to do the following:

1. `cd rust_android_ios/ios_app`
2. `cargo +ios-arm64-1.46.0 build --target aarch64-apple-ios --release --lib`
3.a. if it fails because MacOSX doesn't trust the binary, go to
`System Preferences -> Security & Privacy` and `Allow to run binary`
then go to 2.
3.b. if it fails with another error, ask Google
3.c. if it compiles, go on

- Run the project in Xcode. This will build Rust, put the binaries in the correct place and start the app.

## Android specifics
Expand Down
4 changes: 2 additions & 2 deletions ios_app/build-rust-xcode.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash

# Ensure that `cargo` is in PATH, using the default location.
export PATH="$PATH:${HOME}/.cargo/bin"
. "$HOME/.cargo/env"

set -x

# Go to repo's root
cd "${SRCROOT}/../"

# Build binaries
RUSTFLAGS="-Z embed-bitcode" cargo +ios-arm64 build --target aarch64-apple-ios --release --lib
cargo +ios-arm64-1.46.0 build --target aarch64-apple-ios --release --lib
cargo build --target=x86_64-apple-ios --release

# Create fat binary
Expand Down
9 changes: 6 additions & 3 deletions ios_app/ios_app.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1030;
LastUpgradeCheck = 1030;
LastUpgradeCheck = 1250;
ORGANIZATIONNAME = com.schuetz;
TargetAttributes = {
84B0671E22F9B3FE006DDC18 = {
Expand Down Expand Up @@ -340,6 +340,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -401,6 +402,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -448,7 +450,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "com.schuetz.ios-app";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "/Users/ischuetz/dev/rust/rust_android_ios/ios_app/Rust-Bridging-Header.h";
SWIFT_OBJC_BRIDGING_HEADER = "Rust-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -470,9 +472,10 @@
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/core",
);
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.schuetz.ios-app";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "/Users/ischuetz/dev/rust/rust_android_ios/ios_app/Rust-Bridging-Header.h";
SWIFT_OBJC_BRIDGING_HEADER = "Rust-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

0 comments on commit 6cadc3b

Please sign in to comment.