Pārlūkot izejas kodu

Document the madness

Andy Dill 5 gadi atpakaļ
vecāks
revīzija
e1f297214c
1 mainītis faili ar 22 papildinājumiem un 0 dzēšanām
  1. 22 0
      README.md

+ 22 - 0
README.md

@@ -0,0 +1,22 @@
1
+# rust-on-ios
2
+
3
+This is a quick proof-of-concept for a bitcode-enabled library built from Rust intended for consumption in an iOS app built in Unity (2018.4.11f1)
4
+
5
+Unity defaults to embedding bitcode meaning all static dependencies must do likewise. Rust, by default, does not embed bitcode for static library targets. We can use `-C lto -Z embed-bitcode` to ask Rust to embed bitcode (afaict `-C lto` is required because the shipped iOS rust-std libs also need to embed bitcode.)
6
+
7
+Naturally both Rust and Apple have forked LLVM and they are not always in-sync which is the current major problem [outlined here](https://github.com/rust-lang/rust/issues/35968). For Xcode 11.1 the latest Rust version we can use is `nightly-2019-07-17`.
8
+
9
+## Building
10
+
11
+- cd librusty
12
+- cargo install cargo-lipo
13
+- rustup target add aarch64-apple-ios
14
+- cargo lipo --targets aarch64-apple-ios --release
15
+- cp target/universal/release/librusty.a ../unity/Assets/Plugins/iOS/librusty.a
16
+
17
+## So, what?
18
+
19
+Until Rust officially decides to support bitcode we have to jump through hoops in order to do so:
20
+- We must use a specific (nightly) compiler version
21
+- Xcode betas/updates **may** break linkability of our static library
22
+- Downstream developers **may not** all be on the same (latest) version of Xcode