From 6a926dec1cd64f1d65e091a1b0360758ddb7d24d Mon Sep 17 00:00:00 2001
From: Matthieu Herrb <matthieu.herrb@laas.fr>
Date: Thu, 20 Jan 2011 17:33:54 +0100
Subject: [PATCH] [wip/libfreenect] update to commit 2ea3eb.

Adds IR image support, an OpenCV wrapper and a synchronous API.

Initial Work done by Nizar, additional patches by me.

For now the python bindings are not built (they depend on cython).
---
 libfreenect/Makefile         | 17 ++++++++++++++--
 libfreenect/PLIST            | 20 ++++++++++++++++--
 libfreenect/distinfo         |  7 +++++--
 libfreenect/patches/patch-aa | 39 ++++++++++++++++++++++++++++++++++++
 libfreenect/patches/patch-ab | 14 +++++++++++++
 libfreenect/patches/patch-ac | 20 ++++++++++++++++++
 6 files changed, 111 insertions(+), 6 deletions(-)
 create mode 100644 libfreenect/patches/patch-aa
 create mode 100644 libfreenect/patches/patch-ab
 create mode 100644 libfreenect/patches/patch-ac

diff --git a/libfreenect/Makefile b/libfreenect/Makefile
index f9cb0c56..a6bb6145 100644
--- a/libfreenect/Makefile
+++ b/libfreenect/Makefile
@@ -2,8 +2,8 @@
 # Created:			Matthieu Herrb on Sat, 13 Nov 2010
 #
 
-COMMIT=		539b28
-PKG_VERSION=	20101124.${COMMIT}
+COMMIT=		2ea3eb
+PKG_VERSION=	20110118.${COMMIT}
 DISTNAME= 	libfreenect-${PKG_VERSION}
 CATEGORIES=	hardware image
 MASTER_SITES=	https://github.com/OpenKinect/libfreenect.git@${COMMIT}
@@ -16,6 +16,19 @@ LICENSE=	apache-2.0
 
 USE_LANGUAGES= c c++ python
 
+#option for opencv wrapping and demo building
+PKG_SUPPORTED_OPTIONS+=		opencv
+PKG_SUGGESTED_OPTIONS-=		opencv
+PKG_OPTION_DESCR.opencv=	Build OpenCV wrapper and demo.
+define PKG_OPTION_SET.opencv
+  CMAKE_ARGS+=			-DBUILD_CV=ON -DCMAKE_C_CFLAGS=-I${ROBOTPKG_BASE}/include
+	include ../../image/opencv/depend.mk
+  CONFIGURE_ENV+= 
+endef
+define PKG_OPTION_UNSET.opencv
+  CMAKE_ARGS+=			-DBUILD_CV=OFF
+endef
+
 include ../../pkgtools/install-sh/depend.mk
 include ../../mk/sysdep/cmake.mk
 include ../../mk/sysdep/libXmu.mk
diff --git a/libfreenect/PLIST b/libfreenect/PLIST
index 8ee89680..9d5f88b2 100644
--- a/libfreenect/PLIST
+++ b/libfreenect/PLIST
@@ -1,9 +1,25 @@
-@comment Wed Nov 24 18:58:39 CET 2010
+@comment Tue Jan 18 16:28:19 CET 2011
+bin/cppview
+${PLIST.opencv}bin/cvdemo
+bin/glpclview
 bin/glview
+bin/tiltdemo
+include/libfreenect.hpp
 include/libfreenect/libfreenect.h
-include/libfreenect/libfreenect.hpp
+${PLIST.opencv}include/libfreenect/libfreenect_cv.h
+include/libfreenect/libfreenect_sync.h
+lib/fakenect/libfreenect.so
+lib/fakenect/libfreenect.so.0.0
+lib/fakenect/libfreenect.so.0.0.1
 lib/libfreenect.a
 lib/libfreenect.so
 lib/libfreenect.so.0.0
 lib/libfreenect.so.0.0.1
+${PLIST.opencv}lib/libfreenect_cv.so
+${PLIST.opencv}lib/libfreenect_cv.so.0.0
+${PLIST.opencv}lib/libfreenect_cv.so.0.0.1
+lib/libfreenect_sync.a
+lib/libfreenect_sync.so
+lib/libfreenect_sync.so.0.0
+lib/libfreenect_sync.so.0.0.1
 lib/pkgconfig/libfreenect.pc
