Skip to content

Commit fde880d

Browse files
committed
Merge commit 'v0.1.1' into dfsg
* commit 'v0.1.1': (179 commits) examples: use exit() instead of pthread_exit() from main thread. src/usb_libusb10.c: slightly smarter isoc error handling. examples/hiview.c: Actually request all the devices used. Compile fixes for MinGW. examples/CMakeLists.txt: Trivial whitespace changes. as3-server.c: drop some lines that look like a mismerge and appear to just waste CPU Merge from https://github.com/corrado72/openkinect "unstable" Solved some conflicts Server source separated into libraries, this makes the code easier to read. Add support for opening some subset of the three Kinect devices (motor, camera, audio). src/audio.c: (re)use the NUM_XFERS and PKTS_PER_XFER values used for the camera. src/CMakeLists.txt: use spaces instead of tabs for indentation C# wrapper: Modify OpenTK fetch script to set the download output filename. Fixed VS2010 projects/solutions. Also changed references to OpenTK dlls to a local support folder. The fetch_opentk script gets the dlls and puts them in the right place. Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com> (LostInCake) Added in License information to KinectDemo source files Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com> (LostInCake) Small fix, had some stray commented out code Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com> (LostInCake) Mode selection is more robust. Not entirely dependent on index like before. Mode selection is also now filtered to the few useful modes available. Small improvements in base library. Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com> (LostInCake) Cleaned up wrapper code to reduce duplicate code. Kinect Demo now runs at around 25FPS per feed. There are still instances where, if both RGB and Depth feeds aren't started quickly in succession, the FPSes are down to 15-18. Need to investigate. Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com> (LostInCake) Modified SwapBufferCollection to swap handles directly instead of the silly indices thing I had. Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com> (LostInCake) Removed some unecessary project related files from VS2008 folders. Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com> (LostInCake) More changes to PreviewControl. RGB/IR work in 8 bit formats. Depth works in 10/11 bit formats. Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com> (LostInCake) ... Conflicts: platform/osx/homebrew/libusb-freenect.rb -- removed
2 parents 7e617d0 + dbfd4ce commit fde880d

181 files changed

