Import buildroot 2016.02.01

This commit is contained in:
2016-02-24 22:35:39 +01:00
parent a6ee09dea4
commit 828befcf3c
7393 changed files with 390887 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
Backport from https://github.com/Itseez/opencv/commit/1f983ec39c97298b0c8ce409a1cc229ecf14e55c
From 1f983ec39c97298b0c8ce409a1cc229ecf14e55c Mon Sep 17 00:00:00 2001
From: Maksim Shabunin <maksim.shabunin@itseez.com>
Date: Tue, 9 Jun 2015 13:59:48 +0300
Subject: [PATCH] Fixed compilation of pthread-based parallel_for with gcc
4.4.3
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
modules/core/src/parallel.cpp | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp
index b1e7567..0b593ee 100644
--- a/modules/core/src/parallel.cpp
+++ b/modules/core/src/parallel.cpp
@@ -132,8 +132,14 @@
namespace cv
{
ParallelLoopBody::~ParallelLoopBody() {}
+#if defined HAVE_PTHREADS && HAVE_PTHREADS
+ void parallel_for_pthreads(const cv::Range& range, const cv::ParallelLoopBody& body, double nstripes);
+ size_t parallel_pthreads_get_threads_num();
+ void parallel_pthreads_set_threads_num(int num);
+#endif
}
+
namespace
{
#ifdef CV_PARALLEL_FRAMEWORK
@@ -301,7 +307,7 @@ void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body,
}
#elif defined HAVE_PTHREADS
- void parallel_for_pthreads(const Range& range, const ParallelLoopBody& body, double nstripes);
+
parallel_for_pthreads(range, body, nstripes);
#else
@@ -361,8 +367,6 @@ int cv::getNumThreads(void)
#elif defined HAVE_PTHREADS
- size_t parallel_pthreads_get_threads_num();
-
return parallel_pthreads_get_threads_num();
#else
@@ -424,8 +428,6 @@ void cv::setNumThreads( int threads )
#elif defined HAVE_PTHREADS
- void parallel_pthreads_set_threads_num(int num);
-
parallel_pthreads_set_threads_num(threads);
#endif
--
2.4.4

View File

