Skip to content

Commit e40c871

Browse files
authored
Merge pull request #234 from rainyl/conan-to-cmake
conan -> cmake
2 parents ccf4601 + f40cb5c commit e40c871

File tree

7 files changed

+379
-305
lines changed

7 files changed

+379
-305
lines changed

.github/workflows/android.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: android
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
pull_request:
8+
branches: [ "main" ]
9+
10+
jobs:
11+
android:
12+
name: android
13+
runs-on: ubuntu-24.04
14+
strategy:
15+
matrix:
16+
abi: [armeabi-v7a, arm64-v8a, x86_64]
17+
env:
18+
COMMON_CMAKE_OPTIONS: |
19+
-DCMAKE_POLICY_DEFAULT_CMP0057=NEW \
20+
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \
21+
-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False \
22+
-DANDROID_PLATFORM=android-24 \
23+
-DCMAKE_INSTALL_PREFIX=install \
24+
-DCMAKE_BUILD_TYPE=Release \
25+
-DANDROID_STL=c++_static \
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
- uses: robinraju/[email protected]
31+
with:
32+
repository: "rainyl/opencv.full"
33+
latest: true
34+
fileName: "libopencv-android-${{ matrix.abi }}.tar.gz"
35+
out-file-path: "build/opencv"
36+
extract: true
37+
- name: build
38+
run: |
39+
cd build
40+
cmake -S ${{ github.workspace }} \
41+
${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="${{ matrix.abi }}" \
42+
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/sdk/native/jni \
43+
-DANDROID_ARM_NEON=ON
44+
45+
cmake --build . --config Release -j $(nproc)
46+
cmake --build . --config Release --target install
47+
- name: package
48+
run: |
49+
tar -C build/install -zcvf libopencv_dart-android-${{ matrix.abi }}.tar.gz .
50+
- uses: actions/upload-artifact@v4
51+
name: upload
52+
with:
53+
path: libopencv_dart-android-${{ matrix.abi }}.tar.gz
54+
name: libopencv_dart-android-${{ matrix.abi }}.tar.gz
55+
56+
- name: release
57+
uses: softprops/action-gh-release@v1
58+
if: startsWith(github.ref, 'refs/tags/')
59+
with:
60+
draft: true
61+
prerelease: false
62+
files: |
63+
libopencv_dart-android-${{ matrix.abi }}.tar.gz

.github/workflows/apple.yaml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name: apple
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
pull_request:
8+
branches: [ "main" ]
9+
10+
env:
11+
IOS_DEPLOYMENT_TARGET: '13.0'
12+
MAC_DEPLOYMENT_TARGET: '11.0'
13+
ENABLE_BITCODE: OFF
14+
ENABLE_ARC: OFF
15+
ENABLE_VISIBILITY: OFF
16+
17+
jobs:
18+
macos:
19+
name: macos
20+
strategy:
21+
matrix:
22+
osname:
23+
- {os: macos-13, arch: x64, platform: MAC}
24+
- {os: macos-14, arch: arm64, platform: MAC_ARM64}
25+
runs-on: ${{ matrix.osname.os }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
- name: setup
31+
run: |
32+
brew install --force --overwrite ninja ccache ffmpeg@6 nasm
33+
brew link --overwrite ffmpeg@6
34+
- uses: robinraju/[email protected]
35+
with:
36+
repository: "rainyl/opencv.full"
37+
latest: true
38+
fileName: "libopencv-macos-${{ matrix.osname.arch }}.tar.gz"
39+
out-file-path: "build/opencv"
40+
extract: true
41+
- name: build
42+
run: |
43+
cd build
44+
cmake -S ${{ github.workspace }} \
45+
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/profiles/ios.toolchain.cmake \
46+
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
47+
-DENABLE_BITCODE=$ENABLE_BITCODE \
48+
-DENABLE_ARC=$ENABLE_ARC \
49+
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
50+
-DCMAKE_INSTALL_PREFIX=install \
51+
-DCMAKE_BUILD_TYPE=Release \
52+
-DPLATFORM=${{ matrix.osname.platform }} \
53+
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/lib/cmake/opencv4
54+
55+
cmake --build . --config Release --target install
56+
- name: package
57+
run: |
58+
tar -C build/install -zcvf libopencv_dart-macos-${{ matrix.osname.arch }}.tar.gz .
59+
- uses: actions/upload-artifact@v4
60+
name: upload
61+
with:
62+
path: build/install/libopencv_dart.dylib
63+
name: libopencv_dart-macos-${{ matrix.osname.arch }}
64+
- uses: subosito/flutter-action@v2
65+
with:
66+
flutter-version: '3.19.6'
67+
channel: "stable"
68+
- name: test
69+
run: |
70+
cp -rf build/install/* macos/
71+
ls -alh macos
72+
export OPENCV_DART_LIB_PATH="${{github.workspace}}/macos/libopencv_dart.dylib"
73+
dart pub get
74+
dart test -x skip-workflow,no-local-files
75+
- name: release
76+
uses: softprops/action-gh-release@v1
77+
if: startsWith(github.ref, 'refs/tags/')
78+
with:
79+
draft: true
80+
prerelease: false
81+
files: |
82+
libopencv_dart-macos-${{ matrix.osname.arch }}.tar.gz
83+
release:
84+
permissions:
85+
contents: write # for softprops/action-gh-release to create a release
86+
needs: [macos]
87+
runs-on: macos-14
88+
steps:
89+
- name: download
90+
uses: actions/download-artifact@v4
91+
with:
92+
path: artifacts
93+
pattern: libopencv_dart-macos-*
94+
merge-multiple: false
95+
- name: lipo
96+
run: |
97+
ls -R
98+
cd artifacts
99+
lipo -create -output libopencv_dart.dylib */libopencv_dart.dylib
100+
lipo -info libopencv_dart.dylib
101+
tar -zcvf libopencv_dart-macos-os64.tar.gz libopencv_dart.dylib
102+
- name: create-release
103+
uses: softprops/action-gh-release@v2
104+
if: startsWith(github.ref, 'refs/tags/')
105+
with:
106+
draft: true
107+
prerelease: false
108+
token: ${{ secrets.GITHUB_TOKEN }}
109+
files: artifacts/libopencv_dart-macos-os64.tar.gz
110+
ios:
111+
name: ios
112+
runs-on: macos-14
113+
env:
114+
COMMON_CMAKE_OPTIONS: |
115+
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/profiles/ios.toolchain.cmake \
116+
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
117+
-DENABLE_BITCODE=$ENABLE_BITCODE \
118+
-DENABLE_ARC=$ENABLE_ARC \
119+
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
120+
-DCMAKE_INSTALL_PREFIX=install \
121+
-DCMAKE_BUILD_TYPE=Release \
122+
steps:
123+
- uses: actions/checkout@v4
124+
with:
125+
submodules: true
126+
- uses: robinraju/[email protected]
127+
with:
128+
repository: "rainyl/opencv.full"
129+
latest: true
130+
fileName: "libopencv-ios-x64.tar.gz"
131+
out-file-path: "build/opencv/x64"
132+
extract: true
133+
- uses: robinraju/[email protected]
134+
with:
135+
repository: "rainyl/opencv.full"
136+
latest: true
137+
fileName: "libopencv-ios-arm64.tar.gz"
138+
out-file-path: "build/opencv/arm64"
139+
extract: true
140+
- name: build_simulator64
141+
run: |
142+
mkdir -p build/x64 && cd build/x64
143+
cmake -S ${{ github.workspace }} \
144+
${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR64 \
145+
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/x64/lib/cmake/opencv4
146+
147+
cmake --build . --config Release --target install
148+
- name: build_os64
149+
run: |
150+
mkdir -p build/os64 && cd build/os64
151+
cmake -S ${{ github.workspace }} \
152+
${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=OS64 \
153+
-DOpenCV_DIR=${{ github.workspace }}/build/opencv/arm64/lib/cmake/opencv4
154+
155+
cmake --build . --config Release --target install
156+
- name: package
157+
run: |
158+
xcodebuild -create-xcframework \
159+
-framework build/x64/install/opencv_dart.framework \
160+
-framework build/os64/install/opencv_dart.framework \
161+
-output opencv_dart.xcframework
162+
tar -zcvf libopencv_dart-ios-os64.tar.gz opencv_dart.xcframework
163+
- uses: actions/upload-artifact@v4
164+
name: upload
165+
with:
166+
path: libopencv_dart-ios-os64.tar.gz
167+
name: libopencv_dart-ios-os64.tar.gz
168+
- name: release
169+
uses: softprops/action-gh-release@v1
170+
if: startsWith(github.ref, 'refs/tags/')
171+
with:
172+
draft: true
173+
prerelease: false
174+
files: |
175+
libopencv_dart-ios-os64.tar.gz

0 commit comments

Comments
 (0)