Skip to contentSkip to conversation

OpenCV bump (branch yem/smartin/opencv)

PATCH New Yann E. MORIN 2 participants 8 messages Jul 5, 2015 – Jul 6, 2015

lore
Share & tools
lore
#0 lore raw

v10 cover OpenCV bump (branch yem/smartin/opencv)

Hello All!

Yet another round for the bump of OpenCV package from Samuel, with the remaining patches touching the GUI toolkit support.

Patches 1 and 2 preapres for addign more GUI tookits. Patches 3 and 4 adds new tookits.
Patch 5 adds OpenGL support.

Changes v9 -> v10:
- split a patch in two
- tweak some commit logs
- fix extra dependencies

Regards,
Yann E. MORIN.

The following changes since commit ff89e1eb0cdb8ebe9cbd2cf944f43ed132afcb17:

wine: fix sane related build failure (2015-07-05 17:16:40 +0200)

are available in the git repository at:

git://git.busybox.net/~ymorin/git/buildroot yem/smartin/opencv

for you to fetch changes up to 582a50073ade12575a280f6aea96095597f61759:

package/opencv: add opengl support (2015-07-05 23:49:16 +0200)

----------------------------------------------------------------
Samuel Martin (5):
package/opencv: add a choice for selecting the gui toolkit package/opencv: depends on GUI toolkits, rather than select them package/opencv: add qt5 support
package/opencv: add gtk3 support
package/opencv: add opengl support

 package/opencv/Config.in | 99 +++++++++++++++++++++++++++++++++++++-----------
 package/opencv/opencv.mk | 29 ++++++++++++--
 2 files changed, 101 insertions(+), 27 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v10 1/5 package/opencv: add a choice for selecting the gui toolkit

From: Samuel Martin <[email protected]>

In OpenCV, only one GUI toolkit may be used at any one time, so group the two existing options into a choice to make this situation explicit.

This will also be useful when we later add support for Qt5 and gtk3.

[yann.morin.1998 at free.fr: tweak commit log]

---
Changes v9 -> v10:
- tweak commit log (Yann)

---
 package/opencv/Config.in | 67 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 44 insertions(+), 23 deletions(-)
package/opencv/Config.in +44 -23
index 079730e..c3542c4 100644
@@ -52,6 +52,50 @@ config BR2_PACKAGE_OPENCV_LIB_HIGHGUI
 	  Include opencv_highgui (high-level gui and media i/o) module into the
 	  OpenCV build.
 
+choice
+	prompt "gui toolkit"
+	depends on BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+	help
+	  GUI toolkit to be used by the opencv_highgui module.
+
+config BR2_PACKAGE_OPENCV_GUI_NONE
+	bool "none"
+
+config BR2_PACKAGE_OPENCV_WITH_GTK
+	bool "gtk2"
+	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
+	depends on BR2_USE_MMU # libgtk2 -> libglib2
+	depends on BR2_USE_WCHAR # libgtk2 -> libglib2
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libgtk2 -> libglib2
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_PACKAGE_XORG7
+	select BR2_PACKAGE_LIBGTK2
+
+comment "gtk2 needs X.org and a toolchain w/ wchar, threads, C++"
+	depends on BR2_USE_MMU # libgtk2 -> glib2
+	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
+	depends on !BR2_PACKAGE_XORG7 || \
+		!BR2_USE_WCHAR || \
+		!BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_INSTALL_LIBSTDCPP
+
+config BR2_PACKAGE_OPENCV_WITH_QT
+	bool "qt4"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_USE_MMU # qt
+	select BR2_PACKAGE_QT
+	select BR2_PACKAGE_QT_STL
+	select BR2_PACKAGE_QT_GUI_MODULE
+	select BR2_PACKAGE_QT_TEST
+	help
+	  Use Qt with QtTest module and STL support
+
+comment "qt4 needs a toolchain w/ C++"
+	depends on BR2_USE_MMU # qt
+	depends on !BR2_INSTALL_LIBSTDCPP
+
+endchoice
+
 config BR2_PACKAGE_OPENCV_LIB_IMGCODECS
 	bool "imgcodecs"
 	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
@@ -209,17 +253,6 @@ comment "gstreamer-1.x support needs a toolchain w/ wchar, threads"
 
 endchoice
 
-config BR2_PACKAGE_OPENCV_WITH_GTK
-	bool "gtk support"
-	depends on BR2_PACKAGE_XORG7
-	depends on BR2_USE_WCHAR # libgtk2 -> libglib2
-	depends on BR2_TOOLCHAIN_HAS_THREADS # libgtk2 -> libglib2
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # libgtk2 -> glib2
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
-	depends on BR2_PACKAGE_OPENCV_LIB_HIGHGUI
-	select BR2_PACKAGE_LIBGTK2
-
 config BR2_PACKAGE_OPENCV_WITH_JASPER
 	bool "jpeg2000 support"
 	select BR2_PACKAGE_JASPER
