1 ################################################################################
5 ################################################################################
7 OPENCV_VERSION
= 2.4.13
8 OPENCV_SITE
= $(call github
,itseez
,opencv
,$(OPENCV_VERSION
))
9 OPENCV_INSTALL_STAGING
= YES
10 OPENCV_LICENSE
= BSD-3c
11 OPENCV_LICENSE_FILES
= LICENSE
13 # OpenCV component options
15 -DBUILD_PERF_TESTS
=$(if
$(BR2_PACKAGE_OPENCV_BUILD_PERF_TESTS
),ON
,OFF
) \
16 -DBUILD_TESTS
=$(if
$(BR2_PACKAGE_OPENCV_BUILD_TESTS
),ON
,OFF
) \
17 -DBUILD_WITH_DEBUG_INFO
=OFF
19 # OpenCV build options
21 -DBUILD_WITH_STATIC_CRT
=OFF \
22 -DENABLE_FAST_MATH
=ON \
23 -DENABLE_NOISY_WARNINGS
=OFF \
24 -DENABLE_OMIT_FRAME_POINTER
=ON \
25 -DENABLE_PRECOMPILED_HEADERS
=OFF \
26 -DENABLE_PROFILING
=OFF \
27 -DOPENCV_CAN_BREAK_BINARY_COMPATIBILITY
=ON
31 -DCMAKE_INSTALL_RPATH_USE_LINK_PATH
=OFF \
32 -DCMAKE_SKIP_RPATH
=OFF \
33 -DCMAKE_USE_RELATIVE_PATHS
=OFF
35 # OpenCV packaging options:
38 -DENABLE_SOLUTION_FOLDERS
=OFF \
39 -DINSTALL_CREATE_DISTRIB
=OFF
41 # OpenCV module selection
43 -DBUILD_opencv_androidcamera
=OFF \
44 -DBUILD_opencv_apps
=OFF \
45 -DBUILD_opencv_calib3d
=$(if
$(BR2_PACKAGE_OPENCV_LIB_CALIB3D
),ON
,OFF
) \
46 -DBUILD_opencv_contrib
=$(if
$(BR2_PACKAGE_OPENCV_LIB_CONTRIB
),ON
,OFF
) \
47 -DBUILD_opencv_core
=ON \
48 -DBUILD_opencv_dynamicuda
=OFF \
49 -DBUILD_opencv_features2d
=$(if
$(BR2_PACKAGE_OPENCV_LIB_FEATURES2D
),ON
,OFF
) \
50 -DBUILD_opencv_flann
=$(if
$(BR2_PACKAGE_OPENCV_LIB_FLANN
),ON
,OFF
) \
51 -DBUILD_opencv_gpu
=$(if
$(BR2_PACKAGE_OPENCV_LIB_GPU
),ON
,OFF
) \
52 -DBUILD_opencv_highgui
=$(if
$(BR2_PACKAGE_OPENCV_LIB_HIGHGUI
),ON
,OFF
) \
53 -DBUILD_opencv_imgproc
=$(if
$(BR2_PACKAGE_OPENCV_LIB_IMGPROC
),ON
,OFF
) \
54 -DBUILD_opencv_java
=OFF \
55 -DBUILD_opencv_legacy
=$(if
$(BR2_PACKAGE_OPENCV_LIB_LEGACY
),ON
,OFF
) \
56 -DBUILD_opencv_ml
=$(if
$(BR2_PACKAGE_OPENCV_LIB_ML
),ON
,OFF
) \
57 -DBUILD_opencv_nonfree
=$(if
$(BR2_PACKAGE_OPENCV_LIB_NONFREE
),ON
,OFF
) \
58 -DBUILD_opencv_objdetect
=$(if
$(BR2_PACKAGE_OPENCV_LIB_OBJDETECT
),ON
,OFF
) \
59 -DBUILD_opencv_ocl
=OFF \
60 -DBUILD_opencv_photo
=$(if
$(BR2_PACKAGE_OPENCV_LIB_PHOTO
),ON
,OFF
) \
61 -DBUILD_opencv_python
=OFF \
62 -DBUILD_opencv_stitching
=$(if
$(BR2_PACKAGE_OPENCV_LIB_STITCHING
),ON
,OFF
) \
63 -DBUILD_opencv_superres
=$(if
$(BR2_PACKAGE_OPENCV_LIB_SUPERRES
),ON
,OFF
) \
64 -DBUILD_opencv_ts
=$(if
$(BR2_PACKAGE_OPENCV_LIB_TS
),ON
,OFF
) \
65 -DBUILD_opencv_video
=$(if
$(BR2_PACKAGE_OPENCV_LIB_VIDEO
),ON
,OFF
) \
66 -DBUILD_opencv_videostab
=$(if
$(BR2_PACKAGE_OPENCV_LIB_VIDEOSTAB
),ON
,OFF
) \
67 -DBUILD_opencv_world
=OFF
69 # Hardware support options.
71 # * PowerPC support is turned off since its only effect is altering CFLAGS,
72 # adding '-mcpu=G3 -mtune=G5' to them, which is already handled by Buildroot.
74 -DENABLE_AVX
=$(if
$(BR2_X86_CPU_HAS_AVX
),ON
,OFF
) \
75 -DENABLE_AVX2
=$(if
$(BR2_X86_CPU_HAS_AVX2
),ON
,OFF
) \
76 -DENABLE_POWERPC
=OFF \
77 -DENABLE_SSE
=$(if
$(BR2_X86_CPU_HAS_SSE
),ON
,OFF
) \
78 -DENABLE_SSE2
=$(if
$(BR2_X86_CPU_HAS_SSE2
),ON
,OFF
) \
79 -DENABLE_SSE3
=$(if
$(BR2_X86_CPU_HAS_SSE3
),ON
,OFF
) \
80 -DENABLE_SSE41
=$(if
$(BR2_X86_CPU_HAS_SSE4
),ON
,OFF
) \
81 -DENABLE_SSE42
=$(if
$(BR2_X86_CPU_HAS_SSE42
),ON
,OFF
) \
82 -DENABLE_SSSE3
=$(if
$(BR2_X86_CPU_HAS_SSSE3
),ON
,OFF
)
91 OPENCV_CONF_OPTS
+= -DWITH_NVCUVID
=OFF
95 -DWITH_OPENCLAMDBLAS
=OFF \
96 -DWITH_OPENCLAMDFFT
=OFF
100 -DWITH_INTELPERC
=OFF \
105 OPENCV_CONF_OPTS
+= -DWITH_GIGEAPI
=OFF
108 OPENCV_CONF_OPTS
+= -DWITH_PVAPI
=OFF
111 OPENCV_CONF_OPTS
+= -DWITH_XIMEA
=OFF
113 # Non-Linux support (Android options) must remain OFF:
114 OPENCV_CONF_OPTS
+= \
115 -DBUILD_ANDROID_CAMERA_WRAPPER
=OFF \
116 -DBUILD_ANDROID_EXAMPLES
=OFF \
117 -DBUILD_FAT_JAVA_LIB
=OFF \
118 -DBUILD_JAVA_SUPPORT
=OFF \
119 -DINSTALL_ANDROID_EXAMPLES
=OFF \
120 -DWITH_ANDROID_CAMERA
=OFF
122 # Non-Linux support (Mac OSX options) must remain OFF:
123 OPENCV_CONF_OPTS
+= \
124 -DWITH_AVFOUNDATION
=OFF \
128 # Non-Linux support (Windows options) must remain OFF:
129 OPENCV_CONF_OPTS
+= \
130 -DWITH_CSTRIPES
=OFF \
134 -DWITH_VIDEOINPUT
=OFF \
137 # Software/3rd-party support options.
138 OPENCV_CONF_OPTS
+= \
141 -DBUILD_NEW_PYTHON_SUPPORT
=OFF \
142 -DBUILD_OPENEXR
=OFF \
146 -DINSTALL_C_EXAMPLES
=OFF \
147 -DINSTALL_PYTHON_EXAMPLES
=OFF \
148 -DINSTALL_TO_MANGLED_PATHS
=OFF
150 # Disabled features (mostly because they are not available in Buildroot), but
151 # - eigen: OpenCV does not use it, not take any benefit from it.
152 OPENCV_CONF_OPTS
+= \
164 OPENCV_DEPENDENCIES
+= zlib
166 ifeq ($(BR2_PACKAGE_OPENCV_WITH_FFMPEG
),y
)
167 OPENCV_CONF_OPTS
+= -DWITH_FFMPEG
=ON
168 OPENCV_DEPENDENCIES
+= ffmpeg bzip2
170 OPENCV_CONF_OPTS
+= -DWITH_FFMPEG
=OFF
173 ifeq ($(BR2_PACKAGE_OPENCV_WITH_GSTREAMER
),y
)
174 OPENCV_CONF_OPTS
+= -DWITH_GSTREAMER_0_10
=ON
175 OPENCV_DEPENDENCIES
+= gstreamer gst-plugins-base
177 OPENCV_CONF_OPTS
+= -DWITH_GSTREAMER_0_10
=OFF
180 ifeq ($(BR2_PACKAGE_OPENCV_WITH_GSTREAMER1
),y
)
181 OPENCV_CONF_OPTS
+= -DWITH_GSTREAMER
=ON
182 OPENCV_DEPENDENCIES
+= gstreamer1 gst1-plugins-base
184 OPENCV_CONF_OPTS
+= -DWITH_GSTREAMER
=OFF
187 ifeq ($(BR2_PACKAGE_OPENCV_WITH_GTK
),y
)
188 OPENCV_CONF_OPTS
+= -DWITH_GTK
=ON
189 OPENCV_DEPENDENCIES
+= libgtk2
191 OPENCV_CONF_OPTS
+= -DWITH_GTK
=OFF
194 ifeq ($(BR2_PACKAGE_OPENCV_WITH_JASPER
),y
)
195 OPENCV_CONF_OPTS
+= -DWITH_JASPER
=ON
196 OPENCV_DEPENDENCIES
+= jasper
198 OPENCV_CONF_OPTS
+= -DWITH_JASPER
=OFF
201 ifeq ($(BR2_PACKAGE_OPENCV_WITH_JPEG
),y
)
202 OPENCV_CONF_OPTS
+= -DWITH_JPEG
=ON
203 OPENCV_DEPENDENCIES
+= jpeg
205 OPENCV_CONF_OPTS
+= -DWITH_JPEG
=OFF
208 ifeq ($(BR2_PACKAGE_OPENCV_WITH_PNG
),y
)
209 OPENCV_CONF_OPTS
+= -DWITH_PNG
=ON
210 OPENCV_DEPENDENCIES
+= libpng
212 OPENCV_CONF_OPTS
+= -DWITH_PNG
=OFF
215 ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT
),y
)
216 OPENCV_CONF_OPTS
+= -DWITH_QT
=4
217 OPENCV_DEPENDENCIES
+= qt
219 OPENCV_CONF_OPTS
+= -DWITH_QT
=OFF
222 ifeq ($(BR2_PACKAGE_OPENCV_WITH_TIFF
),y
)
223 OPENCV_CONF_OPTS
+= -DWITH_TIFF
=ON
224 OPENCV_DEPENDENCIES
+= tiff
226 OPENCV_CONF_OPTS
+= -DWITH_TIFF
=OFF
229 ifeq ($(BR2_PACKAGE_OPENCV_WITH_V4L
),y
)
230 OPENCV_CONF_OPTS
+= \
231 -DWITH_LIBV4L
=$(if
$(BR2_PACKAGE_LIBV4L
),ON
,OFF
) \
233 OPENCV_DEPENDENCIES
+= $(if
$(BR2_PACKAGE_LIBV4L
),libv4l
)
235 OPENCV_CONF_OPTS
+= -DWITH_V4L
=OFF
-DWITH_LIBV4L
=OFF
238 # Installation hooks:
239 define OPENCV_CLEAN_INSTALL_DOC
240 $(RM
) -fr
$(TARGET_DIR
)/usr
/share
/OpenCV
/doc
242 OPENCV_POST_INSTALL_TARGET_HOOKS
+= OPENCV_CLEAN_INSTALL_DOC
244 define OPENCV_CLEAN_INSTALL_CMAKE
245 $(RM
) -f
$(TARGET_DIR
)/usr
/share
/OpenCV
/OpenCVConfig
*.cmake
247 OPENCV_POST_INSTALL_TARGET_HOOKS
+= OPENCV_CLEAN_INSTALL_CMAKE
249 ifneq ($(BR2_PACKAGE_OPENCV_INSTALL_DATA
),y
)
250 define OPENCV_CLEAN_INSTALL_DATA
251 $(RM
) -fr
$(TARGET_DIR
)/usr
/share
/OpenCV
/haarcascades \
252 $(TARGET_DIR
)/usr
/share
/OpenCV
/lbpcascades
254 OPENCV_POST_INSTALL_TARGET_HOOKS
+= OPENCV_CLEAN_INSTALL_DATA
257 $(eval
$(cmake-package
))