Skip to content

Commit

Permalink
iOS向けXCFrameworkを追加する (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyodaKazuaki authored May 19, 2023
1 parent f302390 commit 55f5d89
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,64 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.ONNXRUNTIME_VERSION }} # ==> github.event.release.tag_name
file: ${{ env.RELEASE_NAME }}.tgz

build-xcframework:
needs: build-onnxruntime
runs-on: macos-12
steps:
- name: Generate RELEASE_NAME and ONNXRUNTIME_BASENAME
run: |
echo "RELEASE_NAME=onnxruntime-xcframework-${{ env.ONNXRUNTIME_VERSION }}" >> $GITHUB_ENV
echo "ONNXRUNTIME_BASENAME=libonnxruntime.${{ env.ONNXRUNTIME_VERSION }}.dylib" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v2
with:
name: onnxruntime-ios-arm64
path: artifact/onnxruntime-aarch64-apple-ios

- uses: actions/download-artifact@v2
with:
name: onnxruntime-ios-sim-arm64
path: artifact/onnxruntime-aarch64-apple-ios-sim

- uses: actions/download-artifact@v2
with:
name: onnxruntime-ios-sim-x86_64
path: artifact/onnxruntime-x86_64-apple-ios

- name: Remove no version notation dylib
shell: bash
run: |
rm -f artifact/onnxruntime-x86_64-apple-ios/lib/*onnxruntime.dylib
rm -f artifact/onnxruntime-aarch64-apple-ios-sim/lib/*onnxruntime.dylib
rm -f artifact/onnxruntime-aarch64-apple-ios/lib/*onnxruntime.dylib
- name: Create fat binary
shell: bash
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 }}"
- name: Create XCFramework
shell: bash
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 }}" \
-output "artifact/${{ env.ONNXRUNTIME_BASENAME }}/onnxruntime.xcframework"
- name: Archive artifact
shell: bash
run: |
cd artifact/${{ env.ONNXRUNTIME_BASENAME }}
7z a "../../${{ env.RELEASE_NAME }}.zip" "onnxruntime.xcframework"
- name: Upload to Release
if: env.RELEASE == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.ONNXRUNTIME_VERSION }} # ==> github.event.release.tag_name
file: ${{ env.RELEASE_NAME }}.zip

0 comments on commit 55f5d89

Please sign in to comment.