title: How should binding.gyp be written to build a Node.js addon with OpenNI?
body: <p>I'm trying to build a Node.js addon that makes use of OpenNI. I haven't used Node-gyp before so I'm trying to set up the binding.gyp file so that it includes the OpenNI library as part of the build. The code I'm actually compiling is just the <a href="http://nodejs.org/api/addons.html#addons_hello_world" rel="nofollow">Hello World example</a>.</p>
  
  <p>The binding.gyp file I'm using is based on the one from <a href="https://github.com/bengfarrell/nuimotion/blob/master/binding.gyp" rel="nofollow">NUIMotion</a> on Github, which is doing something similar. Here's mine:</p>
  
  <pre><code>{
      "targets": [
      {
          "target_name": "onijs",
          "sources": [
              "src/main.cpp" ],
          "include_dirs": [ "./src/Include" ],
  
          "libraries": [ "-lOpenNI2", "-Wl,-rpath ./" ]
      }
    ]
  }
  </code></pre>
  
  <p>Here's what I've done (working in OSX):</p>
  
  <ul>
  <li>Created a node project folder called <code>onijs/</code></li>
  <li>Downloaded and extracted OpenNI</li>
  <li>Copied the contents of the <code>Redist</code> directory into <code>onijs/</code> (<code>Redist</code> has a directory <code>OpenNI2</code> so now I have <code>onijs/OpenNI2</code> with some drivers in it).</li>
  <li>Copied the <code>Includes</code> folder into <code>onijs/src/</code></li>
  <li>Copied the basic "Hello World" into <code>onijs/src/main.cpp</code></li>
  <li>Placed my <code>binding.gyp</code> file in <code>onijs/</code></li>
  <li>In a terminal I did <code>cd /pathTo/onijs/</code> and ran <code>node-gyp configure</code>, which worked fine</li>
  <li>Then I ran <code>node-gyp build</code>, and it barfed.</li>
  </ul>
  
  <p>The error is <em>"ld: library not found for -lOpenNI2."</em></p>
  
  <p>Am I taking the wrong approach here? I have tried it without the <code>-l</code> and <code>-Wl, -rpath ./</code> in the libraries declaration but it still doesn't build.</p>