@@ -242,18 +275,6 @@ config BR2_PACKAGE_OPENCV_WITH_PNG
 	help
 	  Use shared libpng from the target system.
 
-config BR2_PACKAGE_OPENCV_WITH_QT
-	bool "qt backend support"
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # qt
-	depends on BR2_PACKAGE_OPENCV_LIB_HIGHGUI
-	select BR2_PACKAGE_QT
-	select BR2_PACKAGE_QT_STL
-	select BR2_PACKAGE_QT_GUI_MODULE
-	select BR2_PACKAGE_QT_TEST
-	help
-	  Use Qt with QtTest module and STL support
-
 config BR2_PACKAGE_OPENCV_WITH_TIFF
 	bool "tiff support"
 	select BR2_PACKAGE_TIFF
Signature · 1 line
1.9.1
#2 lore raw

PATCH v10 2/5 package/opencv: depends on GUI toolkits, rather than select them

In reply to Yann E. MORIN

From: Samuel Martin <[email protected]>

Currently, we only support either Qt4 or gtk2, but OpenCV also additionally supports Qt5 or gtk3, making for a choice of four toolkits, one of: Qt4, Qt5, gtk3, gtk2 (and obviously, none).

Since Buildroot does not support coexistence of Qt4 and Qt5, we can no longer select one and depend on the other, like so:

config BR2_PKG_OCV_WITH_QT4
bool "Qt4"
depends on !BR2_PKG_QT5
select BR2_PKG_QT

config BR2_PKG_OCV_WITH_QT5
bool "Qt5"
depends on !BR2_PKG_QT
select BR2_PKG_QT5

otherwise, we'd get a circular dependency chain in Kconfig, which would complain with:

package/opencv/Config.in:57:error: recursive dependency detected!
package/opencv/Config.in:57: choice <choice> contains symbol BR2_PKG_OCV_WITH_QT5
package/opencv/Config.in:111: symbol BR2_PKG_OCV_WITH_QT5 depends on BR2_PKG_QT
package/qt/Config.in:5: symbol BR2_PKG_QT is selected by BR2_PKG_OCV_WITH_QT
package/opencv/Config.in:98: symbol BR2_PKG_OCV_WITH_QT is part of choice <choice>

Instead, we need to depend on either Qt version.

So, to have a consistent choice, we make all support for GUI toolkits actually depend on the toolkit, rather than select it.

[yann.morin.1998 at free.fr: split-out the switch-selects-to-depends hunk
from the add-qt5 hunk]

---
Changes v9 -> v10:
- split this hunk out of next patch (Yann)

---
 package/opencv/Config.in | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)
package/opencv/Config.in +7 -18
index c3542c4..5dd39ca 100644
@@ -63,36 +63,25 @@ config BR2_PACKAGE_OPENCV_GUI_NONE
 
 config BR2_PACKAGE_OPENCV_WITH_GTK
 	bool "gtk2"
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
-	depends on BR2_USE_MMU # libgtk2 -> libglib2
-	depends on BR2_USE_WCHAR # libgtk2 -> libglib2
-	depends on BR2_TOOLCHAIN_HAS_THREADS # libgtk2 -> libglib2
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_PACKAGE_XORG7
-	select BR2_PACKAGE_LIBGTK2
+	depends on BR2_PACKAGE_LIBGTK2
 
-comment "gtk2 needs X.org and a toolchain w/ wchar, threads, C++"
+comment "gtk2 support needs libgtk2"
 	depends on BR2_USE_MMU # libgtk2 -> glib2
 	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
-	depends on !BR2_PACKAGE_XORG7 || \
-		!BR2_USE_WCHAR || \
-		!BR2_TOOLCHAIN_HAS_THREADS || \
-		!BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_PACKAGE_LIBGTK2
 
 config BR2_PACKAGE_OPENCV_WITH_QT
 	bool "qt4"
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # qt
-	select BR2_PACKAGE_QT
+	depends on BR2_PACKAGE_QT
 	select BR2_PACKAGE_QT_STL
 	select BR2_PACKAGE_QT_GUI_MODULE
 	select BR2_PACKAGE_QT_TEST
 	help
-	  Use Qt with QtTest module and STL support
+	  Use Qt4 with QtTest and QtGui modules and STL support, as GUI toolkit.
 
-comment "qt4 needs a toolchain w/ C++"
+comment "qt4 support needs qt"
 	depends on BR2_USE_MMU # qt
-	depends on !BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_PACKAGE_QT
 
 endchoice
 
Signature · 1 line
1.9.1
#3 lore raw

PATCH v10 3/5 package/opencv: add qt5 support

In reply to Yann E. MORIN

From: Samuel Martin <[email protected]>

Starting with the 2.4.6 release, OpenCV supports either Qt4 or Qt5 as GUI toolkit, so add Qt5 in the GUI toolkit choice.

When Qt4 is enabled (and thus Qt5 is hidden and disabled), no need to show a comment stating "Qt5 support needs Qt5", because Qt5 is not selectable.

Conversely, when Qt5 is enabled and Qt4 is not, then no need to show a comment stating "Qt4 support needs Qt4", because enabling Qt4 would disable Qt5.

So, we only show the comments when neither toolkit is enabled.

Cc "Yann E. MORIN" <[email protected]>

[yann.morin.1998 at free.fr: split-out the Qt5 hunk from the
switch-selects-to-depends hunk]

---
Changes v9 -> v10;
- split this patch in two, one to switch depends->select (previous patch) and one to add Qt5 (this patch) (Yann)

---
 package/opencv/Config.in | 16 +++++++++++++++-
 package/opencv/opencv.mk | 11 +++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)
package/opencv/Config.in +15 -1
index 5dd39ca..5e8f189 100644
@@ -81,7 +81,21 @@ config BR2_PACKAGE_OPENCV_WITH_QT
 
 comment "qt4 support needs qt"
 	depends on BR2_USE_MMU # qt
-	depends on !BR2_PACKAGE_QT
+	depends on !BR2_PACKAGE_QT && !BR2_PACKAGE_QT5
+
+config BR2_PACKAGE_OPENCV_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
 
package/opencv/opencv.mk +9 -2
index 0e5cf77..98e1614 100644
@@ -266,11 +266,18 @@ else
 OPENCV_CONF_OPTS += -DWITH_PNG=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT)$(BR2_PACKAGE_OPENCV_WITH_QT5),)
+OPENCV_CONF_OPTS += -DWITH_QT=OFF
+endif
+
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT),y)
 OPENCV_CONF_OPTS += -DWITH_QT=4
 OPENCV_DEPENDENCIES += qt
-else
-OPENCV_CONF_OPTS += -DWITH_QT=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT5),y)
+OPENCV_CONF_OPTS += -DWITH_QT=5
+OPENCV_DEPENDENCIES += qt5base
 endif
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_TIFF),y)
Signature · 1 line
1.9.1
#4 lore raw

PATCH v10 3/5 package/opencv: add qt5 support

Dear Yann E. MORIN,

Quoted 13 lines · Yann E. MORIN
package/opencv/opencv.mk +4 -0
index 0e5cf77..98e1614 100644
@@ -266,11 +266,18 @@ else
 OPENCV_CONF_OPTS += -DWITH_PNG=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT)$(BR2_PACKAGE_OPENCV_WITH_QT5),)
+OPENCV_CONF_OPTS += -DWITH_QT=OFF
+endif
+
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT),y)

package/opencv/opencv.mk else · line 281

Quoted 10 lines
package/opencv/opencv.mk +5 -2
 OPENCV_CONF_OPTS += -DWITH_QT=4
 OPENCV_DEPENDENCIES += qt
-else
-OPENCV_CONF_OPTS += -DWITH_QT=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT5),y)
+OPENCV_CONF_OPTS += -DWITH_QT=5
+OPENCV_DEPENDENCIES += qt5base
 endif

I think something like:

ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT),y)
OPENCV_CONF_OPTS += -DWITH_QT=4
OPENCV_DEPENDENCIES += qt
else ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT5),y)
OPENCV_CONF_OPTS += -DWITH_QT=5
OPENCV_DEPENDENCIES += qt5base
else
OPENCV_CONF_OPTS += -DWITH_QT=OFF
endif

Would probably have been more logical. But oh well, we're already at the 10th iteration, so I'll commit as is, and such improvements can be done as follow-up patches.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v10 4/5 package/opencv: add gtk3 support

In reply to Yann E. MORIN

From: Samuel Martin <[email protected]>

OpenCV now also supports gtk3 as a GUI toolkit, in addition to gtk2, but only one may be enabled at a time.

So, add gtk3 in the choice to select the GUI toolkit.

