diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b573fe1..c68ac96 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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" + + - 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 diff --git a/xcframework/Frameworks/aarch64/onnxruntime.framework/Info.plist b/xcframework/Frameworks/aarch64/onnxruntime.framework/Info.plist new file mode 100644 index 0000000..be5bf54 --- /dev/null +++ b/xcframework/Frameworks/aarch64/onnxruntime.framework/Info.plist @@ -0,0 +1,55 @@ + + + + + BuildMachineOSBuild + 23B81 + CFBundleDevelopmentRegion + en + CFBundleExecutable + onnxruntime + CFBundleIdentifier + jp.hiroshiba.voicevox.onnxruntime + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + onnxruntime + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSupportedPlatforms + + iPhoneOS + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 21C52 + DTPlatformName + iphoneos + DTPlatformVersion + 17.2 + DTSDKBuild + 21C52 + DTSDKName + iphoneos17.2 + DTXcode + 1510 + DTXcodeBuild + 15C65 + MinimumOSVersion + 16.0 + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + + diff --git a/xcframework/Frameworks/aarch64/onnxruntime.framework/Modules/module.modulemap b/xcframework/Frameworks/aarch64/onnxruntime.framework/Modules/module.modulemap new file mode 100644 index 0000000..3d3962a --- /dev/null +++ b/xcframework/Frameworks/aarch64/onnxruntime.framework/Modules/module.modulemap @@ -0,0 +1,5 @@ +framework module onnxruntime { + export * + + module * { export * } +} diff --git a/xcframework/Frameworks/sim/onnxruntime.framework/Info.plist b/xcframework/Frameworks/sim/onnxruntime.framework/Info.plist new file mode 100644 index 0000000..a6e8e87 --- /dev/null +++ b/xcframework/Frameworks/sim/onnxruntime.framework/Info.plist @@ -0,0 +1,51 @@ + + + + + BuildMachineOSBuild + 23B81 + CFBundleDevelopmentRegion + en + CFBundleExecutable + onnxruntime + CFBundleIdentifier + jp.hiroshiba.voicevox.onnxruntime + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + onnxruntime + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSupportedPlatforms + + iPhoneSimulator + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 21C52 + DTPlatformName + iphonesimulator + DTPlatformVersion + 17.2 + DTSDKBuild + 21C52 + DTSDKName + iphonesimulator17.2 + DTXcode + 1510 + DTXcodeBuild + 15C65 + MinimumOSVersion + 16.0 + UIDeviceFamily + + 1 + 2 + + + diff --git a/xcframework/Frameworks/sim/onnxruntime.framework/Modules/module.modulemap b/xcframework/Frameworks/sim/onnxruntime.framework/Modules/module.modulemap new file mode 100644 index 0000000..3d3962a --- /dev/null +++ b/xcframework/Frameworks/sim/onnxruntime.framework/Modules/module.modulemap @@ -0,0 +1,5 @@ +framework module onnxruntime { + export * + + module * { export * } +} diff --git a/xcframework/README.md b/xcframework/README.md new file mode 100644 index 0000000..3dda8f3 --- /dev/null +++ b/xcframework/README.md @@ -0,0 +1,6 @@ +# xcframeworkフォルダの内容について +## Frameworks + +iOS向けの配布ライブラリXCFramework内のFrameworkを作るための雛形です。 +雛形は端末用とシミュレータ用の2種類です。 +