1 ################################################################################
5 ################################################################################
7 OPENCV3_VERSION
= 3.0.0
8 OPENCV3_SITE
= $(call github
,itseez
,opencv
,$(OPENCV3_VERSION
))
9 OPENCV3_INSTALL_STAGING
= YES
10 OPENCV3_LICENSE
= BSD-3c
11 OPENCV3_LICENSE_FILES
= LICENSE
13 # OpenCV component options
14 OPENCV3_CONF_OPTS
+= \
16 -DBUILD_PERF_TESTS
=$(if
$(BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS
),ON
,OFF
) \
17 -DBUILD_TESTS
=$(if
$(BR2_PACKAGE_OPENCV3_BUILD_TESTS
),ON
,OFF
) \
18 -DBUILD_WITH_DEBUG_INFO
=OFF
20 ifeq ($(BR2_PACKAGE_OPENCV3_BUILD_TESTS
)$(BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS
),)
21 OPENCV3_CONF_OPTS
+= -DINSTALL_TEST
=OFF
23 OPENCV3_CONF_OPTS
+= -DINSTALL_TEST
=ON
26 # OpenCV build options
27 OPENCV3_CONF_OPTS
+= \
28 -DBUILD_WITH_STATIC_CRT
=OFF \
29 -DENABLE_COVERAGE
=OFF \
30 -DENABLE_FAST_MATH
=ON \
31 -DENABLE_IMPL_COLLECTION
=OFF \
32 -DENABLE_NOISY_WARNINGS
=OFF \
33 -DENABLE_OMIT_FRAME_POINTER
=ON \
34 -DENABLE_PRECOMPILED_HEADERS
=OFF \
35 -DENABLE_PROFILING
=OFF \
36 -DOPENCV3_WARNINGS_ARE_ERRORS
=OFF
39 OPENCV3_CONF_OPTS
+= \
40 -DCMAKE_INSTALL_RPATH_USE_LINK_PATH
=OFF \
41 -DCMAKE_SKIP_RPATH
=OFF \
42 -DCMAKE_USE_RELATIVE_PATHS
=OFF
44 # OpenCV packaging options:
45 OPENCV3_CONF_OPTS
+= \
47 -DENABLE_SOLUTION_FOLDERS
=OFF \
48 -DINSTALL_CREATE_DISTRIB
=OFF
50 # OpenCV module selection
52 # - core: if not set, opencv does not build anything
53 # - hal: core's dependency
55 # - android*: android stuff
56 # - apps: programs for training classifiers
57 # - java: java bindings
58 # - viz: missing VTK dependency
59 # - world: all-in-one module
61 # * Contrib modules from [1] are disabled:
62 # - opencv_contrib package is not available in Buildroot;
63 # - OPENCV3_EXTRA_MODULES_PATH is not set.
65 # [1] https://github.com/Itseez/opencv_contrib
66 OPENCV3_CONF_OPTS
+= \
67 -DBUILD_opencv_androidcamera
=OFF \
68 -DBUILD_opencv_apps
=OFF \
69 -DBUILD_opencv_calib3d
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_CALIB3D
),ON
,OFF
) \
70 -DBUILD_opencv_core
=ON \
71 -DBUILD_opencv_features2d
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_FEATURES2D
),ON
,OFF
) \
72 -DBUILD_opencv_flann
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_FLANN
),ON
,OFF
) \
73 -DBUILD_opencv_hal
=ON \
74 -DBUILD_opencv_highgui
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_HIGHGUI
),ON
,OFF
) \
75 -DBUILD_opencv_imgcodecs
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_IMGCODECS
),ON
,OFF
) \
76 -DBUILD_opencv_imgproc
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_IMGPROC
),ON
,OFF
) \
77 -DBUILD_opencv_java
=OFF \
78 -DBUILD_opencv_ml
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_ML
),ON
,OFF
) \
79 -DBUILD_opencv_objdetect
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_OBJDETECT
),ON
,OFF
) \
80 -DBUILD_opencv_photo
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_PHOTO
),ON
,OFF
) \
81 -DBUILD_opencv_shape
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_SHAPE
),ON
,OFF
) \
82 -DBUILD_opencv_stitching
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_STITCHING
),ON
,OFF
) \
83 -DBUILD_opencv_superres
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_SUPERRES
),ON
,OFF
) \
84 -DBUILD_opencv_ts
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_TS
),ON
,OFF
) \
85 -DBUILD_opencv_video
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_VIDEO
),ON
,OFF
) \
86 -DBUILD_opencv_videoio
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_VIDEOIO
),ON
,OFF
) \
87 -DBUILD_opencv_videostab
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_VIDEOSTAB
),ON
,OFF
) \
88 -DBUILD_opencv_viz
=OFF \
89 -DBUILD_opencv_world
=OFF
91 # Hardware support options.
93 # * PowerPC support is turned off since its only effect is altering CFLAGS,
94 # adding '-mcpu=G3 -mtune=G5' to them, which is already handled by Buildroot.
95 # * fma3 and popcnt support is disabled because according to gcc manual [2], it
96 # is only available on x86_64 haswell, broadwell and knl architecture.
98 # [2] https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/x86-Options.html#x86-Options
99 OPENCV3_CONF_OPTS
+= \
100 -DENABLE_AVX
=$(if
$(BR2_X86_CPU_HAS_AVX
),ON
,OFF
) \
101 -DENABLE_AVX2
=$(if
$(BR2_X86_CPU_HAS_AVX2
),ON
,OFF
) \
103 -DENABLE_POPCNT
=OFF \
104 -DENABLE_POWERPC
=OFF \
105 -DENABLE_SSE
=$(if
$(BR2_X86_CPU_HAS_SSE
),ON
,OFF
) \
106 -DENABLE_SSE2
=$(if
$(BR2_X86_CPU_HAS_SSE2
),ON
,OFF
) \
107 -DENABLE_SSE3
=$(if
$(BR2_X86_CPU_HAS_SSE3
),ON
,OFF
) \
108 -DENABLE_SSE41
=$(if
$(BR2_X86_CPU_HAS_SSE4
),ON
,OFF
) \
109 -DENABLE_SSE42
=$(if
$(BR2_X86_CPU_HAS_SSE42
),ON
,OFF
) \
110 -DENABLE_SSSE3
=$(if
$(BR2_X86_CPU_HAS_SSSE3
),ON
,OFF
)
113 OPENCV3_CONF_OPTS
+= \
114 -DBUILD_CUDA_STUBS
=OFF \
115 -DBUILD_opencv_cudaarithm
=OFF \
116 -DBUILD_opencv_cudabgsegm
=OFF \
117 -DBUILD_opencv_cudacodec
=OFF \
118 -DBUILD_opencv_cudafeatures2d
=OFF \
119 -DBUILD_opencv_cudafilters
=OFF \
120 -DBUILD_opencv_cudaimgproc
=OFF \
121 -DBUILD_opencv_cudalegacy
=OFF \
122 -DBUILD_opencv_cudaobjdetect
=OFF \
123 -DBUILD_opencv_cudaoptflow
=OFF \
124 -DBUILD_opencv_cudastereo
=OFF \
125 -DBUILD_opencv_cudawarping
=OFF \
126 -DBUILD_opencv_cudev
=OFF \
132 OPENCV3_CONF_OPTS
+= -DWITH_NVCUVID
=OFF
135 OPENCV3_CONF_OPTS
+= \
136 -DWITH_OPENCLAMDBLAS
=OFF \
137 -DWITH_OPENCLAMDFFT
=OFF
140 OPENCV3_CONF_OPTS
+= \
141 -DBUILD_WITH_DYNAMIC_IPP
=OFF \
142 -DWITH_INTELPERC
=OFF \
148 OPENCV3_CONF_OPTS
+= -DWITH_GIGEAPI
=OFF
151 OPENCV3_CONF_OPTS
+= -DWITH_PVAPI
=OFF
154 OPENCV3_CONF_OPTS
+= -DWITH_XIMEA
=OFF
156 # Non-Linux support (Android options) must remain OFF:
157 OPENCV3_CONF_OPTS
+= \
159 -DBUILD_ANDROID_CAMERA_WRAPPER
=OFF \
160 -DBUILD_ANDROID_EXAMPLES
=OFF \
161 -DBUILD_ANDROID_SERVICE
=OFF \
162 -DBUILD_FAT_JAVA_LIB
=OFF \
163 -DINSTALL_ANDROID_EXAMPLES
=OFF \
164 -DWITH_ANDROID_CAMERA
=OFF
166 # Non-Linux support (Mac OSX options) must remain OFF:
167 OPENCV3_CONF_OPTS
+= \
168 -DWITH_AVFOUNDATION
=OFF \
172 # Non-Linux support (Windows options) must remain OFF:
173 OPENCV3_CONF_OPTS
+= \
174 -DWITH_CSTRIPES
=OFF \
177 -DWITH_PTHREADS_PF
=OFF \
179 -DWITH_VIDEOINPUT
=OFF \
182 # Software/3rd-party support options:
183 # - disable all examples
184 OPENCV3_CONF_OPTS
+= \
185 -DBUILD_EXAMPLES
=OFF \
188 -DBUILD_OPENEXR
=OFF \
192 -DINSTALL_C_EXAMPLES
=OFF \
193 -DINSTALL_PYTHON_EXAMPLES
=OFF \
194 -DINSTALL_TO_MANGLED_PATHS
=OFF
196 # Disabled features (mostly because they are not available in Buildroot), but
197 # - eigen: OpenCV does not use it, not take any benefit from it.
198 OPENCV3_CONF_OPTS
+= \
205 -DWITH_OPENCL_SVM
=OFF \
216 OPENCV3_DEPENDENCIES
+= zlib
218 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_FFMPEG
),y
)
219 OPENCV3_CONF_OPTS
+= -DWITH_FFMPEG
=ON
220 OPENCV3_DEPENDENCIES
+= ffmpeg bzip2
222 OPENCV3_CONF_OPTS
+= -DWITH_FFMPEG
=OFF
225 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER
),y
)
226 OPENCV3_CONF_OPTS
+= -DWITH_GSTREAMER_0_10
=ON
227 OPENCV3_DEPENDENCIES
+= gstreamer gst-plugins-base
229 OPENCV3_CONF_OPTS
+= -DWITH_GSTREAMER_0_10
=OFF
232 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1
),y
)
233 OPENCV3_CONF_OPTS
+= -DWITH_GSTREAMER
=ON
234 OPENCV3_DEPENDENCIES
+= gstreamer1 gst1-plugins-base
236 OPENCV3_CONF_OPTS
+= -DWITH_GSTREAMER
=OFF
239 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK
)$(BR2_PACKAGE_OPENCV3_WITH_GTK3
),)
240 OPENCV3_CONF_OPTS
+= -DWITH_GTK
=OFF
-DWITH_GTK_2_X
=OFF
243 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK
),y
)
244 OPENCV3_CONF_OPTS
+= -DWITH_GTK
=ON
-DWITH_GTK_2_X
=ON
245 OPENCV3_DEPENDENCIES
+= libgtk2
248 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK3
),y
)
249 OPENCV3_CONF_OPTS
+= -DWITH_GTK
=ON
-DWITH_GTK_2_X
=OFF
250 OPENCV3_DEPENDENCIES
+= libgtk3
253 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_JASPER
),y
)
254 OPENCV3_CONF_OPTS
+= -DWITH_JASPER
=ON
255 OPENCV3_DEPENDENCIES
+= jasper
257 OPENCV3_CONF_OPTS
+= -DWITH_JASPER
=OFF
260 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_JPEG
),y
)
261 OPENCV3_CONF_OPTS
+= -DWITH_JPEG
=ON
262 OPENCV3_DEPENDENCIES
+= jpeg
264 OPENCV3_CONF_OPTS
+= -DWITH_JPEG
=OFF
267 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_OPENGL
),y
)
268 OPENCV3_CONF_OPTS
+= -DWITH_OPENGL
=ON
269 OPENCV3_DEPENDENCIES
+= libgl
271 OPENCV3_CONF_OPTS
+= -DWITH_OPENGL
=OFF
274 OPENCV3_CONF_OPTS
+= -DWITH_OPENMP
=$(if
$(BR2_GCC_ENABLE_OPENMP
),ON
,OFF
)
276 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_PNG
),y
)
277 OPENCV3_CONF_OPTS
+= -DWITH_PNG
=ON
278 OPENCV3_DEPENDENCIES
+= libpng
280 OPENCV3_CONF_OPTS
+= -DWITH_PNG
=OFF
283 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT
)$(BR2_PACKAGE_OPENCV3_WITH_QT5
),)
284 OPENCV3_CONF_OPTS
+= -DWITH_QT
=OFF
287 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT
),y
)
288 OPENCV3_CONF_OPTS
+= -DWITH_QT
=4
289 OPENCV3_DEPENDENCIES
+= qt
292 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT5
),y
)
293 OPENCV3_CONF_OPTS
+= -DWITH_QT
=5
294 OPENCV3_DEPENDENCIES
+= qt5base
297 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_TIFF
),y
)
298 OPENCV3_CONF_OPTS
+= -DWITH_TIFF
=ON
299 OPENCV3_DEPENDENCIES
+= tiff
301 OPENCV3_CONF_OPTS
+= -DWITH_TIFF
=OFF
304 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_V4L
),y
)
305 OPENCV3_CONF_OPTS
+= \
306 -DWITH_LIBV4L
=$(if
$(BR2_PACKAGE_LIBV4L
),ON
,OFF
) \
308 OPENCV3_DEPENDENCIES
+= $(if
$(BR2_PACKAGE_LIBV4L
),libv4l
)
310 OPENCV3_CONF_OPTS
+= -DWITH_V4L
=OFF
-DWITH_LIBV4L
=OFF
313 ifeq ($(BR2_PACKAGE_OPENCV3_LIB_PYTHON
),y
)
314 ifeq ($(BR2_PACKAGE_PYTHON
),y
)
315 OPENCV3_CONF_OPTS
+= \
316 -DBUILD_opencv_python2
=ON \
317 -DBUILD_opencv_python3
=OFF \
318 -DPYTHON2_EXECUTABLE
=$(HOST_DIR
)/usr
/bin
/python2 \
319 -DPYTHON2_INCLUDE_PATH
=$(STAGING_DIR
)/usr
/include/python
$(PYTHON_VERSION_MAJOR
) \
320 -DPYTHON2_LIBRARIES
=$(STAGING_DIR
)/usr
/lib
/libpython
$(PYTHON_VERSION_MAJOR
).so \
321 -DPYTHON2_NUMPY_INCLUDE_DIRS
=$(STAGING_DIR
)/usr
/lib
/python
$(PYTHON_VERSION_MAJOR
)/site-packages
/numpy
/core
/include \
322 -DPYTHON2_PACKAGES_PATH
=/usr
/lib
/python
$(PYTHON_VERSION_MAJOR
)/site-packages \
323 -DPYTHON2_NUMPY_VERSION
=$(PYTHON_NUMPY_VERSION
)
324 OPENCV3_DEPENDENCIES
+= python
326 OPENCV3_CONF_OPTS
+= \
327 -DBUILD_opencv_python2
=OFF \
328 -DBUILD_opencv_python3
=ON \
329 -DPYTHON3_EXECUTABLE
=$(HOST_DIR
)/usr
/bin
/python3 \
330 -DPYTHON3_INCLUDE_PATH
=$(STAGING_DIR
)/usr
/include/python
$(PYTHON3_VERSION_MAJOR
)m \
331 -DPYTHON3_LIBRARIES
=$(STAGING_DIR
)/usr
/lib
/libpython
$(PYTHON3_VERSION_MAJOR
)m.so \
332 -DPYTHON3_NUMPY_INCLUDE_DIRS
=$(STAGING_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/site-packages
/numpy
/core
/include \
333 -DPYTHON3_PACKAGES_PATH
=/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/site-packages \
334 -DPYTHON3_NUMPY_VERSION
=$(PYTHON_NUMPY_VERSION
)
335 OPENCV3_DEPENDENCIES
+= python3
337 OPENCV3_DEPENDENCIES
+= python-numpy
339 OPENCV3_CONF_OPTS
+= \
340 -DBUILD_opencv_python2
=OFF \
341 -DBUILD_opencv_python3
=OFF
344 # Installation hooks:
345 define OPENCV3_CLEAN_INSTALL_DOC
346 $(RM
) -fr
$(TARGET_DIR
)/usr
/share
/OpenCV
/doc
348 OPENCV3_POST_INSTALL_TARGET_HOOKS
+= OPENCV3_CLEAN_INSTALL_DOC
350 define OPENCV3_CLEAN_INSTALL_CMAKE
351 $(RM
) -f
$(TARGET_DIR
)/usr
/share
/OpenCV
/OpenCVConfig
*.cmake
353 OPENCV3_POST_INSTALL_TARGET_HOOKS
+= OPENCV3_CLEAN_INSTALL_CMAKE
355 ifneq ($(BR2_PACKAGE_OPENCV3_INSTALL_DATA
),y
)
356 define OPENCV3_CLEAN_INSTALL_DATA
357 $(RM
) -fr
$(TARGET_DIR
)/usr
/share
/OpenCV
/haarcascades \
358 $(TARGET_DIR
)/usr
/share
/OpenCV
/lbpcascades
360 OPENCV3_POST_INSTALL_TARGET_HOOKS
+= OPENCV3_CLEAN_INSTALL_DATA
363 $(eval
$(cmake-package
))