Lines changed: 27955 additions & 2196 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,19 @@ set (PROJECT_VER
4848
set (PROJECT_APIVER
4949
"${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}")
5050

51+
OPTION(BUILD_AUDIO "Build audio support" OFF)
52+
OPTION(BUILD_REDIST_PACKAGE "Build libfreenect in a legally-redistributable manner (only affects audio)" OFF)
5153
OPTION(BUILD_EXAMPLES "Build example programs" ON)
5254
OPTION(BUILD_FAKENECT "Build fakenect mock library" ON)
5355
OPTION(BUILD_C_SYNC "Build c synchronous library" ON)
56+
OPTION(BUILD_CPP "Build C++ Library (currently header only)" ON)
5457
OPTION(BUILD_CV "Build OpenCV wrapper" OFF)
5558
OPTION(BUILD_AS3_SERVER "Build the Actionscript 3 Server Example" OFF)
59+
OPTION(BUILD_PYTHON "Build Python extension" OFF)
5660
IF(PROJECT_OS_LINUX)
5761
OPTION(BUILD_CPACK "Build an RPM or DEB using CPack" OFF)
5862
ENDIF(PROJECT_OS_LINUX)
5963

60-
# Doesn't work on windows yet.
61-
IF(NOT UNIX)
62-
MESSAGE(FATAL_ERROR "libfreenect is not currently supported on this platform")
63-
ENDIF()
64-
6564
######################################################################################
6665
# CMake Modules
6766
######################################################################################
@@ -83,6 +82,10 @@ if(BIG_ENDIAN)
8382
add_definitions(-DFN_BIGENDIAN)
8483
endif()
8584

85+
if(BUILD_AUDIO)
86+
add_definitions(-DBUILD_AUDIO)
87+
endif()
88+
8689
######################################################################################
8790
# CMake
8891
######################################################################################
@@ -103,6 +106,11 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
103106
# libfreenect.h includes libusb.h, so everyone needs this too
104107
include_directories(${LIBUSB_1_INCLUDE_DIRS})
105108

109+
if(WIN32)
110+
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/platform/windows")
111+
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/platform/windows/libusb10emu")
112+
endif()
113+
106114
# Add library project
107115
add_subdirectory (src)
108116

@@ -119,6 +127,10 @@ IF(BUILD_C_SYNC)
119127
add_subdirectory (wrappers/c_sync)
120128
ENDIF()
121129

130+
IF(BUILD_CPP)
131+
add_subdirectory (wrappers/cpp)
132+
ENDIF()
133+
122134
IF(BUILD_CV)
123135
add_subdirectory (wrappers/opencv)
124136
ENDIF()
@@ -127,6 +139,10 @@ IF(BUILD_AS3_SERVER)
127139
add_subdirectory(wrappers/actionscript)
128140
ENDIF()
129141

142+
IF(BUILD_PYTHON)
143+
add_subdirectory (wrappers/python)
144+
ENDIF()
145+
130146
######################################################################################
131147
# Extras
132148
######################################################################################
@@ -162,11 +178,13 @@ IF ( BUILD_CPACK )
162178
include(CPack)
163179

164180
INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/libfreenect.a" DESTINATION ${PROJECT_LIBRARY_INSTALL_DIR})
181+
if (BUILD_AUDIO)
182+
INSTALL(FILES "include/libfreenect-audio.h" DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})
183+
endif()
165184
INSTALL(FILES "include/libfreenect.h" DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})
166185
INSTALL(FILES "APACHE20" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")
167186
INSTALL(FILES "GPL2" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")
168187
INSTALL(FILES "README.asciidoc" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")
169-
INSTALL(FILES "doc/kinect_protocol.asciidoc" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")
170188

171189
ENDIF ( BUILD_CPACK )
172190

README.asciidoc

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,28 @@ Or the IRC channel at
3535

3636
#openkinect on Freenode
3737

38+
We are also on twitter at
39+
40+
http://twitter.com/openkinect
41+
3842
=== Requirements
3943

40-
You'll need
44+
For the driver, you'll need
45+
46+
- libusb-1.0 >= 1.0.3 (*nix and OS X)
47+
- libusb-win32 (Windows)
48+
- Cmake >= 2.6 (All platforms)
49+
50+
For the glview sample, you'll need
51+
52+
- OpenGL
53+
- glut
54+
- pthreads (Either platform provided or pthread-win32 for windows)
4155

42-
- libusb-1.0 >= 1.0.3
43-
- Cmake >= 2.6
56+
For links to the software listed, see http://openkinect.org/wiki/Getting_Started#Dependencies
4457

45-
Outside of that, you may also want opengl and other things. See the
46-
platform specifics section for anything needed by your platform to run
47-
examples.
58+
See the platform specifics section for other information specific to
59+
the platform you may be working on.
4860

4961
=== Basic Compiling Instructions
5062

@@ -106,8 +118,9 @@ are not required to run as root.
106118

107119
==== Windows
108120

109-
This library does not work on windows currently. We're trying to get
110-
something going ASAP though. Watch the mailing list for updates.
121+
Windows support is now available in libfreenect. The inf files in the
122+
platform/windows directory can be used for installing the device, and
123+
the library will need libusb-win32 to compile.
111124

112125
==== Wrappers
113126

cmake_modules/FindThreads.cmake

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
# Updated FindThreads.cmake that supports pthread-win32
2+
# Downloaded from http://www.vtk.org/Bug/bug_view_advanced_page.php?bug_id=6399
3+
4+
# - This module determines the thread library of the system.
5+
#
6+
# The following variables are set
7+
# CMAKE_THREAD_LIBS_INIT - the thread library
8+
# CMAKE_USE_SPROC_INIT - are we using sproc?
9+
# CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
10+
# CMAKE_USE_PTHREADS_INIT - are we using pthreads
11+
# CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
12+
#
13+
# If use of pthreads-win32 is desired, the following variables
14+
# can be set.
15+
#
16+
# THREADS_USE_PTHREADS_WIN32 -
17+
# Setting this to true searches for the pthreads-win32
18+
# port (since CMake 2.8.0)
19+
#
20+
# THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME
21+
# C = no exceptions (default)
22+
# (NOTE: This is the default scheme on most POSIX thread
23+
# implementations and what you should probably be using)
24+
# CE = C++ Exception Handling
25+
# SE = Structure Exception Handling (MSVC only)
26+
# (NOTE: Changing this option from the default may affect
27+
# the portability of your application. See pthreads-win32
28+
# documentation for more details.)
29+
#
30+
#======================================================
31+
# Example usage where threading library
32+
# is provided by the system:
33+
#
34+
# find_package(Threads REQUIRED)
35+
# add_executable(foo foo.cc)
36+
# target_link_libraries(foo ${CMAKE_THREAD_LIBS_INIT})
37+
#
38+
# Example usage if pthreads-win32 is desired on Windows
39+
# or a system provided thread library:
40+
#
41+
# set(THREADS_USE_PTHREADS_WIN32 true)
42+
# find_package(Threads REQUIRED)
43+
# include_directories(${THREADS_PTHREADS_INCLUDE_DIR})
44+
#
45+
# add_executable(foo foo.cc)
46+
# target_link_libraries(foo ${CMAKE_THREAD_LIBS_INIT})
47+
#
48+
49+
INCLUDE (CheckIncludeFiles)
50+
INCLUDE (CheckLibraryExists)
51+
SET(Threads_FOUND FALSE)
52+
53+
IF(WIN32 AND NOT CYGWIN AND THREADS_USE_PTHREADS_WIN32)
54+
SET(_Threads_ptwin32 true)
55+
ENDIF()
56+
57+
# Do we have sproc?
58+
IF(CMAKE_SYSTEM MATCHES IRIX)
59+
CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
60+
ENDIF()
61+
62+
IF(CMAKE_HAVE_SPROC_H)
63+
# We have sproc
64+
SET(CMAKE_USE_SPROC_INIT 1)
65+
66+
ELSEIF(_Threads_ptwin32)
67+
68+
IF(NOT DEFINED THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME)
69+
# Assign the default scheme
70+
SET(THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME "C")
71+
ELSE()
72+
# Validate the scheme specified by the user
73+
IF(NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "C" AND
74+
NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "CE" AND
75+
NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE")
76+
MESSAGE(FATAL_ERROR "See documentation for FindPthreads.cmake, only C, CE, and SE modes are allowed")
77+
ENDIF()
78+
IF(NOT MSVC AND THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE")
79+
MESSAGE(FATAL_ERROR "Structured Exception Handling is only allowed for MSVC")
80+
ENDIF(NOT MSVC AND THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE")
81+
ENDIF()
82+
83+
FIND_PATH(THREADS_PTHREADS_INCLUDE_DIR pthread.h)
84+
85+
# Determine the library filename
86+
IF(MSVC)
87+
SET(_Threads_pthreads_libname
88+
pthreadV${THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME}2)
89+
ELSEIF(MINGW)
90+
SET(_Threads_pthreads_libname
91+
pthreadG${THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME}2)
92+
ELSE()
93+
MESSAGE(FATAL_ERROR "This should never happen")
94+
ENDIF()
95+
96+
# Use the include path to help find the library if possible
97+
SET(_Threads_lib_paths "")
98+
IF(THREADS_PTHREADS_INCLUDE_DIR)
99+
GET_FILENAME_COMPONENT(_Threads_root_dir
100+
${THREADS_PTHREADS_INCLUDE_DIR} PATH)
101+
SET(_Threads_lib_paths ${_Threads_root_dir}/lib)
102+
ENDIF()
103+
FIND_LIBRARY(THREADS_PTHREADS_WIN32_LIBRARY
104+
NAMES ${_Threads_pthreads_libname}
105+
PATHS ${_Threads_lib_paths}
106+
DOC "The Portable Threads Library for Win32"
107+
NO_SYSTEM_PATH
108+
)
109+
110+
IF(THREADS_PTHREADS_INCLUDE_DIR AND THREADS_PTHREADS_WIN32_LIBRARY)
111+
MARK_AS_ADVANCED(THREADS_PTHREADS_INCLUDE_DIR)
112+
SET(CMAKE_THREAD_LIBS_INIT ${THREADS_PTHREADS_WIN32_LIBRARY})
113+
SET(CMAKE_HAVE_THREADS_LIBRARY 1)
114+
SET(Threads_FOUND TRUE)
115+
ENDIF()
116+
117+
MARK_AS_ADVANCED(THREADS_PTHREADS_WIN32_LIBRARY)
118+
119+
ELSE()
120+
# Do we have pthreads?
121+
CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)
122+
IF(CMAKE_HAVE_PTHREAD_H)
123+
124+
#
125+
# We have pthread.h
126+
# Let's check for the library now.
127+
#
128+
SET(CMAKE_HAVE_THREADS_LIBRARY)
129+
IF(NOT THREADS_HAVE_PTHREAD_ARG)
130+
131+
# Do we have -lpthreads
132+
CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
133+
IF(CMAKE_HAVE_PTHREADS_CREATE)
134+
SET(CMAKE_THREAD_LIBS_INIT "-lpthreads")
135+
SET(CMAKE_HAVE_THREADS_LIBRARY 1)
136+
SET(Threads_FOUND TRUE)
137+
ENDIF()
138+
139+
# Ok, how about -lpthread
140+
CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
141+
IF(CMAKE_HAVE_PTHREAD_CREATE)
142+
SET(CMAKE_THREAD_LIBS_INIT "-lpthread")
143+
SET(Threads_FOUND TRUE)
144+
SET(CMAKE_HAVE_THREADS_LIBRARY 1)
145+
ENDIF()
146+
147+
IF(CMAKE_SYSTEM MATCHES "SunOS.*")
148+
# On sun also check for -lthread
149+
CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
150+
IF(CMAKE_HAVE_THR_CREATE)
151+
SET(CMAKE_THREAD_LIBS_INIT "-lthread")
152+
SET(CMAKE_HAVE_THREADS_LIBRARY 1)
153+
SET(Threads_FOUND TRUE)
154+
ENDIF()
155+
ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
156+
157+
ENDIF(NOT THREADS_HAVE_PTHREAD_ARG)
158+
159+
IF(NOT CMAKE_HAVE_THREADS_LIBRARY)
160+
# If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
161+
IF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
162+
MESSAGE(STATUS "Check if compiler accepts -pthread")
163+
TRY_RUN(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
164+
${CMAKE_BINARY_DIR}
165+
${CMAKE_ROOT}/Modules/CheckForPthreads.c
166+
CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
167+
COMPILE_OUTPUT_VARIABLE OUTPUT)
168+
169+
IF(THREADS_HAVE_PTHREAD_ARG)
170+
IF(THREADS_PTHREAD_ARG MATCHES "^2$")
171+
SET(Threads_FOUND TRUE)
172+
MESSAGE(STATUS "Check if compiler accepts -pthread - yes")
173+
ELSE()
174+
MESSAGE(STATUS "Check if compiler accepts -pthread - no")
175+
FILE(APPEND
176+
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
177+
"Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n")
178+
ENDIF()
179+
ELSE()
180+
MESSAGE(STATUS "Check if compiler accepts -pthread - no")
181+
FILE(APPEND
182+
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
183+
"Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n")
184+
ENDIF()
185+
186+
ENDIF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
187+
188+
IF(THREADS_HAVE_PTHREAD_ARG)
189+
SET(Threads_FOUND TRUE)
190+
SET(CMAKE_THREAD_LIBS_INIT "-pthread")
191+
ENDIF()
192+
193+
ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY)
194+
ENDIF(CMAKE_HAVE_PTHREAD_H)
195+
ENDIF()
196+
197+
IF(CMAKE_THREAD_LIBS_INIT)
198+
SET(CMAKE_USE_PTHREADS_INIT 1)
199+
SET(Threads_FOUND TRUE)
200+
ENDIF()
201+
202+
IF(CMAKE_SYSTEM MATCHES "Windows"
203+
AND NOT THREADS_USE_PTHREADS_WIN32)
204+
SET(CMAKE_USE_WIN32_THREADS_INIT 1)
205+
SET(Threads_FOUND TRUE)
206+
ENDIF()
207+
208+
IF(CMAKE_USE_PTHREADS_INIT)
209+
IF(CMAKE_SYSTEM MATCHES "HP-UX-*")
210+
# Use libcma if it exists and can be used. It provides more
211+
# symbols than the plain pthread library. CMA threads
212+
# have actually been deprecated:
213+
# http://docs.hp.com/en/B3920-90091/ch12s03.html#d0e11395
214+
# http://docs.hp.com/en/947/d8.html
215+
# but we need to maintain compatibility here.
216+
# The CMAKE_HP_PTHREADS setting actually indicates whether CMA threads
217+
# are available.
218+
CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA)
219+
IF(CMAKE_HAVE_HP_CMA)
220+
SET(CMAKE_THREAD_LIBS_INIT "-lcma")
221+
SET(CMAKE_HP_PTHREADS_INIT 1)
222+
SET(Threads_FOUND TRUE)
223+
ENDIF(CMAKE_HAVE_HP_CMA)
224+
SET(CMAKE_USE_PTHREADS_INIT 1)
225+
ENDIF()
226+
227+
IF(CMAKE_SYSTEM MATCHES "OSF1-V*")
228+
SET(CMAKE_USE_PTHREADS_INIT 0)
229+
SET(CMAKE_THREAD_LIBS_INIT )
230+
ENDIF()
231+
232+
IF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*")
233+
SET(CMAKE_USE_PTHREADS_INIT 1)
234+
SET(Threads_FOUND TRUE)
235+
SET(CMAKE_THREAD_LIBS_INIT )
236+
SET(CMAKE_USE_WIN32_THREADS_INIT 0)
237+
ENDIF()
238+
ENDIF(CMAKE_USE_PTHREADS_INIT)
239+
240+
INCLUDE(FindPackageHandleStandardArgs)
241+
IF(_Threads_ptwin32)
242+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG
243+
THREADS_PTHREADS_WIN32_LIBRARY THREADS_PTHREADS_INCLUDE_DIR)
244+
ELSE()
245+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)
246+
ENDIF()

0 commit comments

Comments
 (0)