From 79a6727a020e6ece3d8a15f1456f8f167b291fa6 Mon Sep 17 00:00:00 2001 From: Guoyu Wang <62914304+gwang-msft@users.noreply.github.com> Date: Wed, 2 Jun 2021 11:30:05 -0700 Subject: [PATCH] Add podspec template for ios package, update build settings (#7907) * Add podspec template for ios package * minor formatting update * Add spec.source_files for header files * Update spec.public_header_files to spec.source_files * minor update --- cmake/onnxruntime.cmake | 6 ++++- .../onnxruntime-mobile.podspec.template | 23 ++++++++++--------- ...t_mobile_ios_framework_build_settings.json | 3 ++- .../onnxruntime-mobile-c.podspec.template | 16 +++++++++++++ 4 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 tools/ci_build/github/apple/onnxruntime-mobile-c.podspec.template diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake index ec7f2b06de..0d3d05d96f 100644 --- a/cmake/onnxruntime.cmake +++ b/cmake/onnxruntime.cmake @@ -66,10 +66,14 @@ elseif(onnxruntime_BUILD_APPLE_FRAMEWORK) "${CMAKE_CURRENT_BINARY_DIR}/generated_source.c" ) + # create Info.plist for the framework and podspec for CocoaPods (optional) set(MACOSX_FRAMEWORK_NAME "onnxruntime") set(MACOSX_FRAMEWORK_IDENTIFIER "com.microsoft.onnxruntime") configure_file(${REPO_ROOT}/cmake/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) - + configure_file( + ${REPO_ROOT}/tools/ci_build/github/apple/onnxruntime-mobile-c.podspec.template + ${CMAKE_CURRENT_BINARY_DIR}/onnxruntime-mobile-c.podspec + ) set_target_properties(onnxruntime PROPERTIES FRAMEWORK TRUE FRAMEWORK_VERSION A diff --git a/onnxruntime/test/platform/ios/ios_package_test/onnxruntime-mobile.podspec.template b/onnxruntime/test/platform/ios/ios_package_test/onnxruntime-mobile.podspec.template index d3263e7d50..b5968f4f14 100644 --- a/onnxruntime/test/platform/ios/ios_package_test/onnxruntime-mobile.podspec.template +++ b/onnxruntime/test/platform/ios/ios_package_test/onnxruntime-mobile.podspec.template @@ -1,18 +1,19 @@ # This pod spec template is used to generate podspec file for running ios_package_test project, # this is not a podspec template used by onnxruntime-mobile official CocoaPods package Pod::Spec.new do |spec| - spec.name = "onnxruntime-mobile" - spec.version = "${ORT_VERSION}" - spec.summary = "Onnx Runtime C/C++ Package" - spec.description = <<-DESC - Onnx Runtime C/C++ framework pod. + spec.name = "onnxruntime-mobile" + spec.version = "${ORT_VERSION}" + spec.summary = "ONNX Runtime C/C++ Package" + spec.description = <<-DESC + ONNX Runtime C/C++ framework pod. DESC - spec.homepage = "https://github.com/microsoft/onnxruntime" - spec.license = { :type => 'MIT' } - spec.authors = { "ONNX Runtime" => "onnxruntime@microsoft.com" } - spec.platform = :ios, '13.0' + spec.homepage = "https://github.com/microsoft/onnxruntime" + spec.license = { :type => 'MIT' } + spec.authors = { "ONNX Runtime" => "onnxruntime@microsoft.com" } + spec.platform = :ios, '13.0' # if you are going to use a file as the spec.source, add 'file:' before your file path - spec.source = { :http => '${ORT_BASE_FRAMEWORK_ARCHIVE}' } - spec.vendored_frameworks = 'onnxruntime.framework' + spec.source = { :http => '${ORT_BASE_FRAMEWORK_ARCHIVE}' } + spec.vendored_frameworks = 'onnxruntime.framework' + spec.source_files = 'onnxruntime.framework/Headers/*.h' end diff --git a/tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json b/tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json index 51ca753509..da97470d64 100644 --- a/tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json +++ b/tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json @@ -14,11 +14,12 @@ "--parallel", "--use_xcode", "--build_apple_framework", - "--minimal_build", + "--minimal_build=extended", "--disable_rtti", "--disable_ml_ops", "--disable_exceptions", "--enable_reduced_operator_type_support", + "--use_coreml", "--skip_tests", "--apple_deploy_target=11.0" ] diff --git a/tools/ci_build/github/apple/onnxruntime-mobile-c.podspec.template b/tools/ci_build/github/apple/onnxruntime-mobile-c.podspec.template new file mode 100644 index 0000000000..4cde006ab4 --- /dev/null +++ b/tools/ci_build/github/apple/onnxruntime-mobile-c.podspec.template @@ -0,0 +1,16 @@ +Pod::Spec.new do |spec| + spec.name = "onnxruntime-mobile-c" + spec.version = "${ORT_VERSION}" + spec.authors = { "ONNX Runtime" => "onnxruntime@microsoft.com" } + spec.license = { :type => "MIT" } + spec.homepage = "https://github.com/microsoft/onnxruntime" + spec.source = { :http => "_ORT_DOWNLOAD_URL_" } + spec.summary = "ONNX Runtime Mobile C/C++ Pod" + spec.platform = :ios, "${CMAKE_OSX_DEPLOYMENT_TARGET}" + spec.vendored_frameworks = "onnxruntime.framework" + spec.weak_framework = 'CoreML' + spec.source_files = 'onnxruntime.framework/Headers/*.h' + spec.description = <<-DESC + A preview pod for ONNX Runtime Mobile C/C++ library. Pods for Objective-C and Swift coming soon. + DESC +end