2.2 KiB
Setting up MediaPipe for iOS
-
Install Xcode.
Follow Apple's instructions to obtain the required developemnt certificates and provisioning profiles for your iOS device.
-
Install Bazel.
See their instructions. We recommend using Homebrew:
brew tap bazelbuild/tap brew install bazelbuild/tap/bazel -
Clone the MediaPipe repository.
git clone https://github.com/google/mediapipe.git -
Symlink or copy your provisioning profile to
mediapipe/mediapipe/provisioning_profile.mobileprovision.cd mediapipe ln -s ~/Downloads/MyProvisioningProfile.mobileprovision mediapipe/provisioning_profile.mobileprovision
Creating an Xcode project
-
We will use a tool called Tulsi for generating Xcode projects from Bazel build configurations.
git clone https://github.com/bazelbuild/tulsi.git cd tulsi sh build_and_run.shThis will install Tulsi.app inside the Applications directory inside your home directory.
-
Open
mediapipe/Mediapipe.tulsiprojusing the Tulsi app. -
Select the MediaPipe config in the Configs tab, then press the Generate button below. You will be asked for a location to save the Xcode project. Once the project is generated, it will be opened in Xcode.
-
You can now select any of the MediaPipe demos in the target menu, and build and run them as normal.
Building an iOS app from the command line
-
Build one of the example apps for iOS. We will be using the Face Detection GPU App example
bazel build --config=ios_arm64 mediapipe/examples/ios/facedetectiongpu:FaceDetectionGpuAppYou may see a permission request from
codesignin order to sign the app. -
In Xcode, open the
Devices and Simulatorswindow (command-shift-2). -
Make sure your device is connected. You will see a list of installed apps. Press the "+" button under the list, and select the
.ipafile built by Bazel. -
You can now run the app on your device.