You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While we're working on making it a smoother experience, here is an early workflow to try out cross compilation for iOS.
145
-
```
146
-
Only supported in macOS:
147
-
148
-
Prerequisites:
149
-
-[XCode](https://developer.apple.com/xcode/)
150
-
151
-
After XCode is installed,
152
-
153
-
1. Get the iOS cmake toolchain by using one of the following options:
154
-
- Option 1 [recommended] : use the `ios.toolchain.cmake` from the following github repo:
155
-
156
-
```bash
157
-
git clone https://github.com/leetal/ios-cmake.git
158
-
```
159
143
160
-
- Option2 [wip], use the `iOS.cmake` from PyTorch, the
161
-
toolchain is located in`executorch/third-party/pytorch/pytorch/blob/main/cmake/iOS.cmake`
144
+
For iOS we'll build [frameworks](https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle) instead of static libraries, that will also contain the public headers inside.
162
145
146
+
1. Install Xcode from the
147
+
[Mac App Store](https://apps.apple.com/app/xcode/id497799835) and then install
148
+
the Command Line Tools using the terminal:
163
149
164
-
2. Use the tool chain provided in the repro to build the ExecuTorch library.
# Create an include folder in cmake-ios-out to include all header files
172
-
mkdir include
173
-
cp -r ../runtime include
174
-
cp -r ../extension include
175
-
cp -r ../utils include
176
-
```
154
+
2. Build the frameworks:
177
155
156
+
```bash
157
+
./build/build_apple_frameworks.sh
158
+
```
178
159
179
-
3. XCode setup
160
+
Run the above command with `--help` flag to learn more on how to build additional backends
161
+
(like [Core ML](build-run-coreml.md), [MPS](build-run-mps.md) or XNNPACK), etc.
162
+
Note, some backends may require additional dependencies and certain versions of Xcode and iOS.
180
163
181
-
If using the iOS cmake tool chain from `https://github.com/leetal/ios-cmake.git`, after build is complete, perform the following steps:
164
+
3. Copy over the generated `.xcframework` bundles to your Xcode project, link them against
165
+
your targets and don't forget to add an extra linker flag `-all_load`.
182
166
183
-
1. Open the project in XCode, drag the `executorch.xcodeproj` generated from Step 2 to `Frameworks`.
184
-
1. Go to project Target’s `Build Phases` - `Link Binaries With Libraries`, click the **+** sign and add all the library files located in`cmake-ios-out/build`.
185
-
1. Navigate to the project `Build Settings`:
186
-
- Set the value **Header Search Paths** to `cmake-ios-out/include`.
187
-
- Set **Library Search Paths** to `cmake-ios-out/build`.
188
-
- In **other linker flags**, add a custom linker flag `-all_load.`
167
+
Check out the [iOS Demo App](demo-apps-ios.md) tutorial for more info.
0 commit comments