Difference between revisions of "Getting Started Windows"
m (2 links i.e. source in "driver installation")
m (Header : "Building libfreenect from Source" - sorry the many edits!)
|Line 1:||Line 1:|
== Building from Source ==
=== Getting the source files ===
=== Getting the source files ===
Revision as of 11:59, 4 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).
- Use Git to create and keep an up to date project folder and access any branch locally:
- 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
- "git branch" 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
$ 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...
Download these files and extract them somewhere; you will need them to configure the source for compiling:
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.
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 and compiling
Now that the driver is installed, follow these steps to configure and build libfreenect:
Step 1: Download CMAKE (Cross-Platform Make) and make sure you have a working C compiler (like Visual Studio 2010 or MinGW)
Step 2: Make sure you downloaded the master branch and all the dependencies. (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.)
Step 3: Run CMake-gui and select your libfreenect source directory as the source (where /src, /examples, etc. are children, and which contains the first CMakeLists.txt)
Step 4: Click the configure button, select your C complier and let it run. It will point out several mistakes that 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 others such as FAKENECT have not been updated for Visual Studio yet. Checking 'Advanced' and 'Grouped' in cmake-gui helps!)
Step 5: Continue the configure process and generate files (CMake-> configure, CMake-> generate). When errors show up as you click configure, supply the proper paths to the folders of the dependencies. 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 advanced checkbox to access some variables.
Step 6: After you have successfully generated the projects, open libfreenect.sln in Visual Studio and build the project.