diff --git a/libfreenect/distinfo b/libfreenect/distinfo
index ad258914..7435e861 100644
--- a/libfreenect/distinfo
+++ b/libfreenect/distinfo
@@ -1,2 +1,5 @@
-SHA1 (libfreenect-20101124.539b28.tar.gz) = 535471bb18fda71da2bf8378e946a6a44474cc2c
-RMD160 (libfreenect-20101124.539b28.tar.gz) = 8781e63b4386b981fdcc3bc8ec52c858467df359
+SHA1 (libfreenect-20110118.2ea3eb.tar.gz) = 3b5f6cabc165db6fff5dd15cc82f3bdc641fc1ca
+RMD160 (libfreenect-20110118.2ea3eb.tar.gz) = f34d8b3435b87ec3a5d16093477e93bd96d06d91
+SHA1 (patch-aa) = 006bf4a171363f855feec601819aa4e518a93360
+SHA1 (patch-ab) = 27a3f0078ad1226f82266a8c807de5fbbf8b5eb8
+SHA1 (patch-ac) = df1914aa0e0bf24dd2c2fcc2621a051c1aa08c69
diff --git a/libfreenect/patches/patch-aa b/libfreenect/patches/patch-aa
new file mode 100644
index 00000000..d6bc9778
--- /dev/null
+++ b/libfreenect/patches/patch-aa
@@ -0,0 +1,39 @@
+Add pkgconfig rules to probe for opencv
+
+--- wrappers/opencv/CMakeLists.txt~	2011-01-06 06:03:39.000000000 +0100
++++ wrappers/opencv/CMakeLists.txt	2011-01-20 17:24:38.937287000 +0100
+@@ -1,19 +1,29 @@
+ ######################################################################################
+ # OpenCV Interface
+ ######################################################################################
++find_package(PkgConfig)
++pkg_check_modules(OPENCV2 REQUIRED "opencv")
++
+ add_library (freenect_cv SHARED libfreenect_cv.c)
++
++add_executable(cvdemo cvdemo.c)
++
++set_target_properties(freenect_cv cvdemo PROPERTIES COMPILE_FLAGS "${OPENCV2_CFLAGS}")
++
+ set_target_properties (freenect_cv PROPERTIES
+   VERSION ${PROJECT_VER}
+   SOVERSION ${PROJECT_APIVER})
+ 
+-target_link_libraries (freenect_cv freenect_sync cv)
++
++target_link_libraries (freenect_cv freenect_sync ${OPENCV2_LDFLAGS})
+ 
+ install (TARGETS freenect_cv
+   DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}")
+ install (FILES "libfreenect_cv.h"
+   DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})
+ 
+-add_executable(cvdemo cvdemo.c)
+-target_link_libraries(cvdemo freenect freenect_sync freenect_cv cv highgui)
++
++
++target_link_libraries(cvdemo freenect freenect_sync freenect_cv "${OPENCV2_LDFLAGS}")
+ install (TARGETS cvdemo
+-  DESTINATION bin)
+\ No newline at end of file
++  DESTINATION bin)
diff --git a/libfreenect/patches/patch-ab b/libfreenect/patches/patch-ab
new file mode 100644
index 00000000..59cb3a06
--- /dev/null
+++ b/libfreenect/patches/patch-ab
@@ -0,0 +1,14 @@
+Pkgconfig for opencv produces -I${prefix}/include/opencv, zap opencv/ from 
+include directives and include cv.h only once. 
+ 
+--- wrappers/opencv/cvdemo.c~	2011-01-06 06:03:39.000000000 +0100
++++ wrappers/opencv/cvdemo.c	2011-01-20 16:58:02.937129000 +0100
+@@ -1,7 +1,6 @@
+-#include <opencv/cv.h>
+-#include <opencv/highgui.h>
+ #include <stdio.h>
+ #include "libfreenect_cv.h"
++#include <highgui.h>
+ 
+ IplImage *GlViewColor(IplImage *depth)
+ {
diff --git a/libfreenect/patches/patch-ac b/libfreenect/patches/patch-ac
new file mode 100644
index 00000000..1ea0c99c
--- /dev/null
+++ b/libfreenect/patches/patch-ac
@@ -0,0 +1,20 @@
+Zap opencv/ from include directives.
+
+--- wrappers/opencv/libfreenect_cv.h~	2011-01-06 06:03:39.000000000 +0100
++++ wrappers/opencv/libfreenect_cv.h	2011-01-20 16:54:27.903830000 +0100
+@@ -5,7 +5,7 @@
+ extern "C" {
+ #endif
+ 
+-#include <opencv/cv.h>
++#include <cv.h>
+ 
+ 	IplImage *freenect_sync_get_depth_cv(int index);
+ 	IplImage *freenect_sync_get_rgb_cv(int index);
+@@ -14,4 +14,4 @@
+ }
+ #endif
+ 
+-#endif
+\ No newline at end of file
++#endif
-- 
GitLab