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
51 changes: 51 additions & 0 deletions xcframework/Frameworks/aarch64/onnxruntime.framework/Info.plist
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>23B81</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>onnxruntime</string>
<key>CFBundleIdentifier</key>
<string>jp.hiroshiba.voicevox.onnxruntime</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>onnxruntime</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneSimulator</string>
</array>
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>21C52</string>
<key>DTPlatformName</key>
<string>iphonesimulator</string>
<key>DTPlatformVersion</key>
<string>17.2</string>
<key>DTSDKBuild</key>
<string>21C52</string>
<key>DTSDKName</key>
<string>iphonesimulator17.2</string>
<key>DTXcode</key>
<string>1510</string>
<key>DTXcodeBuild</key>
<string>15C65</string>
<key>MinimumOSVersion</key>
<string>16.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
framework module onnxruntime {
export *

module * { export * }
}
51 changes: 51 additions & 0 deletions xcframework/Frameworks/sim/onnxruntime.framework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>23B81</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>onnxruntime</string>
<key>CFBundleIdentifier</key>
<string>jp.hiroshiba.voicevox.onnxruntime</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>onnxruntime</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneSimulator</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>21C52</string>
<key>DTPlatformName</key>
<string>iphonesimulator</string>
<key>DTPlatformVersion</key>
<string>17.2</string>
<key>DTSDKBuild</key>
<string>21C52</string>
<key>DTSDKName</key>
<string>iphonesimulator17.2</string>
<key>DTXcode</key>
<string>1510</string>
<key>DTXcodeBuild</key>
<string>15C65</string>
<key>MinimumOSVersion</key>
<string>16.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
</plist>
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種類です。