Skip to content

Commit

Permalink
Merge pull request #234 from rainyl/conan-to-cmake
Browse files Browse the repository at this point in the history
conan -> cmake
  • Loading branch information
rainyl authored Sep 5, 2024
2 parents ccf4601 + f40cb5c commit e40c871
Show file tree
Hide file tree
Showing 7 changed files with 379 additions and 305 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: android

on:
push:
tags:
- "v*.*.*"
pull_request:
branches: [ "main" ]

jobs:
android:
name: android
runs-on: ubuntu-24.04
strategy:
matrix:
abi: [armeabi-v7a, arm64-v8a, x86_64]
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_POLICY_DEFAULT_CMP0057=NEW \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \
-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False \
-DANDROID_PLATFORM=android-24 \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_STL=c++_static \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: robinraju/[email protected]
with:
repository: "rainyl/opencv.full"
latest: true
fileName: "libopencv-android-${{ matrix.abi }}.tar.gz"
out-file-path: "build/opencv"
extract: true
- name: build
run: |
cd build
cmake -S ${{ github.workspace }} \
${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="${{ matrix.abi }}" \
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/sdk/native/jni \
-DANDROID_ARM_NEON=ON
cmake --build . --config Release -j $(nproc)
cmake --build . --config Release --target install
- name: package
run: |
tar -C build/install -zcvf libopencv_dart-android-${{ matrix.abi }}.tar.gz .
- uses: actions/upload-artifact@v4
name: upload
with:
path: libopencv_dart-android-${{ matrix.abi }}.tar.gz
name: libopencv_dart-android-${{ matrix.abi }}.tar.gz

- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
files: |
libopencv_dart-android-${{ matrix.abi }}.tar.gz
175 changes: 175 additions & 0 deletions .github/workflows/apple.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
name: apple

on:
push:
tags:
- "v*.*.*"
pull_request:
branches: [ "main" ]

env:
IOS_DEPLOYMENT_TARGET: '13.0'
MAC_DEPLOYMENT_TARGET: '11.0'
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF

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 ffmpeg@6 nasm
brew link --overwrite ffmpeg@6
- 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: build
run: |
cd build
cmake -S ${{ github.workspace }} \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/profiles/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 }} \
-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: |
cp -rf build/install/* macos/
ls -alh macos
export OPENCV_DART_LIB_PATH="${{github.workspace}}/macos/libopencv_dart.dylib"
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:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/profiles/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-ios-x64.tar.gz"
out-file-path: "build/opencv/x64"
extract: true
- uses: robinraju/[email protected]
with:
repository: "rainyl/opencv.full"
latest: true
fileName: "libopencv-ios-arm64.tar.gz"
out-file-path: "build/opencv/arm64"
extract: true
- name: build_simulator64
run: |
mkdir -p build/x64 && cd build/x64
cmake -S ${{ github.workspace }} \
${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR64 \
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/x64/lib/cmake/opencv4
cmake --build . --config Release --target install
- name: build_os64
run: |
mkdir -p build/os64 && cd build/os64
cmake -S ${{ github.workspace }} \
${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=OS64 \
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/arm64/lib/cmake/opencv4
cmake --build . --config Release --target install
- name: package
run: |
xcodebuild -create-xcframework \
-framework build/x64/install/opencv_dart.framework \
-framework build/os64/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
Loading

0 comments on commit e40c871

Please sign in to comment.