Skip to content

support linux arm64, windows arm64 ios simulator arm64 #38

support linux arm64, windows arm64 ios simulator arm64

support linux arm64, windows arm64 ios simulator arm64 #38

Workflow file for this run

name: apple
on:
push:
tags:
- "v*.*.*"
pull_request:
branches: [ "main" ]
env:
IOS_DEPLOYMENT_TARGET: '11.0'
MAC_DEPLOYMENT_TARGET: '10.15'
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
FFMPEG_ROOT: /tmp/ffmpeg
jobs:
macos:
name: macos
strategy:
matrix:
osname:
- {os: macos-13, arch: x64, platform: MAC}
- {os: macos-14, arch: arm64, platform: MAC_ARM64}
runs-on: ${{ matrix.osname.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: setup
run: |
brew install --force --overwrite ninja ccache nasm
- uses: robinraju/[email protected]
with:
repository: "rainyl/opencv.full"
latest: true
fileName: "libopencv-macos-${{ matrix.osname.arch }}.tar.gz"
out-file-path: "build/opencv"
extract: true
- name: setup ffmpeg
run: |
mkdir -p ${{ env.FFMPEG_ROOT }}
cp -rf ${{ github.workspace }}/build/opencv/ffmpeg/* ${{ env.FFMPEG_ROOT }}
- name: build
run: |
cd build
cmake -S ${{ github.workspace }} \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM=${{ matrix.osname.platform }} \
-DCVD_PLATFORM_INSTALL_DIR="${{ github.workspace }}/macos" \
-DFFMPEG_DIR=${{ github.workspace }}/build/opencv/ffmpeg/cmake \
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/lib/cmake/opencv4
cmake --build . --config Release --target install
- name: package
run: |
tar -C build/install -zcvf libopencv_dart-macos-${{ matrix.osname.arch }}.tar.gz .
- uses: actions/upload-artifact@v4
name: upload
with:
path: build/install/libopencv_dart.dylib
name: libopencv_dart-macos-${{ matrix.osname.arch }}
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.6'
channel: "stable"
- name: test
run: |
export DYLD_LIBRARY_PATH="${{github.workspace}}/linux:$DYLD_LIBRARY_PATH"
dart pub get
dart test -x skip-workflow,no-local-files
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
files: |
libopencv_dart-macos-${{ matrix.osname.arch }}.tar.gz
release:
permissions:
contents: write # for softprops/action-gh-release to create a release
needs: [macos]
runs-on: macos-14
steps:
- name: download
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: libopencv_dart-macos-*
merge-multiple: false
- name: lipo
run: |
ls -R
cd artifacts
lipo -create -output libopencv_dart.dylib */libopencv_dart.dylib
lipo -info libopencv_dart.dylib
tar -zcvf libopencv_dart-macos-os64.tar.gz libopencv_dart.dylib
- name: create-release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
files: artifacts/libopencv_dart-macos-os64.tar.gz
ios:
name: ios
runs-on: macos-14
env:
IOS_ARM64: iosarm64
IOSSIMULATOR_X64: simulator64
IOSSIMULATOR_ARM64: simulatorarm64
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: robinraju/[email protected]
with:
repository: "rainyl/opencv.full"
latest: true
fileName: "libopencv-iossimulator-x64.tar.gz"
out-file-path: "build/opencv/${{ env.IOSSIMULATOR_X64 }}"
extract: true
- uses: robinraju/[email protected]
with:
repository: "rainyl/opencv.full"
latest: true
fileName: "libopencv-iossimulator-arm64.tar.gz"
out-file-path: "build/opencv/${{ env.IOSSIMULATOR_ARM64 }}"
extract: true
- uses: robinraju/[email protected]
with:
repository: "rainyl/opencv.full"
latest: true
fileName: "libopencv-ios-arm64.tar.gz"
out-file-path: "build/opencv/${{ env.IOS_ARM64 }}"
extract: true
- name: build_simulator64
run: |
rm -rf ${{ env.FFMPEG_ROOT}}
cp -rf ${{ github.workspace }}/build/opencv/${{ env.IOSSIMULATOR_X64 }}/ffmpeg ${{ env.FFMPEG_ROOT}}
mkdir -p build/${{ env.IOSSIMULATOR_X64 }} && cd build/${{ env.IOSSIMULATOR_X64 }}
cmake -S ${{ github.workspace }} \
${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR64 \
-DFFMPEG_DIR=${{ env.FFMPEG_ROOT}}/cmake \
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/${{ env.IOSSIMULATOR_X64 }}/lib/cmake/opencv4
cmake --build . --config Release --target install
- name: build_simulatorarm64
run: |
rm -rf ${{ env.FFMPEG_ROOT}}
cp -rf ${{ github.workspace }}/build/opencv/${{ env.IOSSIMULATOR_ARM64 }}/ffmpeg ${{ env.FFMPEG_ROOT}}
mkdir -p build/${{ env.IOSSIMULATOR_ARM64 }} && cd build/${{ env.IOSSIMULATOR_ARM64 }}
cmake -S ${{ github.workspace }} \
${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64 \
-DFFMPEG_DIR=${{ env.FFMPEG_ROOT}}/cmake \
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/${{ env.IOSSIMULATOR_ARM64 }}/lib/cmake/opencv4
cmake --build . --config Release --target install
- name: build_os64
run: |
rm -rf ${{ env.FFMPEG_ROOT}}
cp -rf ${{ github.workspace }}/build/opencv/${{ env.IOS_ARM64 }}/ffmpeg ${{ env.FFMPEG_ROOT}}
mkdir -p build/${{ env.IOS_ARM64 }} && cd build/${{ env.IOS_ARM64 }}
cmake -S ${{ github.workspace }} \
${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=OS64 \
-DFFMPEG_DIR=${{ env.FFMPEG_ROOT}}/cmake \
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/${{ env.IOS_ARM64 }}/lib/cmake/opencv4
cmake --build . --config Release --target install
- name: package
run: |
xcodebuild -create-xcframework \
-framework build/${{ env.IOS_ARM64 }}/install/opencv_dart.framework \
-framework build/${{ env.IOSSIMULATOR_X64 }}/install/opencv_dart.framework \
-framework build/${{ env.IOSSIMULATOR_ARM64 }}/install/opencv_dart.framework \
-output opencv_dart.xcframework
tar -zcvf libopencv_dart-ios-os64.tar.gz opencv_dart.xcframework
- uses: actions/upload-artifact@v4
name: upload
with:
path: libopencv_dart-ios-os64.tar.gz
name: libopencv_dart-ios-os64.tar.gz
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
files: |
libopencv_dart-ios-os64.tar.gz