Notice: MediaWiki has been updated. Report any rough edges to marcan@marcan.st

Difference between revisions of "Getting Started Windows"

From OpenKinect
Jump to: navigation, search
(Dependencies section upgrade (install vs linking with cmake and more info),simplification of the cmake steps, sample cmake configuration printscrn - thanks J.), etc. hope this will help less xp users.)
m (Link)
Line 93: Line 93:
 
#  Launch Cmake-gui and select your libfreenect source folder (where you see /src, /examples etc.) as source, specify an output folder for the makefiles then click on the "Configure" button. ('''NOTE:''': if you plan on changing libfreenect, writing wrappers, or trying the latest developments you might want to download the unstable branch instead. Unstable has the latest commits that have not been fully tested yet.)
 
#  Launch Cmake-gui and select your libfreenect source folder (where you see /src, /examples etc.) as source, specify an output folder for the makefiles then click on the "Configure" button. ('''NOTE:''': if you plan on changing libfreenect, writing wrappers, or trying the latest developments you might want to download the unstable branch instead. Unstable has the latest commits that have not been fully tested yet.)
 
# Select your C compiler and continue. Several mistakes will be presented as red in the CMake Gui. You must correct these problems. For the libfreenect header you must point at c/include, for USB header c/dependencies/include and so on...('''NOTE:''' For now only select the EXAMPLES and C_SYNC build options. The other build options such as FAKENECT have not been updated for Visual Studio yet. )
 
# Select your C compiler and continue. Several mistakes will be presented as red in the CMake Gui. You must correct these problems. For the libfreenect header you must point at c/include, for USB header c/dependencies/include and so on...('''NOTE:''' For now only select the EXAMPLES and C_SYNC build options. The other build options such as FAKENECT have not been updated for Visual Studio yet. )
# Continue the configure process and when errors show up as you click configure, supply the proper paths to the dependencies you have previously downloaded, as we have [http://openkinect.org/wiki/Getting_Started_Windows#Configuring_with_cmake-gui discussed]. The *_LIBRARY variables need to point to actual .lib files not a folder. INCLUDE variables need to point to the appropriate include directories. You might need to check the "grouped" and "advanced" checkboxes to facilitate the display and to access some variables.  
+
# Continue the configure process and when errors show up as you click configure, supply the proper paths to the dependencies you have previously downloaded, as we have [http://openkinect.org/wiki/Getting_Started_Windows#Dependencies discussed]. The *_LIBRARY variables need to point to actual .lib files not a folder. INCLUDE variables need to point to the appropriate include directories. You might need to check the "grouped" and "advanced" checkboxes to facilitate the display and to access some variables.  
  
 
* Take a look at this sample cmake configuration for MS Visual Studio 2010:
 
* Take a look at this sample cmake configuration for MS Visual Studio 2010:

Revision as of 10:55, 5 January 2011

Building libfreenect from Source

Getting the source files

There are 2 ways to get the latest source:

  • Go to the OpenKinect project github, select the branch you want (master or unstable for instance) and click the "Download" button (then extract the files to a convenient location).

or

  • Use Git to create and keep an up to date project folder and access any branch locally:

Using Git

  • Download and install Git with these settings:
    • Accept the license etc.
    • Choose the level of shell integration you want
    • Choose "Run git from the Windows Command prompt"
    • Choose "Check out WIndows style, commits Unix-style line endings"
  • Open a Command Prompt, cd to the directory where you want the source folder (libfreenect) created and type:
$ git clone https://github.com/OpenKinect/libfreenect.git
  • Then cd to the libfreenect folder. This is the up to date master branch of the project and you can configure it and build it at this point. You could also create a local branch for the remote unstable branch (or any other existing branch) so that you can conveniently check it out later:
$ git branch --track unstable origin/unstable   
  • The "git branch" command will show you the different branches (here master and unstable) and which one is currently selected. You can also view the development logs for the branch you're checking out with the "git log" command (use shift-Q to exit the log).
  • From now on, you can just cd to the libfreenect folder, and select the branch you want to checkout:
$ git checkout master

or

$ git checkout unstable
  • Also make sure the files are the latest:
$ git pull
  • The contents of the libfreenect folder will interactively change as you checkout a specific branch (magic!) so you don't need to search for a specific "branch" folder inside the libfreenect directory. Just checkout the branch you want to configure and proceed using the libfreenect folder as source.

After you have the source files, you should download the dependencies required to configure and build the library and then install the hardware driver...

Dependencies

