Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOSのApp Storeへの申請を通るようにした #25

Merged
merged 10 commits into from
Jan 9, 2024
35 changes: 32 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ jobs:
echo "RELEASE_NAME=onnxruntime-ios-xcframework-${{ env.ONNXRUNTIME_VERSION }}" >> $GITHUB_ENV
echo "ONNXRUNTIME_BASENAME=libonnxruntime.${{ env.ONNXRUNTIME_VERSION }}.dylib" >> "$GITHUB_ENV"

- uses: actions/checkout@v3

- uses: actions/download-artifact@v2
with:
name: onnxruntime-ios-arm64
Expand All @@ -246,17 +248,44 @@ jobs:
rm -f artifact/onnxruntime-aarch64-apple-ios-sim/lib/*onnxruntime.dylib
rm -f artifact/onnxruntime-aarch64-apple-ios/lib/*onnxruntime.dylib

- name: Create aarch64 Framework
run: |
mkdir -p "Framework-aarch64"
cp -vr xcframework/Frameworks/aarch64/ Framework-aarch64/

lipo -create "artifact/onnxruntime-aarch64-apple-ios/lib/${{ env.ONNXRUNTIME_BASENAME }}" \
-output "Framework-aarch64/onnxruntime.framework/onnxruntime"

- name: Change aarch64 @rpath
run: |
install_name_tool -id "@rpath/onnxruntime.framework/onnxruntime" \
"Framework-aarch64/onnxruntime.framework/onnxruntime"

- name: Create fat binary
run: |
mkdir -p "artifact/onnxruntime-sim"
lipo -create "artifact/onnxruntime-x86_64-apple-ios/lib/${{ env.ONNXRUNTIME_BASENAME }}" "artifact/onnxruntime-aarch64-apple-ios-sim/lib/${{ env.ONNXRUNTIME_BASENAME }}" -output "artifact/onnxruntime-sim/${{ env.ONNXRUNTIME_BASENAME }}"
lipo -create "artifact/onnxruntime-x86_64-apple-ios/lib/${{ env.ONNXRUNTIME_BASENAME }}" \
"artifact/onnxruntime-aarch64-apple-ios-sim/lib/${{ env.ONNXRUNTIME_BASENAME }}" \
-output "artifact/onnxruntime-sim/onnxruntime"

- name: Create sim Framework
run: |
mkdir -p "Framework-sim"
cp -vr xcframework/Frameworks/sim/ Framework-sim/
cp -v "artifact/onnxruntime-sim/onnxruntime" \
"Framework-sim/onnxruntime.framework/onnxruntime"
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved

- name: Change sim @rpath
run: |
install_name_tool -id "@rpath/onnxruntime.framework/onnxruntime" \
"Framework-sim/onnxruntime.framework/onnxruntime"

- name: Create XCFramework
run: |
mkdir -p "artifact/${{ env.ONNXRUNTIME_BASENAME }}"
xcodebuild -create-xcframework \
-library "artifact/onnxruntime-sim/${{ env.ONNXRUNTIME_BASENAME }}" \
-library "artifact/onnxruntime-aarch64-apple-ios/lib/${{ env.ONNXRUNTIME_BASENAME }}" \
-framework Framework-sim/onnxruntime.framework \
-framework Framework-aarch64/onnxruntime.framework \
-output "artifact/${{ env.ONNXRUNTIME_BASENAME }}/onnxruntime.xcframework"

- name: Archive artifact
Expand Down
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
framework module onnxruntime {
export *

module * { export * }
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
framework module onnxruntime {
export *

module * { export * }
}
6 changes: 6 additions & 0 deletions xcframework/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# xcframeworkフォルダの内容について
## Frameworks

iOS向けの配布ライブラリXCFramework内のFrameworkを作るための雛形です。
雛形は端末用とシミュレータ用の2種類です。