@@ -0,0 +1,212 @@
Backport from https://github.com/Itseez/opencv/commit/a482dcce464acbd5368fb93c6c3d52ba8401776a
From a482dcce464acbd5368fb93c6c3d52ba8401776a Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <alexander.alekhin@itseez.com>
Date: Thu, 11 Jun 2015 16:53:07 +0300
Subject: [PATCH] fix support for pthreads parallel_for
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
CMakeLists.txt | 29 ++++++++++++++++++++++-------
cmake/OpenCVFindLibsPerf.cmake | 14 +++++++++-----
cmake/templates/cvconfig.h.in | 6 ++++++
modules/core/src/parallel.cpp | 13 ++++++++-----
modules/core/src/parallel_pthreads.cpp | 2 +-
modules/core/src/precomp.hpp | 6 ------
6 files changed, 46 insertions(+), 24 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9a17b3..27d8470 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -188,7 +188,7 @@ OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF (WIN32 AND NOT WINRT) )
-OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" OFF IF (NOT WIN32) )
+OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON IF (NOT WIN32) )
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) )
@@ -1026,6 +1026,27 @@ if(DEFINED WITH_GPHOTO2)
endif(DEFINED WITH_GPHOTO2)
+# Order is similar to CV_PARALLEL_FRAMEWORK in core/src/parallel.cpp
+ocv_clear_vars(CV_PARALLEL_FRAMEWORK)
+if(HAVE_TBB)
+ set(CV_PARALLEL_FRAMEWORK "TBB (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})")
+elseif(HAVE_CSTRIPES)
+ set(CV_PARALLEL_FRAMEWORK "C=")
+elseif(HAVE_OPENMP)
+ set(CV_PARALLEL_FRAMEWORK "OpenMP")
+elseif(HAVE_GCD)
+ set(CV_PARALLEL_FRAMEWORK "GCD")
+elseif(WINRT OR HAVE_CONCURRENCY)
+ set(CV_PARALLEL_FRAMEWORK "Concurrency")
+elseif(HAVE_PTHREADS_PF)
+ set(CV_PARALLEL_FRAMEWORK "pthreads")
+else()
+ set(CV_PARALLEL_FRAMEWORK "none")
+endif()
+status("")
+status(" Parallel framework:" TRUE THEN "${CV_PARALLEL_FRAMEWORK}" ELSE NO)
+
+
# ========================== Other third-party libraries ==========================
status("")
status(" Other third-party libraries:")
@@ -1045,12 +1066,6 @@ status(" Use IPP Async:" HAVE_IPP_A THEN "YES" ELSE NO)
endif(DEFINED WITH_IPP_A)
status(" Use Eigen:" HAVE_EIGEN THEN "YES (ver ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})" ELSE NO)
-status(" Use TBB:" HAVE_TBB THEN "YES (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})" ELSE NO)
-status(" Use OpenMP:" HAVE_OPENMP THEN YES ELSE NO)
-status(" Use GCD" HAVE_GCD THEN YES ELSE NO)
-status(" Use Concurrency" HAVE_CONCURRENCY THEN YES ELSE NO)
-status(" Use C=:" HAVE_CSTRIPES THEN YES ELSE NO)
-status(" Use pthreads for parallel for:" HAVE_PTHREADS_PF THEN YES ELSE NO)
status(" Use Cuda:" HAVE_CUDA THEN "YES (ver ${CUDA_VERSION_STRING})" ELSE NO)
status(" Use OpenCL:" HAVE_OPENCL THEN YES ELSE NO)
diff --git a/cmake/OpenCVFindLibsPerf.cmake b/cmake/OpenCVFindLibsPerf.cmake
index bda5d79..d1bc541 100644
--- a/cmake/OpenCVFindLibsPerf.cmake
+++ b/cmake/OpenCVFindLibsPerf.cmake
@@ -120,12 +120,16 @@ if(WITH_OPENMP)
set(HAVE_OPENMP "${OPENMP_FOUND}")
endif()
-if(UNIX OR ANDROID)
-if(NOT APPLE AND NOT HAVE_TBB AND NOT HAVE_OPENMP)
- set(HAVE_PTHREADS_PF 1)
-else()
- set(HAVE_PTHREADS_PF 0)
+if(NOT MSVC AND NOT DEFINED HAVE_PTHREADS)
+ set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/pthread_test.cpp")
+ file(WRITE "${_fname}" "#include <pthread.h>\nint main() { (void)pthread_self(); return 0; }\n")
+ try_compile(HAVE_PTHREADS "${CMAKE_BINARY_DIR}" "${_fname}")
+ file(REMOVE "${_fname}")
endif()
+
+ocv_clear_vars(HAVE_PTHREADS_PF)
+if(WITH_PTHREADS_PF)
+ set(HAVE_PTHREADS_PF ${HAVE_PTHREADS})
else()
set(HAVE_PTHREADS_PF 0)
endif()
diff --git a/cmake/templates/cvconfig.h.in b/cmake/templates/cvconfig.h.in
index 4a1d1c6..3330774 100644
--- a/cmake/templates/cvconfig.h.in
+++ b/cmake/templates/cvconfig.h.in
@@ -139,6 +139,12 @@
/* PNG codec */
#cmakedefine HAVE_PNG
+/* Posix threads (pthreads) */
+#cmakedefine HAVE_PTHREADS
+
+/* parallel_for with pthreads */
+#cmakedefine HAVE_PTHREADS_PF
+
/* Qt support */
#cmakedefine HAVE_QT
diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp
index 0b593ee..caa8129 100644
--- a/modules/core/src/parallel.cpp
+++ b/modules/core/src/parallel.cpp
@@ -80,6 +80,7 @@
4. HAVE_GCD - system wide, used automatically (APPLE only)
5. WINRT - system wide, used automatically (Windows RT only)
6. HAVE_CONCURRENCY - part of runtime, used automatically (Windows only - MSVS 10, MSVS 11)
+ 7. HAVE_PTHREADS_PF - pthreads if available
*/
#if defined HAVE_TBB
@@ -125,14 +126,14 @@
# define CV_PARALLEL_FRAMEWORK "winrt-concurrency"
#elif defined HAVE_CONCURRENCY
# define CV_PARALLEL_FRAMEWORK "ms-concurrency"
-#elif defined HAVE_PTHREADS
+#elif defined HAVE_PTHREADS_PF
# define CV_PARALLEL_FRAMEWORK "pthreads"
#endif
namespace cv
{
ParallelLoopBody::~ParallelLoopBody() {}
-#if defined HAVE_PTHREADS && HAVE_PTHREADS
+#ifdef HAVE_PTHREADS_PF
void parallel_for_pthreads(const cv::Range& range, const cv::ParallelLoopBody& body, double nstripes);
size_t parallel_pthreads_get_threads_num();
void parallel_pthreads_set_threads_num(int num);
@@ -306,7 +307,7 @@ void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body,
Concurrency::CurrentScheduler::Detach();
}
-#elif defined HAVE_PTHREADS
+#elif defined HAVE_PTHREADS_PF
parallel_for_pthreads(range, body, nstripes);
@@ -365,7 +366,7 @@ int cv::getNumThreads(void)
? Concurrency::CurrentScheduler::Get()->GetNumberOfVirtualProcessors()
: pplScheduler->GetNumberOfVirtualProcessors());
-#elif defined HAVE_PTHREADS
+#elif defined HAVE_PTHREADS_PF
return parallel_pthreads_get_threads_num();
@@ -426,7 +427,7 @@ void cv::setNumThreads( int threads )
Concurrency::MaxConcurrency, threads-1));
}
-#elif defined HAVE_PTHREADS
+#elif defined HAVE_PTHREADS_PF
parallel_pthreads_set_threads_num(threads);
@@ -452,6 +453,8 @@ int cv::getThreadNum(void)
return 0;
#elif defined HAVE_CONCURRENCY
return std::max(0, (int)Concurrency::Context::VirtualProcessorId()); // zero for master thread, unique number for others but not necessary 1,2,3,...
+#elif defined HAVE_PTHREADS_PF
+ return (int)(size_t)(void*)pthread_self(); // no zero-based indexing
#else
return 0;
#endif
diff --git a/modules/core/src/parallel_pthreads.cpp b/modules/core/src/parallel_pthreads.cpp
index 8c34959..091ea2d 100644
--- a/modules/core/src/parallel_pthreads.cpp
+++ b/modules/core/src/parallel_pthreads.cpp
@@ -42,7 +42,7 @@
#include "precomp.hpp"
-#if defined HAVE_PTHREADS && HAVE_PTHREADS
+#ifdef HAVE_PTHREADS_PF
#include <algorithm>
#include <pthread.h>
diff --git a/modules/core/src/precomp.hpp b/modules/core/src/precomp.hpp
index d463126..88b60e4 100644
--- a/modules/core/src/precomp.hpp
+++ b/modules/core/src/precomp.hpp
@@ -292,12 +292,6 @@ TLSData<CoreTLSData>& getCoreTlsData();
#define CL_RUNTIME_EXPORT
#endif
-#ifndef HAVE_PTHREADS
-#if !(defined WIN32 || defined _WIN32 || defined WINCE || defined HAVE_WINRT)
-#define HAVE_PTHREADS 1
-#endif
-#endif
-
extern bool __termination; // skip some cleanups, because process is terminating
// (for example, if ExitProcess() was already called)
--
2.4.4

