-
-
Notifications
You must be signed in to change notification settings - Fork 359
314 lines (286 loc) · 13.3 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
name: release
on: pull_request
# on:
# push:
# tags:
# - '*'
env:
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer
IOS_DEPLOYMENT_TARGET: '9.0'
MAC_DEPLOYMENT_TARGET: '10.9'
MAC_ARM64_DEPLOYMENT_TARGET: '11.0'
MAC_CATALYST_DEPLOYMENT_TARGET: '13.1'
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
EMSCRIPTEN_VERSION: 3.1.28
permissions:
contents: read
jobs:
setup:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- name: get-version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: opencv2-source
env:
opencv-version: 2.4.13.7
run: |
wget -q https://github.com/opencv/opencv/archive/${{ env.opencv-version }}.zip -O opencv-${{ env.opencv-version }}.zip
unzip -q opencv-${{ env.opencv-version }}.zip
rm opencv-${{ env.opencv-version }}.zip
cd opencv-${{ env.opencv-version }}
truncate -s 0 cmake/OpenCVFindLibsGrfmt.cmake
rm modules/core/src/gl_*
rm modules/core/src/gpumat.cpp
rm modules/core/src/opengl_*
rm modules/core/include/opencv2/core/cuda_*
rm modules/core/include/opencv2/core/devmem2d.hpp
rm modules/core/include/opencv2/core/gpumat.hpp
rm modules/core/include/opencv2/core/opengl_*
rm modules/core/include/opencv2/core/wimage.hpp
rm -rf modules/dynamicuda
rm -rf modules/gpu
rm -rf modules/ocl
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-gpu.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-rtti.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-zlib.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-fix-highgui-include.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-link-stdc++.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-enable-cxx11.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-link-openmp.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-newer-msvc.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-minimal-install.patch
cp ../patches/draw_text.h ../patches/mono_font_data.h modules/core/src/
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-drawing-mono-font.patch
rm -rf modules/highgui
cp -r ../highgui modules/
rm -rf 3rdparty apps data doc samples platforms
rm -rf modules/java
rm -rf modules/python
rm -rf modules/ts
sed -e 's/__VERSION__/${{ env.opencv-version }}/g' ../patches/Info.plist > ./Info.plist
cp ../opencv2_cmake_options.txt ./options.txt
cd ..
mv opencv-${{ env.opencv-version }} opencv-mobile-${{ env.opencv-version }}
zip -9 -r opencv-mobile-${{ env.opencv-version }}.zip opencv-mobile-${{ env.opencv-version }}
- name: opencv3-source
env:
opencv-version: 3.4.20
run: |
wget -q https://github.com/opencv/opencv/archive/${{ env.opencv-version }}.zip -O opencv-${{ env.opencv-version }}.zip
unzip -q opencv-${{ env.opencv-version }}.zip
rm opencv-${{ env.opencv-version }}.zip
cd opencv-${{ env.opencv-version }}
truncate -s 0 cmake/OpenCVFindLibsGrfmt.cmake
rm modules/core/src/cuda_*
rm modules/core/src/direct*
rm modules/core/src/gl_*
rm modules/core/src/intel_gpu_*
rm modules/core/src/ocl*
rm modules/core/src/opengl.cpp
rm modules/core/src/ovx.cpp
rm modules/core/src/umatrix.hpp
rm modules/core/src/va_intel.cpp
rm modules/core/include/opencv2/core/cuda*.hpp
rm modules/core/include/opencv2/core/directx.hpp
rm modules/core/include/opencv2/core/ippasync.hpp
rm modules/core/include/opencv2/core/ocl*.hpp
rm modules/core/include/opencv2/core/opengl.hpp
rm modules/core/include/opencv2/core/ovx.hpp
rm modules/core/include/opencv2/core/private.cuda.hpp
rm modules/core/include/opencv2/core/va_intel.hpp
rm modules/core/include/opencv2/core/wimage.hpp
rm -rf modules/core/include/opencv2/core/cuda
rm -rf modules/core/include/opencv2/core/opencl
rm -rf modules/core/include/opencv2/core/openvx
rm modules/photo/src/denoising.cuda.cpp
rm modules/photo/include/opencv2/photo/cuda.hpp
rm -rf modules/cuda*
rm -rf modules/cudev
find modules -type d | xargs -i rm -rf {}/src/cuda
find modules -type d | xargs -i rm -rf {}/src/opencl
find modules -type d | xargs -i rm -rf {}/perf/cuda
find modules -type d | xargs -i rm -rf {}/perf/opencl
find modules -type f | xargs -i sed -i '/opencl_kernels/d' {}
find modules -type f | xargs -i sed -i '/cuda.hpp/d' {}
find modules -type f | xargs -i sed -i '/opengl.hpp/d' {}
find modules -type f | xargs -i sed -i '/ocl_defs.hpp/d' {}
find modules -type f | xargs -i sed -i '/ocl.hpp/d' {}
find modules -type f | xargs -i sed -i '/ovx_defs.hpp/d' {}
find modules -type f | xargs -i sed -i '/ovx.hpp/d' {}
find modules -type f | xargs -i sed -i '/va_intel.hpp/d' {}
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-gpu.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-rtti.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-zlib.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-link-openmp.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-fix-emscripten-include.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-minimal-install.patch
cp ../patches/draw_text.h ../patches/mono_font_data.h modules/imgproc/src/
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-drawing-mono-font.patch
rm -rf modules/highgui
cp -r ../highgui modules/
rm -rf 3rdparty apps data doc samples platforms
rm -rf modules/java
rm -rf modules/js
rm -rf modules/python
rm -rf modules/ts
sed -e 's/__VERSION__/${{ env.opencv-version }}/g' ../patches/Info.plist > ./Info.plist
cp ../opencv3_cmake_options.txt ./options.txt
cd ..
mv opencv-${{ env.opencv-version }} opencv-mobile-${{ env.opencv-version }}
zip -9 -r opencv-mobile-${{ env.opencv-version }}.zip opencv-mobile-${{ env.opencv-version }}
- name: opencv4-source
env:
opencv-version: 4.9.0
run: |
wget -q https://github.com/opencv/opencv/archive/${{ env.opencv-version }}.zip -O opencv-${{ env.opencv-version }}.zip
unzip -q opencv-${{ env.opencv-version }}.zip
rm opencv-${{ env.opencv-version }}.zip
cd opencv-${{ env.opencv-version }}
truncate -s 0 cmake/OpenCVFindLibsGrfmt.cmake
rm -rf modules/gapi
rm modules/core/src/cuda_*
rm modules/core/src/direct*
rm modules/core/src/gl_*
rm modules/core/src/intel_gpu_*
rm modules/core/src/ocl*
rm modules/core/src/opengl.cpp
rm modules/core/src/ovx.cpp
rm modules/core/src/umatrix.hpp
rm modules/core/src/va_intel.cpp
rm modules/core/src/va_wrapper.impl.hpp
rm modules/core/include/opencv2/core/cuda*.hpp
rm modules/core/include/opencv2/core/directx.hpp
rm modules/core/include/opencv2/core/ocl*.hpp
rm modules/core/include/opencv2/core/opengl.hpp
rm modules/core/include/opencv2/core/ovx.hpp
rm modules/core/include/opencv2/core/private.cuda.hpp
rm modules/core/include/opencv2/core/va_*.hpp
rm -rf modules/core/include/opencv2/core/cuda
rm -rf modules/core/include/opencv2/core/opencl
rm -rf modules/core/include/opencv2/core/openvx
rm modules/photo/src/denoising.cuda.cpp
rm modules/photo/include/opencv2/photo/cuda.hpp
find modules -type d | xargs -i rm -rf {}/src/cuda
find modules -type d | xargs -i rm -rf {}/src/opencl
find modules -type d | xargs -i rm -rf {}/perf/cuda
find modules -type d | xargs -i rm -rf {}/perf/opencl
find modules -type f | xargs -i sed -i '/opencl_kernels/d' {}
find modules -type f | xargs -i sed -i '/cuda.hpp/d' {}
find modules -type f | xargs -i sed -i '/opengl.hpp/d' {}
find modules -type f | xargs -i sed -i '/ocl_defs.hpp/d' {}
find modules -type f | xargs -i sed -i '/ocl.hpp/d' {}
find modules -type f | xargs -i sed -i '/ovx_defs.hpp/d' {}
find modules -type f | xargs -i sed -i '/ovx.hpp/d' {}
find modules -type f | xargs -i sed -i '/va_intel.hpp/d' {}
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-gpu.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-rtti.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-zlib.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-link-openmp.patch
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-minimal-install.patch
cp ../patches/draw_text.h ../patches/mono_font_data.h modules/imgproc/src/
patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-drawing-mono-font.patch
rm -rf modules/highgui
cp -r ../highgui modules/
rm -rf 3rdparty apps data doc samples platforms
rm -rf modules/java
rm -rf modules/js
rm -rf modules/python
rm -rf modules/ts
sed -e 's/__VERSION__/${{ env.opencv-version }}/g' ../patches/Info.plist > ./Info.plist
cp ../opencv4_cmake_options.txt ./options.txt
cd ..
mv opencv-${{ env.opencv-version }} opencv-mobile-${{ env.opencv-version }}
zip -9 -r opencv-mobile-${{ env.opencv-version }}.zip opencv-mobile-${{ env.opencv-version }}
- name: upload-opencv2-source
uses: actions/upload-artifact@v4
with:
name: opencv-mobile-2.4.13.7-source
path: opencv-mobile-2.4.13.7.zip
- name: upload-opencv3-source
uses: actions/upload-artifact@v4
with:
name: opencv-mobile-3.4.20-source
path: opencv-mobile-3.4.20.zip
- name: upload-opencv4-source
uses: actions/upload-artifact@v4
with:
name: opencv-mobile-4.9.0-source
path: opencv-mobile-4.9.0.zip
devboard:
needs: [setup]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: yuzuki-chameleon
single-core: false
cmake-toolchain: aarch64-openwrt-linux-gnu.toolchain.cmake
setup-toolchain-cmd: |
wget -q https://github.com/YuzukiHD/sunxi-bsp-toolchains/releases/download/1.0.0/toolchain-sunxi-glibc-aarch64-gcc-830.tar.gz
tar -xf toolchain-sunxi-glibc-aarch64-gcc-830.tar.gz
setup-env-cmd: |
export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/toolchain-sunxi-musl-gcc-830/toolchain
export STAGING_DIR=$GITHUB_WORKSPACE/toolchain-sunxi-musl-gcc-830/toolchain
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/${{ matrix.cmake-toolchain }} \
-DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \
-DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: opencv-mobile-4.9.0-source
- name: setup-opencv-source
run: |
unzip -q opencv-mobile-4.9.0.zip
echo "SOURCE_DIR=opencv-mobile-4.9.0" >> $GITHUB_ENV
echo "PACKAGE_NAME=opencv-mobile-4.9.0-${{ matrix.name }}" >> $GITHUB_ENV
- name: setup-toolchain
run: ${{ matrix.setup-toolchain-cmd }}
- name: build-disable-thread
if: ${{ matrix.single-core }}
run: |
cd ${{ env.SOURCE_DIR }}
patch -p1 -i ../patches/opencv-4.9.0-no-atomic.patch
mkdir build && cd build
${{ matrix.setup-env-cmd }}
cmake ${{ env.COMMON_CMAKE_OPTIONS }} \
`cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON \
-DWITH_OPENMP=OFF -DOPENCV_DISABLE_THREAD_SUPPORT=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install
- name: build-enable-thread
if: ${{ ! matrix.single-core }}
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build && cd build
${{ matrix.setup-env-cmd }}
cmake ${{ env.COMMON_CMAKE_OPTIONS }} \
`cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install
- name: package
run: |
mkdir ${{ env.PACKAGE_NAME }}
cp -rf ${{ env.SOURCE_DIR }}/build/install/* ${{ env.PACKAGE_NAME }}/
zip -9 -r ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }}
- name: test
run: |
cd test
mkdir build && cd build
${{ matrix.setup-env-cmd }}
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/lib/cmake/opencv4 ..
cmake --build . -j $(nproc)
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.zip