1 ################################################################################
5 ################################################################################
7 OPENCV3_VERSION
= 3.1.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 \
19 -DDOWNLOAD_EXTERNAL_TEST_DATA
=OFF
21 ifeq ($(BR2_PACKAGE_OPENCV3_BUILD_TESTS
)$(BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS
),)
22 OPENCV3_CONF_OPTS
+= -DINSTALL_TEST
=OFF
24 OPENCV3_CONF_OPTS
+= -DINSTALL_TEST
=ON
27 # OpenCV build options
28 OPENCV3_CONF_OPTS
+= \
29 -DBUILD_WITH_STATIC_CRT
=OFF \
30 -DENABLE_COVERAGE
=OFF \
31 -DENABLE_FAST_MATH
=ON \
32 -DENABLE_IMPL_COLLECTION
=OFF \
33 -DENABLE_NOISY_WARNINGS
=OFF \
34 -DENABLE_OMIT_FRAME_POINTER
=ON \
35 -DENABLE_PRECOMPILED_HEADERS
=OFF \
36 -DENABLE_PROFILING
=OFF \
37 -DOPENCV3_WARNINGS_ARE_ERRORS
=OFF
40 OPENCV3_CONF_OPTS
+= \
41 -DCMAKE_INSTALL_RPATH_USE_LINK_PATH
=OFF \
42 -DCMAKE_SKIP_RPATH
=OFF \
43 -DCMAKE_USE_RELATIVE_PATHS
=OFF
45 # OpenCV packaging options:
46 OPENCV3_CONF_OPTS
+= \
48 -DENABLE_SOLUTION_FOLDERS
=OFF \
49 -DINSTALL_CREATE_DISTRIB
=OFF
51 # OpenCV module selection
53 # - core: if not set, opencv does not build anything
54 # - hal: core's dependency
56 # - android*: android stuff
57 # - apps: programs for training classifiers
58 # - java: java bindings
59 # - viz: missing VTK dependency
60 # - world: all-in-one module
62 # * Contrib modules from [1] are disabled:
63 # - opencv_contrib package is not available in Buildroot;
64 # - OPENCV3_EXTRA_MODULES_PATH is not set.
66 # [1] https://github.com/Itseez/opencv_contrib
67 OPENCV3_CONF_OPTS
+= \
68 -DBUILD_opencv_androidcamera
=OFF \
69 -DBUILD_opencv_apps
=OFF \
70 -DBUILD_opencv_calib3d
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_CALIB3D
),ON
,OFF
) \
71 -DBUILD_opencv_core
=ON \
72 -DBUILD_opencv_features2d
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_FEATURES2D
),ON
,OFF
) \
73 -DBUILD_opencv_flann
=$(if
$(BR2_PACKAGE_OPENCV3_LIB_FLANN
),ON
,OFF
) \
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
+= \
206 -DWITH_OPENCL_SVM
=OFF \
212 -DWITH_VA_INTEL
=OFF \
217 OPENCV3_DEPENDENCIES
+= zlib
219 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_FFMPEG
),y
)
220 OPENCV3_CONF_OPTS
+= -DWITH_FFMPEG
=ON
221 OPENCV3_DEPENDENCIES
+= ffmpeg bzip2
223 OPENCV3_CONF_OPTS
+= -DWITH_FFMPEG
=OFF
226 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER
),y
)
227 OPENCV3_CONF_OPTS
+= -DWITH_GSTREAMER_0_10
=ON
228 OPENCV3_DEPENDENCIES
+= gstreamer gst-plugins-base
230 OPENCV3_CONF_OPTS
+= -DWITH_GSTREAMER_0_10
=OFF
233 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1
),y
)
234 OPENCV3_CONF_OPTS
+= -DWITH_GSTREAMER
=ON
235 OPENCV3_DEPENDENCIES
+= gstreamer1 gst1-plugins-base
237 OPENCV3_CONF_OPTS
+= -DWITH_GSTREAMER
=OFF
240 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK
)$(BR2_PACKAGE_OPENCV3_WITH_GTK3
),)
241 OPENCV3_CONF_OPTS
+= -DWITH_GTK
=OFF
-DWITH_GTK_2_X
=OFF
244 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK
),y
)
245 OPENCV3_CONF_OPTS
+= -DWITH_GTK
=ON
-DWITH_GTK_2_X
=ON
246 OPENCV3_DEPENDENCIES
+= libgtk2
249 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK3
),y
)
250 OPENCV3_CONF_OPTS
+= -DWITH_GTK
=ON
-DWITH_GTK_2_X
=OFF
251 OPENCV3_DEPENDENCIES
+= libgtk3
254 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_JASPER
),y
)
255 OPENCV3_CONF_OPTS
+= -DWITH_JASPER
=ON
256 OPENCV3_DEPENDENCIES
+= jasper
258 OPENCV3_CONF_OPTS
+= -DWITH_JASPER
=OFF
261 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_JPEG
),y
)
262 OPENCV3_CONF_OPTS
+= -DWITH_JPEG
=ON
263 OPENCV3_DEPENDENCIES
+= jpeg
265 OPENCV3_CONF_OPTS
+= -DWITH_JPEG
=OFF
268 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_OPENGL
),y
)
269 OPENCV3_CONF_OPTS
+= -DWITH_OPENGL
=ON
270 OPENCV3_DEPENDENCIES
+= libgl
272 OPENCV3_CONF_OPTS
+= -DWITH_OPENGL
=OFF
275 OPENCV3_CONF_OPTS
+= -DWITH_OPENMP
=$(if
$(BR2_GCC_ENABLE_OPENMP
),ON
,OFF
)
277 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_PNG
),y
)
278 OPENCV3_CONF_OPTS
+= -DWITH_PNG
=ON
279 OPENCV3_DEPENDENCIES
+= libpng
281 OPENCV3_CONF_OPTS
+= -DWITH_PNG
=OFF
284 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT
)$(BR2_PACKAGE_OPENCV3_WITH_QT5
),)
285 OPENCV3_CONF_OPTS
+= -DWITH_QT
=OFF
288 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT
),y
)
289 OPENCV3_CONF_OPTS
+= -DWITH_QT
=4
290 OPENCV3_DEPENDENCIES
+= qt
293 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT5
),y
)
294 OPENCV3_CONF_OPTS
+= -DWITH_QT
=5
295 OPENCV3_DEPENDENCIES
+= qt5base
298 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_TIFF
),y
)
299 OPENCV3_CONF_OPTS
+= -DWITH_TIFF
=ON
300 OPENCV3_DEPENDENCIES
+= tiff
302 OPENCV3_CONF_OPTS
+= -DWITH_TIFF
=OFF
305 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_V4L
),y
)
306 OPENCV3_CONF_OPTS
+= \
307 -DWITH_LIBV4L
=$(if
$(BR2_PACKAGE_LIBV4L
),ON
,OFF
) \
309 OPENCV3_DEPENDENCIES
+= $(if
$(BR2_PACKAGE_LIBV4L
),libv4l
)
311 OPENCV3_CONF_OPTS
+= -DWITH_V4L
=OFF
-DWITH_LIBV4L
=OFF
314 ifeq ($(BR2_PACKAGE_OPENCV3_LIB_PYTHON
),y
)
315 ifeq ($(BR2_PACKAGE_PYTHON
),y
)
316 OPENCV3_CONF_OPTS
+= \
317 -DBUILD_opencv_python2
=ON \
318 -DBUILD_opencv_python3
=OFF \
319 -DPYTHON2_EXECUTABLE
=$(HOST_DIR
)/usr
/bin
/python2 \
320 -DPYTHON2_INCLUDE_PATH
=$(STAGING_DIR
)/usr
/include/python
$(PYTHON_VERSION_MAJOR
) \
321 -DPYTHON2_LIBRARIES
=$(STAGING_DIR
)/usr
/lib
/libpython
$(PYTHON_VERSION_MAJOR
).so \
322 -DPYTHON2_NUMPY_INCLUDE_DIRS
=$(STAGING_DIR
)/usr
/lib
/python
$(PYTHON_VERSION_MAJOR
)/site-packages
/numpy
/core
/include \
323 -DPYTHON2_PACKAGES_PATH
=/usr
/lib
/python
$(PYTHON_VERSION_MAJOR
)/site-packages \
324 -DPYTHON2_NUMPY_VERSION
=$(PYTHON_NUMPY_VERSION
)
325 OPENCV3_DEPENDENCIES
+= python
327 OPENCV3_CONF_OPTS
+= \
328 -DBUILD_opencv_python2
=OFF \
329 -DBUILD_opencv_python3
=ON \
330 -DPYTHON3_EXECUTABLE
=$(HOST_DIR
)/usr
/bin
/python3 \
331 -DPYTHON3_INCLUDE_PATH
=$(STAGING_DIR
)/usr
/include/python
$(PYTHON3_VERSION_MAJOR
)m \
332 -DPYTHON3_LIBRARIES
=$(STAGING_DIR
)/usr
/lib
/libpython
$(PYTHON3_VERSION_MAJOR
)m.so \
333 -DPYTHON3_NUMPY_INCLUDE_DIRS
=$(STAGING_DIR
)/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/site-packages
/numpy
/core
/include \
334 -DPYTHON3_PACKAGES_PATH
=/usr
/lib
/python
$(PYTHON3_VERSION_MAJOR
)/site-packages \
335 -DPYTHON3_NUMPY_VERSION
=$(PYTHON_NUMPY_VERSION
)
336 OPENCV3_DEPENDENCIES
+= python3
338 OPENCV3_DEPENDENCIES
+= python-numpy
340 OPENCV3_CONF_OPTS
+= \
341 -DBUILD_opencv_python2
=OFF \
342 -DBUILD_opencv_python3
=OFF
345 # Installation hooks:
346 define OPENCV3_CLEAN_INSTALL_DOC
347 $(RM
) -fr
$(TARGET_DIR
)/usr
/share
/OpenCV
/doc
349 OPENCV3_POST_INSTALL_TARGET_HOOKS
+= OPENCV3_CLEAN_INSTALL_DOC
351 define OPENCV3_CLEAN_INSTALL_CMAKE
352 $(RM
) -f
$(TARGET_DIR
)/usr
/share
/OpenCV
/OpenCVConfig
*.cmake
354 OPENCV3_POST_INSTALL_TARGET_HOOKS
+= OPENCV3_CLEAN_INSTALL_CMAKE
356 ifneq ($(BR2_PACKAGE_OPENCV3_INSTALL_DATA
),y
)
357 define OPENCV3_CLEAN_INSTALL_DATA
358 $(RM
) -fr
$(TARGET_DIR
)/usr
/share
/OpenCV
/haarcascades \
359 $(TARGET_DIR
)/usr
/share
/OpenCV
/lbpcascades
361 OPENCV3_POST_INSTALL_TARGET_HOOKS
+= OPENCV3_CLEAN_INSTALL_DATA
364 $(eval
$(cmake-package
))