View File

@@ -0,0 +1,339 @@
menuconfig BR2_PACKAGE_OPENCV3
bool "opencv3"
select BR2_PACKAGE_ZLIB
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
depends on BR2_INSTALL_LIBSTDCPP
depends on BR2_USE_WCHAR
depends on !BR2_STATIC_LIBS # include dlfcn.h
depends on !BR2_PACKAGE_OPENCV
help
OpenCV (Open Source Computer Vision) is a library of programming
functions for real time computer vision.
Note that the opencv_core module and the opencv_hal library
are always built and installed, not matter which other
modules are enabled below.
http://opencv.org/
if BR2_PACKAGE_OPENCV3
comment "OpenCV modules"
config BR2_PACKAGE_OPENCV3_LIB_CALIB3D
bool "calib3d"
select BR2_PACKAGE_OPENCV3_LIB_FEATURES2D
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
help
Include opencv_calib3d (camera calibration and 3d reconstruction) module
into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_FEATURES2D
bool "features2d"
select BR2_PACKAGE_OPENCV3_LIB_FLANN
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
select BR2_PACKAGE_OPENCV3_LIB_ML
help
Include opencv_features2d (2d features framework) module into the OpenCV
build.
config BR2_PACKAGE_OPENCV3_LIB_FLANN
bool "flann"
# opencv_core dependency is already enabled
help
Include opencv_flann (clustering and search in multi-dimensional spaces)
module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_HIGHGUI
bool "highgui"
select BR2_PACKAGE_OPENCV3_LIB_IMGCODECS
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
select BR2_PACKAGE_OPENCV3_LIB_VIDEOIO
help
Include opencv_highgui (high-level gui and media i/o) module into the
OpenCV build.
if BR2_PACKAGE_OPENCV3_LIB_HIGHGUI
choice
prompt "gui toolkit"
help
GUI toolkit to be used by the opencv_highgui module.
config BR2_PACKAGE_OPENCV3_GUI_NONE
bool "none"
config BR2_PACKAGE_OPENCV3_WITH_GTK
bool "gtk2"
depends on BR2_PACKAGE_LIBGTK2
comment "gtk2 support needs libgtk2"
depends on BR2_USE_MMU # libgtk2 -> glib2
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_PACKAGE_LIBGTK2
config BR2_PACKAGE_OPENCV3_WITH_GTK3
bool "gtk3"
depends on BR2_PACKAGE_LIBGTK3
comment "gtk3 support needs libgtk3"
depends on BR2_USE_MMU # libgtk3 -> glib2
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_PACKAGE_LIBGTK3
config BR2_PACKAGE_OPENCV3_WITH_QT
bool "qt4"
depends on BR2_PACKAGE_QT
select BR2_PACKAGE_QT_STL
select BR2_PACKAGE_QT_GUI_MODULE
select BR2_PACKAGE_QT_TEST
help
Use Qt4 with QtTest and QtGui modules and STL support, as GUI toolkit.
comment "qt4 support needs qt"
depends on BR2_USE_MMU # qt
depends on !BR2_PACKAGE_QT && !BR2_PACKAGE_QT5
config BR2_PACKAGE_OPENCV3_WITH_QT5
bool "qt5"
depends on BR2_PACKAGE_QT5
select BR2_PACKAGE_QT5BASE
select BR2_PACKAGE_QT5BASE_CONCURRENT
select BR2_PACKAGE_QT5BASE_GUI
select BR2_PACKAGE_QT5BASE_WIDGETS
help
Use Qt5 with base, concurrent, test, gui and widgets components, as GUI
toolkit.
comment "qt5 support needs qt5"
depends on !BR2_PACKAGE_QT && !BR2_PACKAGE_QT5
endchoice
config BR2_PACKAGE_OPENCV3_WITH_OPENGL
bool "opengl support"
# OpenGL support done using Qt5OpenGL, so depends on WITH_QT5
depends on BR2_PACKAGE_OPENCV3_WITH_QT5
# OpenGL support requires Qt5OpenGL with GL support, not GLES
depends on BR2_PACKAGE_QT5_GL_AVAILABLE
depends on BR2_PACKAGE_HAS_LIBGL
select BR2_PACKAGE_QT5BASE_OPENGL
help
Enable OpenGL for UI.
comment "opengl support needs an OpenGL provider"
depends on BR2_PACKAGE_OPENCV3_WITH_QT5
depends on !BR2_PACKAGE_QT5_GL_AVAILABLE || \
!BR2_PACKAGE_HAS_LIBGL
endif # BR2_PACKAGE_OPENCV3_LIB_HIGHGUI
config BR2_PACKAGE_OPENCV3_LIB_IMGCODECS
bool "imgcodecs"
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
help
Include opencv_imgcodecs (image codecs) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_IMGPROC
bool "imgproc"
# opencv_core dependency is already enabled
help
Include opencv_imgproc (image processing) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_ML
bool "ml"
# opencv_core dependency is already enabled
help
Include opencv_ml (machine learning) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_OBJDETECT
bool "objdetect"
# opencv_core dependency is already enabled
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
select BR2_PACKAGE_OPENCV3_LIB_ML
help
Include opencv_objdetect (object detection) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_PHOTO
bool "photo"
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
help
Include opencv_photo (computational photography) module into the OpenCV
build.
config BR2_PACKAGE_OPENCV3_LIB_PYTHON
bool "python"
depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3
depends on BR2_PACKAGE_PYTHON_NUMPY_ARCH_SUPPORTS
select BR2_PACKAGE_PYTHON_NUMPY
help
Include opencv_python module into the OpenCV build.
No python example is installed.
config BR2_PACKAGE_OPENCV3_LIB_SHAPE
bool "shape"
# opencv_core dependency is already enabled
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
select BR2_PACKAGE_OPENCV3_LIB_VIDEO
help
Include opencv_shape (shape descriptors and matchers) module into the
OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_STITCHING
bool "stitching"
select BR2_PACKAGE_OPENCV3_LIB_CALIB3D
select BR2_PACKAGE_OPENCV3_LIB_FEATURES2D
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
select BR2_PACKAGE_OPENCV3_LIB_OBJDETECT
help
Include opencv_stitching (images stitching) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_SUPERRES
bool "superres"
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
select BR2_PACKAGE_OPENCV3_LIB_VIDEO
help
Include opencv_superres (super resolution) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_TS
bool "ts"
# opencv_core dependency is already enabled
select BR2_PACKAGE_OPENCV3_LIB_HIGHGUI
select BR2_PACKAGE_OPENCV3_LIB_IMGCODECS
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
select BR2_PACKAGE_OPENCV3_LIB_VIDEOIO
help
Include opencv_ts (test) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_VIDEOIO
bool "videoio"
select BR2_PACKAGE_OPENCV3_LIB_IMGCODECS
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
help
Include opencv_videoio (media i/o) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_VIDEO
bool "video"
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
help
Include opencv_video (video analysis) module into the OpenCV build.
config BR2_PACKAGE_OPENCV3_LIB_VIDEOSTAB
bool "videostab"
select BR2_PACKAGE_OPENCV3_LIB_CALIB3D
select BR2_PACKAGE_OPENCV3_LIB_FEATURES2D
select BR2_PACKAGE_OPENCV3_LIB_IMGPROC
select BR2_PACKAGE_OPENCV3_LIB_PHOTO
select BR2_PACKAGE_OPENCV3_LIB_VIDEO
help
Include opencv_videostab (video stabilization) module into the OpenCV
build.
comment "Test sets"
config BR2_PACKAGE_OPENCV3_BUILD_TESTS
bool "build tests"
config BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS
bool "build performance tests"
comment "3rd party support"
config BR2_PACKAGE_OPENCV3_WITH_FFMPEG
bool "ffmpeg support"
select BR2_PACKAGE_BZIP2
select BR2_PACKAGE_FFMPEG
select BR2_PACKAGE_FFMPEG_SWSCALE
depends on !BR2_nios2 # ffmpeg
help
Use ffmpeg from the target system.
choice
prompt "gstreamer support"
help
OpenCV prefers gstreamer-1 over gstreamer-0.10.
config BR2_PACKAGE_OPENCV3_WITHOUT_GSTREAMER
bool "none"
config BR2_PACKAGE_OPENCV3_WITH_GSTREAMER
bool "gstreamer-0.10"
depends on BR2_USE_MMU # gstreamer -> libglib2
depends on BR2_USE_WCHAR # gstreamer -> libglib2
depends on BR2_TOOLCHAIN_HAS_THREADS # gstreamer -> libglib2
select BR2_PACKAGE_GSTREAMER
select BR2_PACKAGE_GST_PLUGINS_BASE
select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_APP
comment "gstreamer-0.10 support needs a toolchain w/ wchar, threads"
depends on BR2_USE_MMU
depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
config BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1
bool "gstreamer-1.x"
depends on BR2_USE_MMU # gstreamer1 -> libglib2
depends on BR2_USE_WCHAR # gstreamer1 -> libglib2
depends on BR2_TOOLCHAIN_HAS_THREADS # gstreamer1 -> libglib2
select BR2_PACKAGE_GSTREAMER1
select BR2_PACKAGE_GST1_PLUGINS_BASE
select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_APP
comment "gstreamer-1.x support needs a toolchain w/ wchar, threads"
depends on BR2_USE_MMU
depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
endchoice
config BR2_PACKAGE_OPENCV3_WITH_JASPER
bool "jpeg2000 support"
select BR2_PACKAGE_JASPER
help
Enable jpeg2000 support.
Note: this does not use the libjasper bundled with opencv,
but uses the libjasper package installed system-wide by
Buildroot.
config BR2_PACKAGE_OPENCV3_WITH_JPEG
bool "jpeg support"
select BR2_PACKAGE_JPEG
help
Use shared libjpeg from the target system.
config BR2_PACKAGE_OPENCV3_WITH_PNG
bool "png support"
select BR2_PACKAGE_LIBPNG
help
Use shared libpng from the target system.
config BR2_PACKAGE_OPENCV3_WITH_TIFF
bool "tiff support"
select BR2_PACKAGE_TIFF
help
Use shared libtiff from the target system.
config BR2_PACKAGE_OPENCV3_WITH_V4L
bool "v4l support"
help
Enable Video 4 Linux support.
If the package libv4l is enabled, its support is automatically enabled.
comment "Install options"
config BR2_PACKAGE_OPENCV3_INSTALL_DATA
bool "install extra data"
help
Install various data that is used by cv libraries and/or demo
applications, specifically for haarcascades and lbpcascades
features.
For further information: see OpenCV documentation.
endif # BR2_PACKAGE_OPENCV3
comment "opencv3 needs a toolchain w/ C++, NPTL, wchar, dynamic library"
depends on !BR2_INSTALL_LIBSTDCPP || \
!BR2_USE_WCHAR || \
!BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
BR2_STATIC_LIBS

