2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2011-10-20 19:09:18 +02:00
|
|
|
#
|
2015-08-24 14:47:09 +02:00
|
|
|
# opencv3
|
2011-10-20 19:09:18 +02:00
|
|
|
#
|
2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2013-06-06 01:53:25 +02:00
|
|
|
|
2019-05-31 17:35:55 +02:00
|
|
|
OPENCV3_VERSION = 3.4.6
|
2017-04-21 11:44:02 +02:00
|
|
|
OPENCV3_SITE = $(call github,opencv,opencv,$(OPENCV3_VERSION))
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_INSTALL_STAGING = YES
|
2017-03-30 15:43:38 +02:00
|
|
|
OPENCV3_LICENSE = BSD-3-Clause
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_LICENSE_FILES = LICENSE
|
2017-09-16 15:56:06 +02:00
|
|
|
OPENCV3_SUPPORTS_IN_SOURCE_BUILD = NO
|
2011-10-20 19:09:18 +02:00
|
|
|
|
2018-08-01 22:55:28 +02:00
|
|
|
OPENCV3_CXXFLAGS = $(TARGET_CXXFLAGS)
|
|
|
|
|
2016-09-05 23:00:56 +02:00
|
|
|
# Uses __atomic_fetch_add_4
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
|
2018-08-01 22:55:28 +02:00
|
|
|
OPENCV3_CXXFLAGS += -latomic
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Fix c++11 build with missing std::exception_ptr
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_64735),y)
|
|
|
|
OPENCV3_CXXFLAGS += -DCV__EXCEPTION_PTR=0
|
2016-09-05 23:00:56 +02:00
|
|
|
endif
|
|
|
|
|
2019-05-31 18:26:45 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_68485),y)
|
|
|
|
OPENCV3_CXXFLAGS += -O0
|
|
|
|
endif
|
|
|
|
|
2014-04-23 01:15:41 +02:00
|
|
|
# OpenCV component options
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2018-08-01 22:55:28 +02:00
|
|
|
-DCMAKE_CXX_FLAGS="$(OPENCV3_CXXFLAGS)" \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DBUILD_DOCS=OFF \
|
2015-08-24 14:47:09 +02:00
|
|
|
-DBUILD_PERF_TESTS=$(if $(BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS),ON,OFF) \
|
|
|
|
-DBUILD_TESTS=$(if $(BR2_PACKAGE_OPENCV3_BUILD_TESTS),ON,OFF) \
|
2016-03-28 21:49:33 +02:00
|
|
|
-DBUILD_WITH_DEBUG_INFO=OFF \
|
2019-07-23 21:50:40 +02:00
|
|
|
-DDOWNLOAD_EXTERNAL_TEST_DATA=OFF \
|
|
|
|
-DOPENCV_ENABLE_PKG_CONFIG=ON
|
2014-04-23 01:15:41 +02:00
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_BUILD_TESTS)$(BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS),)
|
|
|
|
OPENCV3_CONF_OPTS += -DINSTALL_TEST=OFF
|
2015-06-25 21:59:43 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DINSTALL_TEST=ON
|
2015-06-25 21:59:43 +02:00
|
|
|
endif
|
|
|
|
|
2014-04-23 01:15:41 +02:00
|
|
|
# OpenCV build options
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_WITH_STATIC_CRT=OFF \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DENABLE_COVERAGE=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DENABLE_FAST_MATH=ON \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DENABLE_IMPL_COLLECTION=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DENABLE_NOISY_WARNINGS=OFF \
|
|
|
|
-DENABLE_OMIT_FRAME_POINTER=ON \
|
2014-04-23 01:15:41 +02:00
|
|
|
-DENABLE_PRECOMPILED_HEADERS=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DENABLE_PROFILING=OFF \
|
2015-08-24 14:47:09 +02:00
|
|
|
-DOPENCV3_WARNINGS_ARE_ERRORS=OFF
|
2014-04-23 01:15:41 +02:00
|
|
|
|
|
|
|
# OpenCV link options
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2012-07-16 23:37:30 +02:00
|
|
|
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DCMAKE_SKIP_RPATH=OFF \
|
2014-04-23 01:15:41 +02:00
|
|
|
-DCMAKE_USE_RELATIVE_PATHS=OFF
|
|
|
|
|
|
|
|
# OpenCV packaging options:
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_PACKAGE=OFF \
|
2014-04-23 01:15:41 +02:00
|
|
|
-DENABLE_SOLUTION_FOLDERS=OFF \
|
|
|
|
-DINSTALL_CREATE_DISTRIB=OFF
|
2012-07-16 23:37:30 +02:00
|
|
|
|
|
|
|
# OpenCV module selection
|
2015-06-25 21:59:43 +02:00
|
|
|
# * Modules on:
|
|
|
|
# - core: if not set, opencv does not build anything
|
|
|
|
# - hal: core's dependency
|
|
|
|
# * Modules off:
|
|
|
|
# - android*: android stuff
|
|
|
|
# - apps: programs for training classifiers
|
|
|
|
# - java: java bindings
|
|
|
|
# - viz: missing VTK dependency
|
|
|
|
# - world: all-in-one module
|
|
|
|
#
|
|
|
|
# * Contrib modules from [1] are disabled:
|
|
|
|
# - opencv_contrib package is not available in Buildroot;
|
2015-08-24 14:47:09 +02:00
|
|
|
# - OPENCV3_EXTRA_MODULES_PATH is not set.
|
2015-06-25 21:59:43 +02:00
|
|
|
#
|
|
|
|
# [1] https://github.com/Itseez/opencv_contrib
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_opencv_androidcamera=OFF \
|
|
|
|
-DBUILD_opencv_apps=OFF \
|
2015-08-24 14:47:09 +02:00
|
|
|
-DBUILD_opencv_calib3d=$(if $(BR2_PACKAGE_OPENCV3_LIB_CALIB3D),ON,OFF) \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_opencv_core=ON \
|
2015-08-24 14:47:09 +02:00
|
|
|
-DBUILD_opencv_features2d=$(if $(BR2_PACKAGE_OPENCV3_LIB_FEATURES2D),ON,OFF) \
|
|
|
|
-DBUILD_opencv_flann=$(if $(BR2_PACKAGE_OPENCV3_LIB_FLANN),ON,OFF) \
|
|
|
|
-DBUILD_opencv_highgui=$(if $(BR2_PACKAGE_OPENCV3_LIB_HIGHGUI),ON,OFF) \
|
|
|
|
-DBUILD_opencv_imgcodecs=$(if $(BR2_PACKAGE_OPENCV3_LIB_IMGCODECS),ON,OFF) \
|
|
|
|
-DBUILD_opencv_imgproc=$(if $(BR2_PACKAGE_OPENCV3_LIB_IMGPROC),ON,OFF) \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_opencv_java=OFF \
|
2015-08-24 14:47:09 +02:00
|
|
|
-DBUILD_opencv_ml=$(if $(BR2_PACKAGE_OPENCV3_LIB_ML),ON,OFF) \
|
|
|
|
-DBUILD_opencv_objdetect=$(if $(BR2_PACKAGE_OPENCV3_LIB_OBJDETECT),ON,OFF) \
|
|
|
|
-DBUILD_opencv_photo=$(if $(BR2_PACKAGE_OPENCV3_LIB_PHOTO),ON,OFF) \
|
|
|
|
-DBUILD_opencv_shape=$(if $(BR2_PACKAGE_OPENCV3_LIB_SHAPE),ON,OFF) \
|
|
|
|
-DBUILD_opencv_stitching=$(if $(BR2_PACKAGE_OPENCV3_LIB_STITCHING),ON,OFF) \
|
|
|
|
-DBUILD_opencv_superres=$(if $(BR2_PACKAGE_OPENCV3_LIB_SUPERRES),ON,OFF) \
|
|
|
|
-DBUILD_opencv_ts=$(if $(BR2_PACKAGE_OPENCV3_LIB_TS),ON,OFF) \
|
|
|
|
-DBUILD_opencv_video=$(if $(BR2_PACKAGE_OPENCV3_LIB_VIDEO),ON,OFF) \
|
|
|
|
-DBUILD_opencv_videoio=$(if $(BR2_PACKAGE_OPENCV3_LIB_VIDEOIO),ON,OFF) \
|
|
|
|
-DBUILD_opencv_videostab=$(if $(BR2_PACKAGE_OPENCV3_LIB_VIDEOSTAB),ON,OFF) \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DBUILD_opencv_viz=OFF \
|
2012-07-16 23:37:30 +02:00
|
|
|
-DBUILD_opencv_world=OFF
|
|
|
|
|
|
|
|
# Hardware support options.
|
|
|
|
#
|
|
|
|
# * PowerPC support is turned off since its only effect is altering CFLAGS,
|
|
|
|
# adding '-mcpu=G3 -mtune=G5' to them, which is already handled by Buildroot.
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2018-06-07 10:38:57 +02:00
|
|
|
-DENABLE_POWERPC=OFF \
|
2018-07-30 18:08:36 +02:00
|
|
|
-DENABLE_NEON=$(if $(BR2_ARM_CPU_HAS_NEON),ON,OFF)
|
|
|
|
|
|
|
|
ifeq ($(BR2_ARCH_IS_64):$(BR2_ARM_CPU_HAS_VFPV3),:y)
|
|
|
|
OPENCV3_CONF_OPTS += -DENABLE_VFPV3=ON
|
|
|
|
else
|
|
|
|
OPENCV3_CONF_OPTS += -DENABLE_VFPV3=OFF
|
|
|
|
endif
|
2012-07-16 23:37:30 +02:00
|
|
|
|
2014-04-23 01:15:42 +02:00
|
|
|
# Cuda stuff
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DBUILD_CUDA_STUBS=OFF \
|
|
|
|
-DBUILD_opencv_cudaarithm=OFF \
|
|
|
|
-DBUILD_opencv_cudabgsegm=OFF \
|
|
|
|
-DBUILD_opencv_cudacodec=OFF \
|
|
|
|
-DBUILD_opencv_cudafeatures2d=OFF \
|
|
|
|
-DBUILD_opencv_cudafilters=OFF \
|
|
|
|
-DBUILD_opencv_cudaimgproc=OFF \
|
|
|
|
-DBUILD_opencv_cudalegacy=OFF \
|
|
|
|
-DBUILD_opencv_cudaobjdetect=OFF \
|
|
|
|
-DBUILD_opencv_cudaoptflow=OFF \
|
|
|
|
-DBUILD_opencv_cudastereo=OFF \
|
|
|
|
-DBUILD_opencv_cudawarping=OFF \
|
|
|
|
-DBUILD_opencv_cudev=OFF \
|
2014-04-23 01:15:42 +02:00
|
|
|
-DWITH_CUBLAS=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DWITH_CUDA=OFF \
|
2014-04-23 01:15:42 +02:00
|
|
|
-DWITH_CUFFT=OFF
|
|
|
|
|
|
|
|
# NVidia stuff
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_NVCUVID=OFF
|
2014-04-23 01:15:42 +02:00
|
|
|
|
|
|
|
# AMD stuff
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:42 +02:00
|
|
|
-DWITH_OPENCLAMDBLAS=OFF \
|
|
|
|
-DWITH_OPENCLAMDFFT=OFF
|
2014-04-23 01:15:42 +02:00
|
|
|
|
|
|
|
# Intel stuff
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DBUILD_WITH_DYNAMIC_IPP=OFF \
|
2014-04-23 01:15:42 +02:00
|
|
|
-DWITH_INTELPERC=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DWITH_IPP=OFF \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DWITH_IPP_A=OFF \
|
2014-04-23 01:15:42 +02:00
|
|
|
-DWITH_TBB=OFF
|
|
|
|
|
|
|
|
# Smartek stuff
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_GIGEAPI=OFF
|
2014-04-23 01:15:42 +02:00
|
|
|
|
|
|
|
# Prosilica stuff
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_PVAPI=OFF
|
2014-04-23 01:15:42 +02:00
|
|
|
|
|
|
|
# Ximea stuff
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_XIMEA=OFF
|
2014-04-23 01:15:42 +02:00
|
|
|
|
2014-04-23 01:15:43 +02:00
|
|
|
# Non-Linux support (Android options) must remain OFF:
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DANDROID=OFF \
|
2012-07-16 23:37:30 +02:00
|
|
|
-DBUILD_ANDROID_CAMERA_WRAPPER=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_ANDROID_EXAMPLES=OFF \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DBUILD_ANDROID_SERVICE=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_FAT_JAVA_LIB=OFF \
|
2015-06-25 21:59:42 +02:00
|
|
|
-DINSTALL_ANDROID_EXAMPLES=OFF \
|
|
|
|
-DWITH_ANDROID_CAMERA=OFF
|
2014-04-23 01:15:43 +02:00
|
|
|
|
|
|
|
# Non-Linux support (Mac OSX options) must remain OFF:
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DWITH_AVFOUNDATION=OFF \
|
|
|
|
-DWITH_CARBON=OFF \
|
2014-04-23 01:15:43 +02:00
|
|
|
-DWITH_QUICKTIME=OFF
|
|
|
|
|
|
|
|
# Non-Linux support (Windows options) must remain OFF:
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2014-04-23 01:15:43 +02:00
|
|
|
-DWITH_CSTRIPES=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DWITH_DSHOW=OFF \
|
|
|
|
-DWITH_MSMF=OFF \
|
2015-06-25 21:59:42 +02:00
|
|
|
-DWITH_VFW=OFF \
|
|
|
|
-DWITH_VIDEOINPUT=OFF \
|
|
|
|
-DWITH_WIN32UI=OFF
|
2014-04-23 01:15:43 +02:00
|
|
|
|
2015-06-25 21:59:43 +02:00
|
|
|
# Software/3rd-party support options:
|
|
|
|
# - disable all examples
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DBUILD_EXAMPLES=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_JASPER=OFF \
|
|
|
|
-DBUILD_JPEG=OFF \
|
2014-04-23 01:15:43 +02:00
|
|
|
-DBUILD_OPENEXR=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DBUILD_PNG=OFF \
|
|
|
|
-DBUILD_TIFF=OFF \
|
|
|
|
-DBUILD_ZLIB=OFF \
|
|
|
|
-DINSTALL_C_EXAMPLES=OFF \
|
|
|
|
-DINSTALL_PYTHON_EXAMPLES=OFF \
|
2014-04-23 01:15:43 +02:00
|
|
|
-DINSTALL_TO_MANGLED_PATHS=OFF
|
|
|
|
|
|
|
|
# Disabled features (mostly because they are not available in Buildroot), but
|
|
|
|
# - eigen: OpenCV does not use it, not take any benefit from it.
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DWITH_1394=OFF \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DWITH_CLP=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DWITH_EIGEN=OFF \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DWITH_GDAL=OFF \
|
|
|
|
-DWITH_GPHOTO2=OFF \
|
2017-05-14 20:26:55 +02:00
|
|
|
-DWITH_LAPACK=OFF \
|
2016-03-28 21:49:33 +02:00
|
|
|
-DWITH_MATLAB=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DWITH_OPENCL=OFF \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DWITH_OPENCL_SVM=OFF \
|
2014-04-23 01:15:43 +02:00
|
|
|
-DWITH_OPENEXR=OFF \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DWITH_OPENNI2=OFF \
|
2015-06-07 12:26:27 +02:00
|
|
|
-DWITH_OPENNI=OFF \
|
|
|
|
-DWITH_UNICAP=OFF \
|
2016-03-28 21:49:33 +02:00
|
|
|
-DWITH_VA=OFF \
|
|
|
|
-DWITH_VA_INTEL=OFF \
|
2015-06-25 21:59:43 +02:00
|
|
|
-DWITH_VTK=OFF \
|
|
|
|
-DWITH_WEBP=OFF \
|
2011-10-20 19:09:18 +02:00
|
|
|
-DWITH_XINE=OFF
|
|
|
|
|
2019-07-23 21:50:40 +02:00
|
|
|
OPENCV3_DEPENDENCIES += host-pkgconf zlib
|
2012-05-17 07:11:22 +02:00
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_FFMPEG=ON
|
|
|
|
OPENCV3_DEPENDENCIES += ffmpeg bzip2
|
2011-10-20 19:09:18 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_FFMPEG=OFF
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_GSTREAMER_0_10=ON
|
|
|
|
OPENCV3_DEPENDENCIES += gstreamer gst-plugins-base
|
2011-10-20 19:09:18 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_GSTREAMER_0_10=OFF
|
2015-07-05 11:40:24 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_GSTREAMER=ON
|
|
|
|
OPENCV3_DEPENDENCIES += gstreamer1 gst1-plugins-base
|
2015-07-05 11:40:24 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_GSTREAMER=OFF
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK)$(BR2_PACKAGE_OPENCV3_WITH_GTK3),)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_GTK=OFF -DWITH_GTK_2_X=OFF
|
2015-07-05 23:54:47 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_GTK=ON -DWITH_GTK_2_X=ON
|
|
|
|
OPENCV3_DEPENDENCIES += libgtk2
|
2015-07-05 23:54:47 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK3),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_GTK=ON -DWITH_GTK_2_X=OFF
|
|
|
|
OPENCV3_DEPENDENCIES += libgtk3
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_JASPER),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_JASPER=ON
|
|
|
|
OPENCV3_DEPENDENCIES += jasper
|
2014-04-23 01:15:50 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_JASPER=OFF
|
2014-04-23 01:15:50 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_JPEG),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_JPEG=ON
|
|
|
|
OPENCV3_DEPENDENCIES += jpeg
|
2011-10-20 19:09:18 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_JPEG=OFF
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_OPENGL),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_OPENGL=ON
|
|
|
|
OPENCV3_DEPENDENCIES += libgl
|
2015-07-05 23:54:48 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_OPENGL=OFF
|
2015-07-05 23:54:48 +02:00
|
|
|
endif
|
|
|
|
|
2019-03-26 13:30:47 +01:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_OPENMP=$(if $(BR2_TOOLCHAIN_HAS_OPENMP),ON,OFF)
|
2015-06-25 21:59:52 +02:00
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_PNG),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_PNG=ON
|
|
|
|
OPENCV3_DEPENDENCIES += libpng
|
2011-10-20 19:09:18 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_PNG=OFF
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT5),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_QT=5
|
|
|
|
OPENCV3_DEPENDENCIES += qt5base
|
2019-02-06 15:10:49 +01:00
|
|
|
else
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_QT=OFF
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_TIFF),y)
|
|
|
|
OPENCV3_CONF_OPTS += -DWITH_TIFF=ON
|
|
|
|
OPENCV3_DEPENDENCIES += tiff
|
2011-10-20 19:09:18 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_TIFF=OFF
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_V4L),y)
|
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:42 +02:00
|
|
|
-DWITH_LIBV4L=$(if $(BR2_PACKAGE_LIBV4L),ON,OFF) \
|
|
|
|
-DWITH_V4L=ON
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBV4L),libv4l)
|
2011-10-20 19:09:18 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENCV3_LIB_PYTHON),y)
|
2015-06-25 21:59:49 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON),y)
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:49 +02:00
|
|
|
-DBUILD_opencv_python2=ON \
|
|
|
|
-DBUILD_opencv_python3=OFF \
|
2017-07-05 13:14:19 +02:00
|
|
|
-DPYTHON2_EXECUTABLE=$(HOST_DIR)/bin/python2 \
|
2015-06-25 21:59:49 +02:00
|
|
|
-DPYTHON2_INCLUDE_PATH=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) \
|
|
|
|
-DPYTHON2_LIBRARIES=$(STAGING_DIR)/usr/lib/libpython$(PYTHON_VERSION_MAJOR).so \
|
|
|
|
-DPYTHON2_NUMPY_INCLUDE_DIRS=$(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/numpy/core/include \
|
|
|
|
-DPYTHON2_PACKAGES_PATH=/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
|
|
|
|
-DPYTHON2_NUMPY_VERSION=$(PYTHON_NUMPY_VERSION)
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_DEPENDENCIES += python
|
package/opencv3: ensure the python module works when BR2_PACKAGE_PYTHON{, 3}_PYC_ONLY=y
The OpenCV Python module does a fairly strange thing to read a few
configuration details: it uses Python's execfile() to execute two .py
files and access a few variables. However, execfile() only works with
.py files and not .pyc files.
When BR2_PACKAGE_PYTHON{,3}_PYC_ONLY=y, the .py files are all removed,
causing the OpenCV Python module to not work:
File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 58, in bootstrap
File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.
To fix this problem, this commit uses the newly introduced
<pkg>_KEEP_PY_FILES mechanism, to ensure the important config*.py
files are kept.
Fixes:
https://bugs.busybox.net/show_bug.cgi?id=12171
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2019-11-29 20:07:06 +01:00
|
|
|
OPENCV3_KEEP_PY_FILES += usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/cv2/config*.py
|
2015-06-25 21:59:49 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:49 +02:00
|
|
|
-DBUILD_opencv_python2=OFF \
|
|
|
|
-DBUILD_opencv_python3=ON \
|
2017-07-05 13:14:19 +02:00
|
|
|
-DPYTHON3_EXECUTABLE=$(HOST_DIR)/bin/python3 \
|
2019-11-03 10:18:04 +01:00
|
|
|
-DPYTHON3_INCLUDE_PATH=$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR) \
|
|
|
|
-DPYTHON3_LIBRARIES=$(STAGING_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR).so \
|
2015-06-25 21:59:49 +02:00
|
|
|
-DPYTHON3_NUMPY_INCLUDE_DIRS=$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/numpy/core/include \
|
|
|
|
-DPYTHON3_PACKAGES_PATH=/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
|
|
|
|
-DPYTHON3_NUMPY_VERSION=$(PYTHON_NUMPY_VERSION)
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_DEPENDENCIES += python3
|
package/opencv3: ensure the python module works when BR2_PACKAGE_PYTHON{, 3}_PYC_ONLY=y
The OpenCV Python module does a fairly strange thing to read a few
configuration details: it uses Python's execfile() to execute two .py
files and access a few variables. However, execfile() only works with
.py files and not .pyc files.
When BR2_PACKAGE_PYTHON{,3}_PYC_ONLY=y, the .py files are all removed,
causing the OpenCV Python module to not work:
File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 58, in bootstrap
File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config
ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.
To fix this problem, this commit uses the newly introduced
<pkg>_KEEP_PY_FILES mechanism, to ensure the important config*.py
files are kept.
Fixes:
https://bugs.busybox.net/show_bug.cgi?id=12171
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2019-11-29 20:07:06 +01:00
|
|
|
OPENCV3_KEEP_PY_FILES += usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/cv2/config*.py
|
2015-06-25 21:59:49 +02:00
|
|
|
endif
|
opencv3: fix Python module build for Python 3.x
When the OpenCV3 Python support is enabled with Python 3.x, it builds
properly, and the resulting .so file is built for the target
architecture, but its name is wrong:
output/target/usr/lib/python3.6/site-packages/cv2.cpython-36m-x86_64-linux-gnu.so
This prevents Python 3.x from importing the module:
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
In order to fix this, we simply need to pass PKG_PYTHON_DISTUTILS_ENV
in the environment. The Python module then gets named:
output/target/usr/lib/python3.6/site-packages/cv2.cpython-36m-arm-linux-gnueabi.so
And can be imported properly:
>>> import cv2
>>>
This solution was suggested by Arnout Vandecappelle in
https://stackoverflow.com/questions/49059035/buildroot-opencv3-python-package-builds-for-the-wrong-target.
With Python 2.x, the module is named just cv2.so so this problem isn't
visible. However, for consistency, we also pass
PKG_PYTHON_DISTUTILS_ENV when building against Python 2.x, by putting
the OPENCV3_CONF_ENV assignment inside the
BR2_PACKAGE_OPENCV3_LIB_PYTHON condition, but outside the
BR2_PACKAGE_PYTHON3/BR2_PACKAGE_PYTHON condition.
Signed-off-by: Sasha Shyrokov <alexander-shyrokov@idexx.com>
[Thomas: extend the commit log, apply the solution to Python 2.x.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-03-06 16:58:10 +01:00
|
|
|
OPENCV3_CONF_ENV += $(PKG_PYTHON_DISTUTILS_ENV)
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_DEPENDENCIES += python-numpy
|
2015-06-25 21:59:49 +02:00
|
|
|
else
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_CONF_OPTS += \
|
2015-06-25 21:59:49 +02:00
|
|
|
-DBUILD_opencv_python2=OFF \
|
|
|
|
-DBUILD_opencv_python3=OFF
|
|
|
|
endif
|
|
|
|
|
2012-07-16 23:37:30 +02:00
|
|
|
# Installation hooks:
|
2015-08-24 14:47:09 +02:00
|
|
|
define OPENCV3_CLEAN_INSTALL_DOC
|
2012-07-16 23:37:30 +02:00
|
|
|
$(RM) -fr $(TARGET_DIR)/usr/share/OpenCV/doc
|
2011-10-20 19:09:18 +02:00
|
|
|
endef
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_POST_INSTALL_TARGET_HOOKS += OPENCV3_CLEAN_INSTALL_DOC
|
2011-10-20 19:09:18 +02:00
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
define OPENCV3_CLEAN_INSTALL_CMAKE
|
2012-07-16 23:37:30 +02:00
|
|
|
$(RM) -f $(TARGET_DIR)/usr/share/OpenCV/OpenCVConfig*.cmake
|
2011-10-20 19:09:18 +02:00
|
|
|
endef
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_POST_INSTALL_TARGET_HOOKS += OPENCV3_CLEAN_INSTALL_CMAKE
|
2011-10-20 19:09:18 +02:00
|
|
|
|
2015-08-24 14:47:09 +02:00
|
|
|
ifneq ($(BR2_PACKAGE_OPENCV3_INSTALL_DATA),y)
|
|
|
|
define OPENCV3_CLEAN_INSTALL_DATA
|
2012-07-16 23:37:30 +02:00
|
|
|
$(RM) -fr $(TARGET_DIR)/usr/share/OpenCV/haarcascades \
|
|
|
|
$(TARGET_DIR)/usr/share/OpenCV/lbpcascades
|
2011-10-20 19:09:18 +02:00
|
|
|
endef
|
2015-08-24 14:47:09 +02:00
|
|
|
OPENCV3_POST_INSTALL_TARGET_HOOKS += OPENCV3_CLEAN_INSTALL_DATA
|
2011-10-20 19:09:18 +02:00
|
|
|
endif
|
|
|
|
|
2012-07-03 00:07:32 +02:00
|
|
|
$(eval $(cmake-package))
|