diff mbox

[v3,1/8] opencv: rework V4L/libv4l support

Message ID 1409515750-10289-2-git-send-email-s.martin49@gmail.com
State Accepted
Headers show

Commit Message

Samuel Martin Aug. 31, 2014, 8:09 p.m. UTC
Starting with the 2.4.7 release, for V4L support, OpenCV does not
requires a libv4l dependency for its V4L support.

So, it now provides 2 distincts knobs for this: WITH_V4L and a new
one: WITH_LIBV4L.

This patch takes advantage of this new knob and libv4l support is
now automatically enabled only if the libv4l package is enabled.

In OpenCV, the logic behind this is:
- using libv4l if available,
- otherwise, use v4l2 or v4l API from the kernel if available.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
chnages v2 -> v3:
- rebase
- remove comments about libv4l use (Yann)

changes v1 -> v2:
- rebase
- extend commit message
---
 package/opencv/Config.in |  8 +-------
 package/opencv/opencv.mk | 10 +++++++---
 2 files changed, 8 insertions(+), 10 deletions(-)

Comments

Yann E. MORIN Sept. 14, 2014, 10:15 p.m. UTC | #1
Samuel, All,

On 2014-08-31 22:09 +0200, Samuel Martin spake thusly:
> Starting with the 2.4.7 release, for V4L support, OpenCV does not
> requires a libv4l dependency for its V4L support.
> 
> So, it now provides 2 distincts knobs for this: WITH_V4L and a new
> one: WITH_LIBV4L.
> 
> This patch takes advantage of this new knob and libv4l support is
> now automatically enabled only if the libv4l package is enabled.
> 
> In OpenCV, the logic behind this is:
> - using libv4l if available,
> - otherwise, use v4l2 or v4l API from the kernel if available.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> chnages v2 -> v3:
> - rebase
> - remove comments about libv4l use (Yann)
> 
> changes v1 -> v2:
> - rebase
> - extend commit message
> ---
>  package/opencv/Config.in |  8 +-------
>  package/opencv/opencv.mk | 10 +++++++---
>  2 files changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/package/opencv/Config.in b/package/opencv/Config.in
> index 3f5051e..24f540e 100644
> --- a/package/opencv/Config.in
> +++ b/package/opencv/Config.in
> @@ -205,16 +205,10 @@ config BR2_PACKAGE_OPENCV_WITH_TIFF
>  
>  config BR2_PACKAGE_OPENCV_WITH_V4L
>  	bool "v4l support"
> -	depends on BR2_LARGEFILE
> -	depends on BR2_TOOLCHAIN_HAS_THREADS
> -	depends on BR2_USE_MMU # libv4l fork
> -	select BR2_PACKAGE_LIBV4L
>  	help
>  	  Enable Video 4 Linux support.
>  
> -comment "v4l support needs a toolchain w/ largefile, threads"
> -	depends on !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS
> -	depends on BR2_USE_MMU
> +	  If the package libv4l is enabled, its support is automatically enabled.
>  
>  comment "Install options"
>  
> diff --git a/package/opencv/opencv.mk b/package/opencv/opencv.mk
> index 1341d32..2b649ff 100644
> --- a/package/opencv/opencv.mk
> +++ b/package/opencv/opencv.mk
> @@ -220,10 +220,14 @@ OPENCV_CONF_OPT += -DWITH_TIFF=OFF
>  endif
>  
>  ifeq ($(BR2_PACKAGE_OPENCV_WITH_V4L),y)
> -OPENCV_CONF_OPT += -DWITH_V4L=ON -DWITH_LIBV4L=ON
> -OPENCV_DEPENDENCIES += libv4l
> +OPENCV_CONF_OPT += \
> +	-DWITH_V4L=ON \
> +	-DWITH_LIBV4L=$(if $(BR2_PACKAGE_LIBV4L),ON,OFF)
> +OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBV4L),libv4l)
>  else
> -OPENCV_CONF_OPT += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
> +OPENCV_CONF_OPT += \
> +	-DWITH_V4L=OFF \
> +	-DWITH_LIBV4L=OFF

Gratuituous reformating. Besides, the previous line fit in 80-chars, so
there is no real reason to reformat it.

With that fixed:
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

>  endif
>  
>  # Installation hooks:
> -- 
> 2.1.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Sept. 21, 2014, 8:47 p.m. UTC | #2
Dear Samuel Martin,

On Sun, 31 Aug 2014 22:09:03 +0200, Samuel Martin wrote:
> Starting with the 2.4.7 release, for V4L support, OpenCV does not
> requires a libv4l dependency for its V4L support.
> 
> So, it now provides 2 distincts knobs for this: WITH_V4L and a new
> one: WITH_LIBV4L.
> 
> This patch takes advantage of this new knob and libv4l support is
> now automatically enabled only if the libv4l package is enabled.
> 
> In OpenCV, the logic behind this is:
> - using libv4l if available,
> - otherwise, use v4l2 or v4l API from the kernel if available.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>

Thanks, applied, after tweaking the commit as suggested by Yann (do not
do a gratuitous reformatting).

Thomas
diff mbox

Patch

diff --git a/package/opencv/Config.in b/package/opencv/Config.in
index 3f5051e..24f540e 100644
--- a/package/opencv/Config.in
+++ b/package/opencv/Config.in
@@ -205,16 +205,10 @@  config BR2_PACKAGE_OPENCV_WITH_TIFF
 
 config BR2_PACKAGE_OPENCV_WITH_V4L
 	bool "v4l support"
-	depends on BR2_LARGEFILE
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_USE_MMU # libv4l fork
-	select BR2_PACKAGE_LIBV4L
 	help
 	  Enable Video 4 Linux support.
 
-comment "v4l support needs a toolchain w/ largefile, threads"
-	depends on !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_USE_MMU
+	  If the package libv4l is enabled, its support is automatically enabled.
 
 comment "Install options"
 
diff --git a/package/opencv/opencv.mk b/package/opencv/opencv.mk
index 1341d32..2b649ff 100644
--- a/package/opencv/opencv.mk
+++ b/package/opencv/opencv.mk
@@ -220,10 +220,14 @@  OPENCV_CONF_OPT += -DWITH_TIFF=OFF
 endif
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_V4L),y)
-OPENCV_CONF_OPT += -DWITH_V4L=ON -DWITH_LIBV4L=ON
-OPENCV_DEPENDENCIES += libv4l
+OPENCV_CONF_OPT += \
+	-DWITH_V4L=ON \
+	-DWITH_LIBV4L=$(if $(BR2_PACKAGE_LIBV4L),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBV4L),libv4l)
 else
-OPENCV_CONF_OPT += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
+OPENCV_CONF_OPT += \
+	-DWITH_V4L=OFF \
+	-DWITH_LIBV4L=OFF
 endif
 
 # Installation hooks: