inspirit / PS3EYEDriver

PS3EYE Camera Driver for OSX and Windows
Other
316 stars 92 forks source link

Add build files for Visual Studio 2013 #38

Closed mbehensky closed 8 years ago

mbehensky commented 8 years ago

Hi,

I just discovered the PS3Eye camera, and found your excellent open source driver. I am working on a virtual/augmented reality application, and the PS3Eye is perfect since you can get it to work at very high speeds (and it doesn't cost $1000).

It took me a day or so to figure out how to set up a build environment for Visual Studio 2013 (that's the version I need for my project right now), and I wanted to contribute that work back to the project.

Almost all the changes I made are in a new directory (VS2013). I had to change the constructor for the USBMgr class to move the initializers for exit_signaled and active_camera_count into the body of the function, since MSVC barfed at initializing them in an initializer.

I also added MSVC specific #ifdefs to turn off warnings for zero length structures before libusb.h is included. These warnings were annoying and I couldn't get it to work to ignore them in the Visual Studio build environment.

I don't think any of these changes will break the build for MinGW or linux, but I haven't tried building on those environments.

I added step by step instructions (tested on a somewhat clean machine) for how to set up the build environment, and have successfully built and run 32 an 64 bit versions of the SDL example under both Windows 7 and Windows 10.

Max Behensky

cboulay commented 8 years ago

Did cmake not work for you? I'm pretty sure I built this in MSVC 2013 before.

cboulay commented 8 years ago

Sorry, I just remembered that this project doesn't have cmake files. But I've certainly built the library in MSVC 2013 and 2015 before as a dependency for other projects.

If I get a vote then I would prefer not to have VS project files in the repository. They're difficult to maintain, and there are a bunch of different versions of VS so which project files do we keep? I'd be happy to see cmake files though if the make files don't work with windows command line build tools.

mbehensky commented 8 years ago

Hi, all.

There was absolutely no information that I could find on building this for Visual Studio. It took me about 6 hours to figure all of this out from scratch. It was unclear until I saw the image on the screen that it would even work, and I almost went with that closed source commercial driver instead.

I understand (and somewhat share) your misgivings about having visual studio project files as part of the repository. However SDL (for example) has visual studio files as part of its distribution, and that means it takes about 5 minutes to build and install it, even if you've never used it before.

As for maintenance, there are only 5 source files needed here. Maintaining the build files shouldn't be much of a task, and if they get out of date it isn't too hard for a user to fix. If you've got nothing to start from it is much more difficult. You don't know what dependencies you need, and what versions will work for one thing. It is also non-trivial to set up the build files with the appropriate includes and libraries for each configuration.

Visual studio is pretty good about upgrading your project to later versions, so if you have VS2013 build files they will probably just work for later versions. SDL seems to have VS2010 or something files that automatically upgrade to VS2013 or whatever you've got.

Obviously, cmake is a solution to all of this, but that is a maintenance headache of its own. I've also never written a set of cmake files, and don't have the time to learn how right now.

I fully understand if the maintainers don't want to accept my pull request. The driver is excellent, and I just wanted to help out other Windows users who might not even know that they could use this driver with Visual Studio on Windows.

If they don't want to include the VS2013 directory stuff, I could just edit the README.msvc file to tell users how to set up the build files themselves. I also think that the changes I made to ps3eye.cpp are worthwhile; they should be innocuous and the driver won't compile without them on VS2013, at least.

inspirit commented 8 years ago

i agree that having readme for MSVC is the way to go. please make a pull with instructions only. thank you.

mbehensky commented 8 years ago

Creating a new pull request with instructions and source patches only for MSVC