|
| 1 | +name: Build OpenCV iOS xcframework |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + build-ios-framework: |
| 6 | + runs-on: macos-latest-xlarge |
| 7 | + strategy: |
| 8 | + fail-fast: false |
| 9 | + matrix: |
| 10 | + include: |
| 11 | + - platform: iphoneos |
| 12 | + archs: arm64 |
| 13 | + output: iphoneos |
| 14 | + arch_flag: --iphoneos_archs |
| 15 | + - platform: iphonesimulator |
| 16 | + archs: arm64 |
| 17 | + output: iphonesimulator |
| 18 | + arch_flag: --iphonesimulator_archs |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: recursive |
| 23 | + |
| 24 | + - name: Build Release |
| 25 | + env: |
| 26 | + IPHONEOS_DEPLOYMENT_TARGET: "17.0" |
| 27 | + run: |- |
| 28 | + mkdir -p out/${{ matrix.output }} |
| 29 | + python3 platforms/ios/build_framework.py --iphoneos_deployment_target $IPHONEOS_DEPLOYMENT_TARGET --contrib opencv_contrib --build_only_specified_archs ${{ matrix.arch_flag }} ${{ matrix.archs }} --without stitching out/${{ matrix.output }} |
| 30 | + zip --symlinks -r opencv_ios_${{ matrix.output }}.zip out/${{ matrix.output }}/opencv2.framework |
| 31 | + zip --symlinks -r opencv_ios_${{ matrix.output }}_build_data.zip out/${{ matrix.output }}/build |
| 32 | + - uses: actions/upload-artifact@v4 |
| 33 | + with: |
| 34 | + name: ios_${{ matrix.output }}_framework |
| 35 | + path: opencv_ios_${{ matrix.output }}.zip |
| 36 | + - uses: actions/upload-artifact@v4 |
| 37 | + with: |
| 38 | + name: ios_${{ matrix.output }}_build_data |
| 39 | + path: opencv_ios_${{ matrix.output }}_build_data.zip |
| 40 | + |
| 41 | + package-ios: |
| 42 | + runs-on: macos-latest-xlarge |
| 43 | + needs: build-ios-framework |
| 44 | + steps: |
| 45 | + - uses: actions/download-artifact@v4 |
| 46 | + with: |
| 47 | + name: ios_iphoneos_framework |
| 48 | + - uses: actions/download-artifact@v4 |
| 49 | + with: |
| 50 | + name: ios_iphonesimulator_framework |
| 51 | + - name: Create xcframework |
| 52 | + run: |- |
| 53 | + unzip opencv_ios_iphoneos.zip |
| 54 | + unzip opencv_ios_iphonesimulator.zip |
| 55 | + mkdir -p out/xcframework |
| 56 | + xcodebuild -create-xcframework -framework out/iphoneos/opencv2.framework -framework out/iphonesimulator/opencv2.framework -output out/xcframework/opencv2.xcframework |
| 57 | + zip --symlinks -r opencv_ios_xcframework.zip out/xcframework/opencv2.xcframework |
| 58 | + - uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: ios_lib |
| 61 | + path: opencv_ios_xcframework.zip |
0 commit comments