[yann.morin.1998 at free.fr: drop the superfluous depends-on for the
kconfig symbol, since they're no longer needed now we depend-on rather than select]

---
Chanmge v9 -> v10;
- drop superfluous depends-on (Yann)

---
 package/opencv/Config.in |  9 +++++++++
 package/opencv/opencv.mk | 11 +++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
package/opencv/Config.in +9 -0
index 5e8f189..6ae74b4 100644
@@ -70,6 +70,15 @@ comment "gtk2 support needs libgtk2"
 	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
 	depends on !BR2_PACKAGE_LIBGTK2
 
+config BR2_PACKAGE_OPENCV_WITH_GTK3
+	bool "gtk3"
+	depends on BR2_PACKAGE_LIBGTK3
+
+comment "gtk3 support needs libgtk3"
+	depends on BR2_USE_MMU # libgtk3 -> glib2
+	depends on BR2_ARCH_HAS_ATOMICS # libgtk3 -> cairo
+	depends on !BR2_PACKAGE_LIBGTK3
+
 config BR2_PACKAGE_OPENCV_WITH_QT
 	bool "qt4"
 	depends on BR2_PACKAGE_QT
package/opencv/opencv.mk +9 -2
index 98e1614..c788aeb 100644
@@ -236,11 +236,18 @@ else
 OPENCV_CONF_OPTS += -DWITH_GSTREAMER=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_OPENCV_WITH_GTK)$(BR2_PACKAGE_OPENCV_WITH_GTK3),)
+OPENCV_CONF_OPTS += -DWITH_GTK=OFF -DWITH_GTK_2_X=OFF
+endif
+
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_GTK),y)
 OPENCV_CONF_OPTS += -DWITH_GTK=ON -DWITH_GTK_2_X=ON
 OPENCV_DEPENDENCIES += libgtk2
-else
-OPENCV_CONF_OPTS += -DWITH_GTK=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_OPENCV_WITH_GTK3),y)
+OPENCV_CONF_OPTS += -DWITH_GTK=ON -DWITH_GTK_2_X=OFF
+OPENCV_DEPENDENCIES += libgtk3
 endif
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_JASPER),y)
Signature · 1 line
1.9.1
#6 lore raw

PATCH v10 5/5 package/opencv: add opengl support

In reply to Yann E. MORIN

From: Samuel Martin <[email protected]>

In OpenCV, OpenGL is only used by highgui module.

OpenGL support is done using extensions from 3rd party framework: either Qt5OpenGL with Qt5 (with GL support only, not GLES); or gtkglext (which is not available in Buildroot) with gtk2

So, make OpenGL knob a sub-option of the Qt5 support option.

Note: we enclose both the GUI toolkit choice and the GL option in an if-block, so that the GL option gets properly indented; having it depend on WITH_QT5 is not enough, because it does not directly follow it, so kconfig would not consider it for indenting.

[yann.morin.1998 at free.fr: tweak commit log about the if-block]

---
Changes v9 -> v10:
- slightly expand commit log (Yann)

---
 package/opencv/Config.in | 22 +++++++++++++++++++++-
 package/opencv/opencv.mk |  7 +++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
package/opencv/Config.in +21 -1
index 6ae74b4..0b5d1ac 100644
@@ -52,9 +52,10 @@ config BR2_PACKAGE_OPENCV_LIB_HIGHGUI
 	  Include opencv_highgui (high-level gui and media i/o) module into the
 	  OpenCV build.
 
+if BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+
 choice
 	prompt "gui toolkit"
-	depends on BR2_PACKAGE_OPENCV_LIB_HIGHGUI
 	help
 	  GUI toolkit to be used by the opencv_highgui module.
 
@@ -108,6 +109,25 @@ comment "qt5 support needs qt5"
 
 endchoice
 
+config BR2_PACKAGE_OPENCV_WITH_OPENGL
+	bool "opengl support"
+	# OpenGL support done using Qt5OpenGL, so depends on WITH_QT5
+	depends on BR2_PACKAGE_OPENCV_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_OPENCV_WITH_QT5
+	depends on !BR2_PACKAGE_QT5_GL_AVAILABLE || \
+		!BR2_PACKAGE_HAS_LIBGL
+
+endif # BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+
+
 config BR2_PACKAGE_OPENCV_LIB_IMGCODECS
 	bool "imgcodecs"
 	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
package/opencv/opencv.mk +7 -0
index c788aeb..bb1bcd8 100644
@@ -264,6 +264,13 @@ else
 OPENCV_CONF_OPTS += -DWITH_JPEG=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_OPENCV_WITH_OPENGL),y)
+OPENCV_CONF_OPTS += -DWITH_OPENGL=ON
+OPENCV_DEPENDENCIES += libgl
+else
+OPENCV_CONF_OPTS += -DWITH_OPENGL=OFF
+endif
+
 OPENCV_CONF_OPTS += -DWITH_OPENMP=$(if $(BR2_GCC_ENABLE_OPENMP),ON,OFF)
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_PNG),y)
Signature · 1 line
1.9.1
#7 lore raw

v10 cover OpenCV bump (branch yem/smartin/opencv)

In reply to Yann E. MORIN

Hello,

Quoted 6 lines · Yann E. MORIN

Samuel Martin (5):
package/opencv: add a choice for selecting the gui toolkit package/opencv: depends on GUI toolkits, rather than select them package/opencv: add qt5 support
package/opencv: add gtk3 support
package/opencv: add opengl support

All applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com