-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
meta.yaml
318 lines (305 loc) · 12.9 KB
/
meta.yaml
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
315
316
317
318
# This recipe creates 3 packages
# libopencv, py-opencv, opencv
#
# libopencv actually contains all the files, including the site-packages
# file needed to run opencv with python.
# opencv-dnn seems to change on every patch version, therefore, we pin
# to the patch version x.x.x
#
# py-opencv is a meta package that constrains the python dependencies
# This one is pinned to the minor version. x.x
#
# opencv is a backward compatible package, with no pinnings
#
# This approach is different than the one in defaults. Default's package
# seperates well the files generated with python dependencies, from those
# generated without. Unfortunately, this isn't entirely supported by
# upstream. Their hacks are quite elaborate, making it seem difficult to
# maintain as opencv has been changing their build system recently.
#
# By putting all the generated files in 1 package, this makes the build process
# much easier, at the expense of a few MBs in the 'lib' package.
{% set version = "4.10.0" %}
{% set major_version = version.split('.')[0] %}
{% set PY_VER_MAJOR = PY_VER.split('.')[0] %}
{% set PY_VER_MINOR = PY_VER.split('.')[1] %}
{% set build = 12 %}
# Allow the qt version to be easily read from the build number 100's value.
{% if qt_version == "5" %}
{% set build = build + 500 %}
{% endif %}
{% if qt_version == "6" %}
{% set build = build + 600 %}
{% endif %}
package:
name: libopencv
version: {{ version }}
source:
- url: https://github.com/opencv/opencv/archive/{{ version }}.tar.gz
fn: opencv-{{ version }}.tar.gz
sha256: b2171af5be6b26f7a06b1229948bbb2bdaa74fcf5cd097e0af6378fce50a6eb9
patches:
# backport https://github.com/opencv/opencv/pull/21611 (unmerged as of 06/2023)
- patches_opencv/0001-Add-installation-of-pip-metadata-from-cmake.patch
- patches_opencv/0001-Also-install-metadata-for-opencv-python-headless.patch
- patches_opencv/0002-delete-lines-that-download-opencv.patch
- patches_opencv/0003-find-pkgconfig-on-windows.patch
- patches_opencv/0004-fix-detection-for-protobuf-23.x.patch
- url: https://github.com/opencv/opencv_contrib/archive/{{ version }}.tar.gz
fn: opencv_contrib-{{ version }}.tar.gz
sha256: 65597f8fb8dc2b876c1b45b928bbcc5f772ddbaf97539bf1b737623d0604cba1
folder: opencv_contrib
patches:
# Allow attempt to find HDF5 on cross-compile
- patches_opencv_contrib/cmake_hdf5_xpile.patch
- fn: test.avi
url: https://github.com/opencv/opencv_extra/raw/master/testdata/highgui/video/VID00003-20100701-2204.avi
sha256: 78884f64b564a3b06dc6ee731ed33b60c6d8cd864cea07f21d94ba0f90c7b310
build:
number: {{ build }}
string: headless_py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [qt_version == "none"]
string: qt{{ qt_version }}_py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [qt_version != "none"]
run_exports:
# https://abi-laboratory.pro/index.php?view=timeline&l=opencv
# Things seem to change every patch versions, mostly the dnn module
- {{ pin_subpackage('libopencv', max_pin='x.x.x') }}
ignore_run_exports_from:
- python
requirements:
build:
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- numpy # [build_platform != target_platform]
- libprotobuf # [build_platform != target_platform]
- qt6-main # [build_platform != target_platform and qt_version == 6]
# pkg-config is required to find ffpmeg
- pkg-config
- cmake
- ninja
- libgomp # [linux]
# ICE when enabling this
# - llvm-openmp # [osx]
- {{ stdlib('c') }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
host:
- libgl-devel # [linux and (qt_version == 5 or qt_version == 6)]
- libegl-devel # [linux and (qt_version == 5 or qt_version == 6)]
- python
- numpy
- eigen =3.4.0
# Specify lgpl version of ffmpeg so that there are
# no quesitons about the license of the resulting opencv
# binary
- ffmpeg {{ ffmpeg }}=lgpl_*
- freetype
# harfbuzz, glib, gettext are both needed for freetype support
- harfbuzz
- gettext
- glib
- hdf5
- jasper
- libcblas
- libiconv # [unix]
- libjpeg-turbo
- liblapack
- liblapacke
- libpng
- libprotobuf
- libtiff
- libwebp
- openexr
- qt-main # [qt_version == 5]
- qt6-main # [qt_version == 6]
- zlib
- libopenvino-dev # [not ppc64le]
# Why do I need expat here??? At the very least it helps find FFMPEG
# And start the compilation on windows
- expat
test:
requires:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- pkg-config # [not win]
# Test with the two currently supported lapack implementatons
# One test done on different versions of python on each platform
- liblapack * *openblas # [py==36]
- liblapack * *mkl # [py==37 and linux64]
- cmake
- ninja
files:
- CMakeLists.txt
- test.cpp
commands:
# Verify dynamic libraries on all systems
{% set win_ver_lib = version|replace(".", "") %}
# The bot doesn't support multiline jinja, so use
# single line jinja.
{% set opencv_libs = [] %}
{{ opencv_libs.append("alphamat") or "" }}
{{ opencv_libs.append("aruco") or "" }}
{{ opencv_libs.append("bgsegm") or "" }}
{{ opencv_libs.append("calib3d") or "" }}
{{ opencv_libs.append("ccalib") or "" }}
{{ opencv_libs.append("core") or "" }}
{{ opencv_libs.append("datasets") or "" }}
{{ opencv_libs.append("dnn_objdetect") or "" }}
{{ opencv_libs.append("dnn_superres") or "" }}
{{ opencv_libs.append("dnn") or "" }}
{{ opencv_libs.append("dpm") or "" }}
{{ opencv_libs.append("face") or "" }}
{{ opencv_libs.append("features2d") or "" }}
{{ opencv_libs.append("flann") or "" }}
{{ opencv_libs.append("fuzzy") or "" }}
{{ opencv_libs.append("gapi") or "" }}
{{ opencv_libs.append("hfs") or "" }}
{{ opencv_libs.append("highgui") or "" }}
{{ opencv_libs.append("img_hash") or "" }}
{{ opencv_libs.append("imgcodecs") or "" }}
{{ opencv_libs.append("imgproc") or "" }}
{{ opencv_libs.append("intensity_transform") or "" }}
{{ opencv_libs.append("line_descriptor") or "" }}
{{ opencv_libs.append("mcc") or "" }}
{{ opencv_libs.append("ml") or "" }}
{{ opencv_libs.append("objdetect") or "" }}
{{ opencv_libs.append("optflow") or "" }}
{{ opencv_libs.append("phase_unwrapping") or "" }}
{{ opencv_libs.append("photo") or "" }}
{{ opencv_libs.append("plot") or "" }}
{{ opencv_libs.append("quality") or "" }}
{{ opencv_libs.append("rapid") or "" }}
{{ opencv_libs.append("reg") or "" }}
{{ opencv_libs.append("rgbd") or "" }}
{{ opencv_libs.append("saliency") or "" }}
{{ opencv_libs.append("shape") or "" }}
{{ opencv_libs.append("stereo") or "" }}
{{ opencv_libs.append("stitching") or "" }}
{{ opencv_libs.append("structured_light") or "" }}
{{ opencv_libs.append("superres") or "" }}
{{ opencv_libs.append("surface_matching") or "" }}
{{ opencv_libs.append("text") or "" }}
{{ opencv_libs.append("tracking") or "" }}
{{ opencv_libs.append("video") or "" }}
{{ opencv_libs.append("videoio") or "" }}
{{ opencv_libs.append("videostab") or "" }}
{{ opencv_libs.append("wechat_qrcode") or "" }}
{{ opencv_libs.append("xfeatures2d") or "" }}
{{ opencv_libs.append("ximgproc") or "" }}
{{ opencv_libs.append("xobjdetect") or "" }}
{{ opencv_libs.append("xphoto") or "" }}
{{ opencv_libs.append("freetype") or "" }}
- export MACOSX_DEPLOYMENT_TARGET={{ MACOSX_DEPLOYMENT_TARGET }} # [osx]
# hmaarrfk - 2024/10
# Need to specify a default value for CONDA_BUILD_SYSROOT
# otherwise the bot seems to fail to help us update
# https://github.com/conda-forge/opencv-feedstock/issues/280
{%- if CONDA_BUILD_SYSROOT is defined %}
- export CONDA_BUILD_SYSROOT={{ CONDA_BUILD_SYSROOT }} # [osx]
{%- endif %}
- OPENCV_FLAGS=`pkg-config --cflags opencv4` # [unix]
- $CXX -std=c++11 $RECIPE_DIR/test.cpp ${OPENCV_FLAGS} -o test # [unix]
- if [[ $(./test) != $PKG_VERSION ]]; then exit 1 ; fi # [unix]
{% for each_opencv_lib in opencv_libs %}
- echo Testing for presence of {{ each_opencv_lib }}
- test -f $PREFIX/lib/libopencv_{{ each_opencv_lib }}${SHLIB_EXT} # [unix]
- if not exist %PREFIX%\\Library\\bin\\opencv_{{ each_opencv_lib }}{{ win_ver_lib }}.dll exit 1 # [win]
- echo Found {{ each_opencv_lib }}
{% endfor %}
- test -f $PREFIX/lib/libopencv_bioinspired${SHLIB_EXT} # [unix]
- test -f $PREFIX/lib/libopencv_hdf${SHLIB_EXT} # [unix]
- mkdir -p cmake_build_test && pushd cmake_build_test
- cmake -G "Ninja" ..
- cmake --build . --config Release
- popd
outputs:
- name: libopencv
- name: opencv
build:
string: headless_py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [qt_version == "none"]
string: qt{{ qt_version }}_py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [qt_version != "none"]
requirements:
host:
# Explicitely add a python requirement so that the hash changes between
# opencv for pypy36 and python3.6
# similarly for pypy37 and python3.7
- python
# Similarly for libprotobuf since we are building a few different versions now
- libprotobuf
# Need the hash to change for different versions of HDF5
- hdf5
run:
- {{ pin_subpackage('libopencv', exact=True) }}
- {{ pin_subpackage('py-opencv', exact=True) }}
test:
commands:
- echo "tested in other outputs"
- name: py-opencv
build:
string: headless_py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [qt_version == "none"]
string: qt{{ qt_version }}_py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [qt_version != "none"]
run_exports:
# Should we even have this???
# don't pin the python version so hard.
# Actually, I have found pretty good compatibility in the python
# package
- {{ pin_subpackage('py-opencv') }}
requirements:
# There is no build script, but I just want it to think
# that it needs python and numpy at build time
host:
- python
- numpy
# Similarly for libprotobuf since we are building a few different versions now
- libprotobuf
# Need the hash to change for different versions of HDF5
- hdf5
run:
- python
- {{ pin_subpackage('libopencv', exact=True) }}
test:
requires:
# Test with the two currently supported lapack implementatons
# One test done on different versions of python on each platform
- liblapack * *openblas # [py==39]
- liblapack * *mkl # [py==310 and linux64]
imports:
- cv2
- cv2.xfeatures2d
- cv2.freetype
files:
- run_py_test.py
- color_palette_alpha.png
- test_1_c1.jpg
source_files:
- test.avi
commands:
- python run_py_test.py
- if [[ $($PYTHON -c 'import cv2; print(cv2.__version__)') != $PKG_VERSION ]]; then exit 1; fi # [unix]
- python -c "import cv2; assert 'Unknown' not in cv2.videoio_registry.getBackendName(cv2.CAP_V4L)" # [linux]
- python -c "import cv2, re; assert re.search('Lapack:\s+YES', cv2.getBuildInformation())"
- pip check
- pip list
- test $(pip list | grep "opencv-python " | wc -l) -eq 1 # [unix]
- test $(pip list | grep "opencv-python-headless " | wc -l) -eq 1 # [unix]
requires:
- pip
about:
home: https://opencv.org/
license: Apache-2.0
license_family: Apache
license_file: LICENSE
summary: Computer vision and machine learning software library.
dev_url: https://github.com/opencv/opencv
doc_url: https://docs.opencv.org/{{ major_version }}.x/
extra:
recipe-maintainers:
- h-vetinari
- xhochy
- jakirkham
- msarahan
- patricksnape
- zym1010
- hajapy
- ocefpaf
- hmaarrfk
- ilya-lavrenov