View File

@@ -0,0 +1,363 @@
################################################################################
#
# opencv3
#
################################################################################
OPENCV3_VERSION = 3.0.0
OPENCV3_SITE = $(call github,itseez,opencv,$(OPENCV3_VERSION))
OPENCV3_INSTALL_STAGING = YES
OPENCV3_LICENSE = BSD-3c
OPENCV3_LICENSE_FILES = LICENSE
# OpenCV component options
OPENCV3_CONF_OPTS += \
-DBUILD_DOCS=OFF \
-DBUILD_PERF_TESTS=$(if $(BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS),ON,OFF) \
-DBUILD_TESTS=$(if $(BR2_PACKAGE_OPENCV3_BUILD_TESTS),ON,OFF) \
-DBUILD_WITH_DEBUG_INFO=OFF
ifeq ($(BR2_PACKAGE_OPENCV3_BUILD_TESTS)$(BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS),)
OPENCV3_CONF_OPTS += -DINSTALL_TEST=OFF
else
OPENCV3_CONF_OPTS += -DINSTALL_TEST=ON
endif
# OpenCV build options
OPENCV3_CONF_OPTS += \
-DBUILD_WITH_STATIC_CRT=OFF \
-DENABLE_COVERAGE=OFF \
-DENABLE_FAST_MATH=ON \
-DENABLE_IMPL_COLLECTION=OFF \
-DENABLE_NOISY_WARNINGS=OFF \
-DENABLE_OMIT_FRAME_POINTER=ON \
-DENABLE_PRECOMPILED_HEADERS=OFF \
-DENABLE_PROFILING=OFF \
-DOPENCV3_WARNINGS_ARE_ERRORS=OFF
# OpenCV link options
OPENCV3_CONF_OPTS += \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF \
-DCMAKE_SKIP_RPATH=OFF \
-DCMAKE_USE_RELATIVE_PATHS=OFF
# OpenCV packaging options:
OPENCV3_CONF_OPTS += \
-DBUILD_PACKAGE=OFF \
-DENABLE_SOLUTION_FOLDERS=OFF \
-DINSTALL_CREATE_DISTRIB=OFF
# OpenCV module selection
# * 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;
# - OPENCV3_EXTRA_MODULES_PATH is not set.
#
# [1] https://github.com/Itseez/opencv_contrib
OPENCV3_CONF_OPTS += \
-DBUILD_opencv_androidcamera=OFF \
-DBUILD_opencv_apps=OFF \
-DBUILD_opencv_calib3d=$(if $(BR2_PACKAGE_OPENCV3_LIB_CALIB3D),ON,OFF) \
-DBUILD_opencv_core=ON \
-DBUILD_opencv_features2d=$(if $(BR2_PACKAGE_OPENCV3_LIB_FEATURES2D),ON,OFF) \
-DBUILD_opencv_flann=$(if $(BR2_PACKAGE_OPENCV3_LIB_FLANN),ON,OFF) \
-DBUILD_opencv_hal=ON \
-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) \
-DBUILD_opencv_java=OFF \
-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) \
-DBUILD_opencv_viz=OFF \
-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.
# * fma3 and popcnt support is disabled because according to gcc manual [2], it
# is only available on x86_64 haswell, broadwell and knl architecture.
#
# [2] https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/x86-Options.html#x86-Options
OPENCV3_CONF_OPTS += \
-DENABLE_AVX=$(if $(BR2_X86_CPU_HAS_AVX),ON,OFF) \
-DENABLE_AVX2=$(if $(BR2_X86_CPU_HAS_AVX2),ON,OFF) \
-DENABLE_FMA3=OFF \
-DENABLE_POPCNT=OFF \
-DENABLE_POWERPC=OFF \
-DENABLE_SSE=$(if $(BR2_X86_CPU_HAS_SSE),ON,OFF) \
-DENABLE_SSE2=$(if $(BR2_X86_CPU_HAS_SSE2),ON,OFF) \
-DENABLE_SSE3=$(if $(BR2_X86_CPU_HAS_SSE3),ON,OFF) \
-DENABLE_SSE41=$(if $(BR2_X86_CPU_HAS_SSE4),ON,OFF) \
-DENABLE_SSE42=$(if $(BR2_X86_CPU_HAS_SSE42),ON,OFF) \
-DENABLE_SSSE3=$(if $(BR2_X86_CPU_HAS_SSSE3),ON,OFF)
# Cuda stuff
OPENCV3_CONF_OPTS += \
-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 \
-DWITH_CUBLAS=OFF \
-DWITH_CUDA=OFF \
-DWITH_CUFFT=OFF
# NVidia stuff
OPENCV3_CONF_OPTS += -DWITH_NVCUVID=OFF
# AMD stuff
OPENCV3_CONF_OPTS += \
-DWITH_OPENCLAMDBLAS=OFF \
-DWITH_OPENCLAMDFFT=OFF
# Intel stuff
OPENCV3_CONF_OPTS += \
-DBUILD_WITH_DYNAMIC_IPP=OFF \
-DWITH_INTELPERC=OFF \
-DWITH_IPP=OFF \
-DWITH_IPP_A=OFF \
-DWITH_TBB=OFF
# Smartek stuff
OPENCV3_CONF_OPTS += -DWITH_GIGEAPI=OFF
# Prosilica stuff
OPENCV3_CONF_OPTS += -DWITH_PVAPI=OFF
# Ximea stuff
OPENCV3_CONF_OPTS += -DWITH_XIMEA=OFF
# Non-Linux support (Android options) must remain OFF:
OPENCV3_CONF_OPTS += \
-DANDROID=OFF \
-DBUILD_ANDROID_CAMERA_WRAPPER=OFF \
-DBUILD_ANDROID_EXAMPLES=OFF \
-DBUILD_ANDROID_SERVICE=OFF \
-DBUILD_FAT_JAVA_LIB=OFF \
-DINSTALL_ANDROID_EXAMPLES=OFF \
-DWITH_ANDROID_CAMERA=OFF
# Non-Linux support (Mac OSX options) must remain OFF:
OPENCV3_CONF_OPTS += \
-DWITH_AVFOUNDATION=OFF \
-DWITH_CARBON=OFF \
-DWITH_QUICKTIME=OFF
# Non-Linux support (Windows options) must remain OFF:
OPENCV3_CONF_OPTS += \
-DWITH_CSTRIPES=OFF \
-DWITH_DSHOW=OFF \
-DWITH_MSMF=OFF \
-DWITH_PTHREADS_PF=OFF \
-DWITH_VFW=OFF \
-DWITH_VIDEOINPUT=OFF \
-DWITH_WIN32UI=OFF
# Software/3rd-party support options:
# - disable all examples
OPENCV3_CONF_OPTS += \
-DBUILD_EXAMPLES=OFF \
-DBUILD_JASPER=OFF \
-DBUILD_JPEG=OFF \
-DBUILD_OPENEXR=OFF \
-DBUILD_PNG=OFF \
-DBUILD_TIFF=OFF \
-DBUILD_ZLIB=OFF \
-DINSTALL_C_EXAMPLES=OFF \
-DINSTALL_PYTHON_EXAMPLES=OFF \
-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.
OPENCV3_CONF_OPTS += \
-DWITH_1394=OFF \
-DWITH_CLP=OFF \
-DWITH_EIGEN=OFF \
-DWITH_GDAL=OFF \
-DWITH_GPHOTO2=OFF \
-DWITH_OPENCL=OFF \
-DWITH_OPENCL_SVM=OFF \
-DWITH_OPENEXR=OFF \
-DWITH_OPENGL=OFF \
-DWITH_OPENMP=OFF \
-DWITH_OPENNI2=OFF \
-DWITH_OPENNI=OFF \
-DWITH_UNICAP=OFF \
-DWITH_VTK=OFF \
-DWITH_WEBP=OFF \
-DWITH_XINE=OFF
OPENCV3_DEPENDENCIES += zlib
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),y)
OPENCV3_CONF_OPTS += -DWITH_FFMPEG=ON
OPENCV3_DEPENDENCIES += ffmpeg bzip2
else
OPENCV3_CONF_OPTS += -DWITH_FFMPEG=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER),y)
OPENCV3_CONF_OPTS += -DWITH_GSTREAMER_0_10=ON
OPENCV3_DEPENDENCIES += gstreamer gst-plugins-base
else
OPENCV3_CONF_OPTS += -DWITH_GSTREAMER_0_10=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1),y)
OPENCV3_CONF_OPTS += -DWITH_GSTREAMER=ON
OPENCV3_DEPENDENCIES += gstreamer1 gst1-plugins-base
else
OPENCV3_CONF_OPTS += -DWITH_GSTREAMER=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK)$(BR2_PACKAGE_OPENCV3_WITH_GTK3),)
OPENCV3_CONF_OPTS += -DWITH_GTK=OFF -DWITH_GTK_2_X=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK),y)
OPENCV3_CONF_OPTS += -DWITH_GTK=ON -DWITH_GTK_2_X=ON
OPENCV3_DEPENDENCIES += libgtk2
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GTK3),y)
OPENCV3_CONF_OPTS += -DWITH_GTK=ON -DWITH_GTK_2_X=OFF
OPENCV3_DEPENDENCIES += libgtk3
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_JASPER),y)
OPENCV3_CONF_OPTS += -DWITH_JASPER=ON
OPENCV3_DEPENDENCIES += jasper
else
OPENCV3_CONF_OPTS += -DWITH_JASPER=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_JPEG),y)
OPENCV3_CONF_OPTS += -DWITH_JPEG=ON
OPENCV3_DEPENDENCIES += jpeg
else
OPENCV3_CONF_OPTS += -DWITH_JPEG=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_OPENGL),y)
OPENCV3_CONF_OPTS += -DWITH_OPENGL=ON
OPENCV3_DEPENDENCIES += libgl
else
OPENCV3_CONF_OPTS += -DWITH_OPENGL=OFF
endif
OPENCV3_CONF_OPTS += -DWITH_OPENMP=$(if $(BR2_GCC_ENABLE_OPENMP),ON,OFF)
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_PNG),y)
OPENCV3_CONF_OPTS += -DWITH_PNG=ON
OPENCV3_DEPENDENCIES += libpng
else
OPENCV3_CONF_OPTS += -DWITH_PNG=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT)$(BR2_PACKAGE_OPENCV3_WITH_QT5),)
OPENCV3_CONF_OPTS += -DWITH_QT=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT),y)
OPENCV3_CONF_OPTS += -DWITH_QT=4
OPENCV3_DEPENDENCIES += qt
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT5),y)
OPENCV3_CONF_OPTS += -DWITH_QT=5
OPENCV3_DEPENDENCIES += qt5base
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_TIFF),y)
OPENCV3_CONF_OPTS += -DWITH_TIFF=ON
OPENCV3_DEPENDENCIES += tiff
else
OPENCV3_CONF_OPTS += -DWITH_TIFF=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_WITH_V4L),y)
OPENCV3_CONF_OPTS += \
-DWITH_LIBV4L=$(if $(BR2_PACKAGE_LIBV4L),ON,OFF) \
-DWITH_V4L=ON
OPENCV3_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBV4L),libv4l)
else
OPENCV3_CONF_OPTS += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
endif
ifeq ($(BR2_PACKAGE_OPENCV3_LIB_PYTHON),y)
ifeq ($(BR2_PACKAGE_PYTHON),y)
OPENCV3_CONF_OPTS += \
-DBUILD_opencv_python2=ON \
-DBUILD_opencv_python3=OFF \
-DPYTHON2_EXECUTABLE=$(HOST_DIR)/usr/bin/python2 \
-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)
OPENCV3_DEPENDENCIES += python
else
OPENCV3_CONF_OPTS += \
-DBUILD_opencv_python2=OFF \
-DBUILD_opencv_python3=ON \
-DPYTHON3_EXECUTABLE=$(HOST_DIR)/usr/bin/python3 \
-DPYTHON3_INCLUDE_PATH=$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m \
-DPYTHON3_LIBRARIES=$(STAGING_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR)m.so \
-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)
OPENCV3_DEPENDENCIES += python3
endif
OPENCV3_DEPENDENCIES += python-numpy
else
OPENCV3_CONF_OPTS += \
-DBUILD_opencv_python2=OFF \
-DBUILD_opencv_python3=OFF
endif
# Installation hooks:
define OPENCV3_CLEAN_INSTALL_DOC
$(RM) -fr $(TARGET_DIR)/usr/share/OpenCV/doc
endef
OPENCV3_POST_INSTALL_TARGET_HOOKS += OPENCV3_CLEAN_INSTALL_DOC
define OPENCV3_CLEAN_INSTALL_CMAKE
$(RM) -f $(TARGET_DIR)/usr/share/OpenCV/OpenCVConfig*.cmake
endef
OPENCV3_POST_INSTALL_TARGET_HOOKS += OPENCV3_CLEAN_INSTALL_CMAKE
ifneq ($(BR2_PACKAGE_OPENCV3_INSTALL_DATA),y)
define OPENCV3_CLEAN_INSTALL_DATA
$(RM) -fr $(TARGET_DIR)/usr/share/OpenCV/haarcascades \
$(TARGET_DIR)/usr/share/OpenCV/lbpcascades
endef
OPENCV3_POST_INSTALL_TARGET_HOOKS += OPENCV3_CLEAN_INSTALL_DATA
endif
$(eval $(cmake-package))