For each dependency we will first install the libraries (.dll) on your system and then identify the libraries (.lib or .a) and header (.h) files required later on to configure the source project with cmake:

Dependency Install Library/includes to be used with cmake
libusb-win32 - download and extract the latest libusb-win32-bin-x.x.x.x.zip Find the /bin folder and use the inf-wizard program which will prepare then install the required files to /windows/system32 The /lib and /include folders contain the libraries and header files required to configure the project; depending on the compiler you choose, you may have to specify a different library file:
  • For instance, to configure for MS Visual Studio 2010, you would use /lib/msvc/libusb.lib whereas if we plan to use mingw, you would use /lib/gcc/libusb.a

For more info see the libusb-win32 readme and their wiki

pthreads-win32 - download and extract the latest pthreads-w32-x-x-x-release.exe Find the /lib folder and copy the appropriate library to /windows/system The /lib and /include contain the libraries and header files required to configure the project; depending on the compiler you choose, you may have to specify a different library file:
  • For instance, to configure for MS Visual Studio 2010, you would use /lib/pthreadVC2.lib whereas if we plan to use mingw, you would use /lib/pthreadGC2.a. In both cases you will need to install the corresponding library .dll file to /windows/system i.e. phtreadVC2.dll or pthreadGC2.dll

For more info see the pthreads-win32 readme and their FAQ

Glut - download and extract the latest glut-x.x.x-bin.zip Find the glut32.dll file and copy it to /windows/system The path to the glut folder will be used for library and header files when configuring the project. If you built glut from source and installed then it may be automatically configured in cmake.

For more info see the glut readme

Driver installation

There are two parts to libfreenect -- the low-level libusb-based device driver and libfreenect itself, the library that talks to the driver. You only need to install the driver once.

General instructions

Plug in your Kinect. The Xbox NUI Motor loads first. Cancel any dialog that searches for drivers and open the Windows Device Manager. Find the Motor device, right click it, and select "update device drivers" and manually browse to /platform/windows/inf inside your libfreenect source folder. After the Motor is installed, the Xbox NUI Camera and Xbox NUI Audio will connect and you can repeat the same thing for those drivers.

Windows 7: step-by-step walkthrough

  • Plug in your Kinect. Windows will warn that no device driver was found for the plugged device (the LED of Kinect will not turn on). If Windows presents a dialog asking to search for drivers, simply cancel it.
  • Open the Device Manager: Start >> Control Panel >> System and Security >> System >> Device Manager
  • A device called "Xbox NUI Motor" should be somewhere there (most probably be under "Other devices") with a small yellow warning symbol "!" on top of its icon. Right click on it, and select "Update Driver Software...", then click on "Browse my computer for driver software".
  • "Browse" and select the folder where the "XBox_NUI_Motor.inf" is located (/platform/windows/inf inside your libfreenect source folder). Click "Next" and if warned by Windows that a non-certified driver is about to be installed, just order it to install it anyway.
  • After that, the Kinect LED should start blinking green. Now there will be two additional devices in the Device Manager list: "Xbox NUI Camera" and "Xbox NUI Audio". Repeat the above instructions for them as well.

You are now ready to build libfreenect and start developing your own software in Windows with Kinect!

Configuring with cmake-gui

Follow these steps to configure libfreenect:

  1. Download Cmake (Cross-Platform Make) and make sure you have a working C compiler (like Visual Studio 2010 or MinGW)
  2. Launch Cmake-gui and select your libfreenect source folder (where you see /src, /examples etc.) as source, specify an output folder for the makefiles then click on the "Configure" button. (NOTE:: if you plan on changing libfreenect, writing wrappers, or trying the latest developments you might want to download the unstable branch instead. Unstable has the latest commits that have not been fully tested yet.)
  3. Select your C compiler and continue. Several mistakes will be presented as red in the CMake Gui. You must correct these problems. For the libfreenect header you must point at c/include, for USB header c/dependencies/include and so on...(NOTE: For now only select the EXAMPLES and C_SYNC build options. The other build options such as FAKENECT have not been updated for Visual Studio yet. )
  4. Continue the configure process and when errors show up as you click configure, supply the proper paths to the dependencies you have previously downloaded, as we have discussed. The *_LIBRARY variables need to point to actual .lib files not a folder. INCLUDE variables need to point to the appropriate include directories. You might need to check the "grouped" and "advanced" checkboxes to facilitate the display and to access some variables.
  • Take a look at this sample cmake configuration for MS Visual Studio 2010:

1 2 3

Compiling

After you have successfully generated the projects with cmake, open libfreenect.sln from your output folder and build it using Visual Studio.