Skip to content

exclude system paths from ffmpeg search path #59

exclude system paths from ffmpeg search path

exclude system paths from ffmpeg search path #59

Workflow file for this run

name: android
on:
push:
tags:
- "*"
pull_request:
branches: ["main"]
env:
ANDROID_PLATFORM: android-24 # NDK Camera is only available sine Android 24
FFMPEG_ROOT: /tmp/ffmpeg
SOURCE_DIR: opencv
jobs:
android:
runs-on: ubuntu-latest
strategy:
matrix:
opencv-version: [4.10.0]
abi: [armeabi-v7a, arm64-v8a, x86_64, x86]
env:
PACKAGE_NAME: libopencv-android-${{ matrix.abi }}
COMMON_CMAKE_OPTIONS: |
-DCMAKE_POLICY_DEFAULT_CMP0057=NEW \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False \
-DANDROID_PLATFORM=$ANDROID_PLATFORM \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_STL=c++_static \
-DANDROID_ABI=${{ matrix.abi }} \
-DANDROID_ARM_NEON=ON \
-DPARALLEL_ENABLE_PLUGINS=OFF \
-DOPENCV_EXTRA_MODULES_PATH="${{ github.workspace }}/opencv_contrib/modules" \
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW \
-DWITH_ANDROID_MEDIANDK=ON \
-DWITH_IPP=OFF \
steps:
- uses: actions/checkout@v4
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
- name: setup-opencv-source
run: |
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv.git ${{ env.SOURCE_DIR }}
git apply -p 0 patches/opencv-4.10.0-detect_ffmpeg.patch
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv_contrib.git opencv_contrib
- name: setup ffmpeg
run: |
wget -q -O ffmpeg.tar.xz https://sourceforge.net/projects/avbuild/files/android/ffmpeg-6.1-android-lite.tar.xz
mkdir -p tmp
tar xf ffmpeg.tar.xz -C tmp --strip-components=1
mkdir -p $FFMPEG_ROOT
cp -rf tmp/include $FFMPEG_ROOT
cp -rf tmp/lib/${{ matrix.abi }} $FFMPEG_ROOT/lib
cp -rf tmp/bin/${{ matrix.abi }} $FFMPEG_ROOT/bin
cp -rf tmp/COPYING.LGPLv2.1 $FFMPEG_ROOT
cp -rf tmp/RELEASE_NOTES $FFMPEG_ROOT
mkdir -p $FFMPEG_ROOT/cmake
cp -rf ${{ github.workspace }}/cmake/ffmpeg-config.cmake $FFMPEG_ROOT/cmake/
rm -rf tmp
- name: build
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build && cd build
cmake `cat ${{ github.workspace }}/options.txt` \
${{ env.COMMON_CMAKE_OPTIONS }} -S .. \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake" \
-DFFMPEG_ARCH="${{ matrix.abi }}"
cmake --build . -j $(nproc)
cmake --build . --target install
- name: package
run: |
mkdir -p ${{ env.PACKAGE_NAME }}/
cp -rf ${{ env.SOURCE_DIR }}/build/install/* ${{ env.PACKAGE_NAME }}/
cp -rf $FFMPEG_ROOT ${{ env.PACKAGE_NAME }}/ffmpeg
tar -C ${{ env.PACKAGE_NAME }} -zcvf ${{ env.PACKAGE_NAME }}.tar.gz .
- name: test
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
cd test
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} \
-DANDROID_ABI="${{ matrix.abi }}" \
-DANDROID_ARM_NEON=ON \
-DOpenCV_DIR=${{ github.workspace }}/${{ env.PACKAGE_NAME }}/sdk/native/jni \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake" \
..
cmake --build . -j $(nproc)
- name: upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.tar.gz
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
files: |
${{ env.PACKAGE_NAME }}.tar.gz