[js/react_native] Fix a broken manual build (#10012)

* Fix a broken manual build

* Keep the same file structures
This commit is contained in:
Sunghoon 2021-12-13 19:02:10 -08:00 committed by GitHub
parent 7b63d1102b
commit 6de2a878cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 19 deletions

View file

@ -379,17 +379,17 @@ By default, ONNX Runtime React Native leverages ONNX Runtime Mobile package with
python tools/ci_build/github/apple/build_ios_framework.py tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json --config MinSizeRel --include_ops_by_config tools/ci_build/github/android/mobile_package.required_operators.config
```
It creates `onnxruntime.framework` in `build/iOS_framework/framework_out` directory. Create an archive file of `onnxruntime.framework` directory as follows and copy to `<ORT_ROOT>/js/react_native/local_pods` directory.
It creates `Headers`, `LICENSE`, and `onnxruntime.xcframework` in `build/iOS_framework/framework_out` directory. From `framework_out` directory, create an archive file named `onnxruntime-mobile-c.zip` as follows and copy to `<ORT_ROOT>/js/react_native/local_pods` directory.
```sh
zip -r onnxruntime-mobile-c.zip onnxruntime.framework
zip -r onnxruntime-mobile-c.zip .
```
4. To verify, open iOS Simulator and run this command from `<ORT_ROOT>/js/react_native/ios`. Change a destination to specify a running iOS Simulator.
```sh
pod install
xcodebuild test -workspace OnnxruntimeModule.xcworkspace -scheme OnnxruntimeModuleTest -destination 'platform=iOS Simulator,name=iPhone 11,OS=14.5'
xcodebuild test -workspace OnnxruntimeModule.xcworkspace -scheme OnnxruntimeModuleTest -destination 'platform=iOS Simulator,name=iPhone 11,OS=15.0'
```
4. Test an example for Android and iOS. In Windows, open Android Emulator first.

View file

@ -240,8 +240,6 @@
"${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
"${PODS_ROOT}/onnxruntime-mobile-c/onnxruntime.framework",
"${BUILT_PRODUCTS_DIR}/onnxruntime-react-native/onnxruntime_react_native.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@ -266,8 +264,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/onnxruntime.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/onnxruntime_react_native.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;

View file

@ -9,7 +9,10 @@ target 'OnnxruntimeModuleExample' do
use_react_native!(:path => config["reactNativePath"])
use_frameworks!
pod 'onnxruntime-mobile-c', :podspec => '../../onnxruntime-mobile-c.podspec'
if File.exist?('../../local_pods/onnxruntime-mobile-c.zip')
pod 'onnxruntime-mobile-c', :podspec => '../../onnxruntime-mobile-c.podspec'
end
pod 'onnxruntime-react-native', :path => '../..'
inherit! :search_paths

View file

@ -237,7 +237,7 @@
"${PODS_ROOT}/Target Support Files/Pods-OnnxruntimeModuleTest/Pods-OnnxruntimeModuleTest-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/DoubleConversion/DoubleConversion.framework",
"${BUILT_PRODUCTS_DIR}/FBReactNativeSpec/FBReactNativeSpec.framework",
"${BUILT_PRODUCTS_DIR}/Folly/folly.framework",
"${BUILT_PRODUCTS_DIR}/RCT-Folly/folly.framework",
"${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework",
"${BUILT_PRODUCTS_DIR}/React-Core/React.framework",
"${BUILT_PRODUCTS_DIR}/React-CoreModules/CoreModules.framework",
@ -253,10 +253,12 @@
"${BUILT_PRODUCTS_DIR}/React-jsi/jsi.framework",
"${BUILT_PRODUCTS_DIR}/React-jsiexecutor/jsireact.framework",
"${BUILT_PRODUCTS_DIR}/React-jsinspector/jsinspector.framework",
"${BUILT_PRODUCTS_DIR}/React-logger/logger.framework",
"${BUILT_PRODUCTS_DIR}/React-perflogger/reactperflogger.framework",
"${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/fmt/fmt.framework",
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
"${PODS_ROOT}/onnxruntime-mobile-c/onnxruntime.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@ -278,10 +280,12 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsi.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsireact.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsinspector.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/logger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/reactperflogger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fmt.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/onnxruntime.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;

View file

@ -5,17 +5,24 @@ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |spec|
spec.name = "onnxruntime-mobile-c"
spec.version = package["version"]
spec.summary = "ONNX Runtime C/C++ Package"
spec.summary = "ONNX Runtime Mobile C/C++ Pod"
spec.description = <<-DESC
ONNX Runtime C/C++ framework pod.
DESC
A pod for the ONNX Runtime Mobile C/C++ library.
DESC
spec.homepage = "https://github.com/microsoft/onnxruntime"
spec.license = { :type => 'MIT' }
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.authors = { "ONNX Runtime" => "onnxruntime@microsoft.com" }
spec.platform = :ios, '13.0'
spec.platform = :ios, '11.0'
# if you are going to use a file as the spec.source, add 'file:' before your file path
spec.source = { :http => 'file:' + __dir__ + '/local_pods/onnxruntime-mobile-c.zip' }
spec.vendored_frameworks = 'onnxruntime.framework'
spec.source_files = 'onnxruntime.framework/Headers/*.h'
end
spec.vendored_frameworks = "onnxruntime.xcframework"
spec.static_framework = true
spec.weak_framework = [ "CoreML" ]
spec.source_files = "Headers/*.h"
spec.preserve_paths = [ "LICENSE" ]
spec.library = "c++"
spec.pod_target_xcconfig = {
"OTHER_CPLUSPLUSFLAGS" => "-fvisibility=hidden -fvisibility-inlines-hidden",
}
end

View file

@ -3,6 +3,8 @@ require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |spec|
spec.static_framework = true
spec.name = "onnxruntime-react-native"
spec.version = package["version"]
spec.summary = package["description"]