Skip to content

Support FFMPEG for windows (x64, arm64), linux (x64, arm64), macos (x64, arm64), android, ios #5

Support FFMPEG for windows (x64, arm64), linux (x64, arm64), macos (x64, arm64), android, ios

Support FFMPEG for windows (x64, arm64), linux (x64, arm64), macos (x64, arm64), android, ios #5

Workflow file for this run

name: apple
# on: pull_request
on:
push:
tags:
- '*'
pull_request:
branches: ["main"]
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
IOS_DEPLOYMENT_TARGET: '13.0'
MAC_DEPLOYMENT_TARGET: '11.0'
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
EMSCRIPTEN_VERSION: 3.1.28
permissions:
contents: read
jobs:
ios:
runs-on: macos-13
strategy:
matrix:
opencv-version: [4.10.0]
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/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 \
-DOPENCV_EXTRA_MODULES_PATH="../../opencv_contrib/modules" \
steps:
- uses: actions/checkout@v4
- name: setup-opencv-source
run: |
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv.git opencv
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv_contrib.git opencv_contrib
echo "SOURCE_DIR=opencv" >> $GITHUB_ENV
echo "PACKAGE_NAME=opencv-ios" >> $GITHUB_ENV
echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> $GITHUB_ENV
- name: build-arm64
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build-arm64 && cd build-arm64
cmake ${{ env.COMMON_CMAKE_OPTIONS }} \
`cat ../../options.txt` -DPLATFORM=OS64 \
-DWITH_OPENCL=OFF -DWITH_OPENCL_SVM=OFF ..
cmake --build . -j 4
cmake --build . --target install
- name: package
run: |
rm -f ${{ env.PACKAGE_NAME }}.zip
zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip ${{ env.SOURCE_DIR }}/build-arm64/install/
- name: test
run: |
cd test
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=OS64 \
-DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.SOURCE_DIR }}/build/install/${{ env.OPENCV_SUBDIR }} ..
cmake --build . -j 4
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.zip
ios-simulator:
runs-on: macos-13
strategy:
matrix:
opencv-version: [4.10.0]
platform: [SIMULATOR64, SIMULATORARM64]
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/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 \
-DOPENCV_EXTRA_MODULES_PATH="../../opencv_contrib/modules" \
steps:
- uses: actions/checkout@v4
- name: setup-opencv-source
run: |
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv.git opencv
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv_contrib.git opencv_contrib
echo "SOURCE_DIR=opencv" >> $GITHUB_ENV
echo "PACKAGE_NAME=opencv-ios-${{ matrix.platform }}" >> $GITHUB_ENV
echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> $GITHUB_ENV
- name: build
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} \
`cat ../../options.txt` -DPLATFORM=${{ matrix.platform }} \
-DWITH_OPENCL=OFF -DWITH_OPENCL_SVM=OFF \
-DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON ..
cmake --build . -j 4
cmake --build . --target install
- name: package
run: |
rm -f ${{ env.PACKAGE_NAME }}.zip
zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip ${{ env.SOURCE_DIR }}/build/install/
- name: test
run: |
cd test
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=${{ matrix.platform }} \
-DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.SOURCE_DIR }}/build/install/${{ env.OPENCV_SUBDIR }} ..
cmake --build . -j 4
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.zip
macos:
strategy:
matrix:
opencv-version: [4.10.0]
osname:
- {os: macos-13, name: x86_64, platform: MAC}
- {os: macos-14, name: arm64, platform: MAC_ARM64}
runs-on: ${{ matrix.osname.os }}
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=OFF \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOPENCV_EXTRA_MODULES_PATH="../../opencv_contrib/modules" \
steps:
- uses: actions/checkout@v4
- name: setup-opencv-source
run: |
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv.git opencv
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv_contrib.git opencv_contrib
echo "SOURCE_DIR=opencv" >> $GITHUB_ENV
echo "PACKAGE_NAME=opencv-${{ matrix.osname.platform }}" >> $GITHUB_ENV
echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> $GITHUB_ENV
- name: build
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=${{ matrix.osname.platform }} \
`cat ../../options.txt` ..
cmake --build . -j 4
cmake --build . --target install
- name: package
run: |
rm -f ${{ env.PACKAGE_NAME }}.zip
zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip ${{ env.SOURCE_DIR }}/build/install/
- name: test
run: |
cd test
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=${{ matrix.osname.platform }} \
-DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.SOURCE_DIR }}/build/install/${{ env.OPENCV_SUBDIR }} ..
cmake --build . -j 4
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.zip
# apple:
# needs: [macos, ios, ios-simulator]
# runs-on: macos-13
# strategy:
# matrix:
# opencv-version: [4.10.0]
# steps:
# - run: sudo xcode-select --switch /Applications/Xcode_15.2.app
# - uses: actions/checkout@v4
# - name: setup-opencv-package
# run: |
# echo "MACOS_PACKAGE_NAME=opencv-macos" >> $GITHUB_ENV
# echo "IOS_PACKAGE_NAME=opencv-ios" >> $GITHUB_ENV
# echo "IOS_SIMULATOR_PACKAGE_NAME=opencv-ios-simulator" >> $GITHUB_ENV
# echo "PACKAGE_NAME=opencv-apple" >> $GITHUB_ENV
# - name: download-macos-package
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.MACOS_PACKAGE_NAME }}
# - name: download-ios-package
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.IOS_PACKAGE_NAME }}
# - name: download-ios-simulator-package
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.IOS_SIMULATOR_PACKAGE_NAME }}
# - name: create-xcframwork
# run: |
# mkdir -p ${{ env.MACOS_PACKAGE_NAME }}
# mkdir -p ${{ env.IOS_PACKAGE_NAME }}
# mkdir -p ${{ env.IOS_SIMULATOR_PACKAGE_NAME }}
# unzip -q ${{ env.MACOS_PACKAGE_NAME }}.zip -d ${{ env.MACOS_PACKAGE_NAME }}
# unzip -q ${{ env.IOS_PACKAGE_NAME }}.zip -d ${{ env.IOS_PACKAGE_NAME }}
# unzip -q ${{ env.IOS_SIMULATOR_PACKAGE_NAME }}.zip -d ${{ env.IOS_SIMULATOR_PACKAGE_NAME }}
# xcodebuild -create-xcframework \
# -framework ${{ env.MACOS_PACKAGE_NAME }}/opencv2.framework \
# -framework ${{ env.IOS_PACKAGE_NAME }}/opencv2.framework \
# -framework ${{ env.IOS_SIMULATOR_PACKAGE_NAME }}/opencv2.framework \
# -output opencv2.xcframework
# rm -f ${{ env.PACKAGE_NAME }}.zip
# zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.xcframework
# - name: upload-zip
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.PACKAGE_NAME }}
# path: ${{ env.PACKAGE_NAME }}.zip
release:
permissions:
contents: write # for softprops/action-gh-release to create a release
needs: [ios, ios-simulator, macos]
runs-on: ubuntu-latest
steps:
- name: download
uses: actions/download-artifact@v4
with:
path: artifacts
- 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/*/*.zip