mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Update iOS packaging script to default build static framework, disable bitcode (#8533)
* default package build to static, disable bitcode * fix pipeline failure * Address CR comments
This commit is contained in:
parent
ad093b94b9
commit
464fd28ee9
4 changed files with 8 additions and 4 deletions
|
|
@ -330,8 +330,6 @@ def parse_arguments():
|
|||
help="Specify the minimum version of the target platform "
|
||||
"(e.g. macOS or iOS)"
|
||||
"This is only supported on MacOS")
|
||||
parser.add_argument("--apple_disable_bitcode", action='store_true',
|
||||
help="Disable bitcode for iOS, bitcode is by default enabled for iOS.")
|
||||
|
||||
# WebAssembly build
|
||||
parser.add_argument("--build_wasm", action='store_true', help="Build for WebAssembly")
|
||||
|
|
@ -909,7 +907,6 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, cudnn_home
|
|||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=" + args.apple_deploy_target,
|
||||
# we do not need protoc binary for ios cross build
|
||||
"-Dprotobuf_BUILD_PROTOC_BINARIES=OFF",
|
||||
"-Donnxruntime_ENABLE_BITCODE=" + ("OFF" if args.apple_disable_bitcode else "ON"),
|
||||
"-DCMAKE_TOOLCHAIN_FILE=" + (
|
||||
args.ios_toolchain_file if args.ios_toolchain_file
|
||||
else "../cmake/onnxruntime_ios.toolchain.cmake")
|
||||
|
|
|
|||
|
|
@ -72,7 +72,9 @@ def _build_package(args):
|
|||
|
||||
# get the compiled lib path
|
||||
framework_dir = os.path.join(
|
||||
build_dir_current_arch, build_config, build_config + "-" + sysroot, 'onnxruntime.framework')
|
||||
build_dir_current_arch, build_config, build_config + "-" + sysroot,
|
||||
'onnxruntime.framework' if args.build_dynamic_framework
|
||||
else os.path.join('static_framework', 'onnxruntime.framework'))
|
||||
ort_libs.append(os.path.join(framework_dir, 'onnxruntime'))
|
||||
|
||||
# We only need to copy Info.plist, framework_info.json, and headers once since they are the same
|
||||
|
|
@ -125,6 +127,9 @@ def parse_args():
|
|||
parser.add_argument('build_settings_file', type=pathlib.Path,
|
||||
help='Provide the file contains settings for building iOS framework')
|
||||
|
||||
parser.add_argument("--build_dynamic_framework", action='store_true',
|
||||
help="Build Dynamic Framework (default is build static framework).")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.build_settings_file.resolve().is_file():
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ Pod::Spec.new do |spec|
|
|||
spec.summary = "ONNX Runtime Mobile C/C++ Pod"
|
||||
spec.platform = :ios, "@IOS_DEPLOYMENT_TARGET@"
|
||||
spec.vendored_frameworks = "onnxruntime.framework"
|
||||
spec.static_framework = true
|
||||
spec.weak_framework = [ @WEAK_FRAMEWORK@ ]
|
||||
spec.source_files = "onnxruntime.framework/Headers/*.h"
|
||||
spec.preserve_paths = [ @LICENSE_FILE@ ]
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '@IOS_DEPLOYMENT_TARGET@'
|
||||
s.preserve_paths = [ @LICENSE_FILE@ ]
|
||||
s.default_subspec = "Core"
|
||||
s.static_framework = true
|
||||
|
||||
s.subspec "Core" do |core|
|
||||
core.dependency "onnxruntime-mobile-c", "#{s.version}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue