From 698eccf15e9a7d17ea8c86673da1fbabdade315a Mon Sep 17 00:00:00 2001 From: Guoyu Wang <62914304+gwang-msft@users.noreply.github.com> Date: Fri, 11 Sep 2020 16:10:36 -0700 Subject: [PATCH] Add iOS build instruction (#5125) * ios build instruction * fix logger issue in onnx_model_info * Revert "fix logger issue in onnx_model_info" This reverts commit 72f2b88256ccf29c75fefbcd1daf6b4dcf7e0c61. * Address comments and fix small issue in iOS build --- BUILD.md | 35 +++++++++++++++++++++++++++++++++++ cmake/CMakeLists.txt | 8 +++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index df099a8533..edd2118ba8 100644 --- a/BUILD.md +++ b/BUILD.md @@ -32,6 +32,7 @@ * [x86](#x86) * [ARM](#ARM) * [Android](#Android) + * [iOS](#iOS) **[Training](#Training)** @@ -1036,6 +1037,40 @@ Android NNAPI Execution Provider can be built using building commands in [Androi --- +### iOS + +#### Prerequisites +* A Mac computer with latest macOS +* Xcode, https://developer.apple.com/xcode/ +* CMake, https://cmake.org/download/ +* Python 3, https://www.python.org/downloads/mac-osx/ + +#### General Info: +* iOS Platforms + + The following two platforms are supported + * iOS device (iPhone, iPad) with arm64 architecture + * iOS simulator with x86_64 architecture + + armv7, armv7s and i386 architectures are not currently supported. +* apple_deploy_target + + Specify the minimum version of the target platform (iOS) on which the target binaries are to be deployed. + +#### Build Instructions +Run one of the following build scripts from the ONNX Runtime repository root, +##### Cross build for iOS device +``` +/build.sh --config --use_xcode \ + --ios --ios_sysroot iphoneos --osx_arch arm64 --apple_deploy_target 12 +``` +##### Cross build for iOS simulator +``` +/build.sh --config --use_xcode \ + --ios --ios_sysroot iphonesimulator --osx_arch x86_64 --apple_deploy_target 12 +``` +--- + ### AMD MIGraphX See more information on the MIGraphX Execution Provider [here](./docs/execution_providers/MIGraphX-ExecutionProvider.md). diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 316362ade4..97f3ceca02 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -14,7 +14,13 @@ endif() # Support OS X versions 10.12+ # This variable is ignored on non-Apple platforms and needs to be set prior to the first project(...) invocation # TODO: Make the miniumum deployment target MacOSX version configurable -set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version for ORT" FORCE) +# If the CMAKE_OSX_DEPLOYMENT_TARGET was set (currently valid only for iOS build), +# we will cache its value instead of the default "10.12" +if (NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version for ORT" FORCE) +else() + set(CMAKE_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET} CACHE STRING "Minimum OS X deployment version for ORT" FORCE) +endif() # Project project(onnxruntime C CXX)