jkuhlmann / gainput

Cross-platform C++ input library supporting gamepads, keyboard, mouse, touch
http://gainput.johanneskuhlmann.de/
MIT License
858 stars 104 forks source link

Trouble building in Visual Studio 2015 for Xbox UWP x64 cocos2d-x app #34

Open mstorch opened 7 years ago

mstorch commented 7 years ago

Decided to give gainput a try after researching controller libraries that could be used with Cocos2d-x, based on some discussions and recommendations on their forums. However, I've been having some problems deploying anything to the Xbox with gainput added.

Basically, I have a cocos2d-x 3.15 Visual Studio solution for our game and I used cmake to generate the VS 2015 x64 gainput solution using the command cmake -G "Visual Studio 14 2015 Win64". I then added the "gainput" project to our cocos2d-x VS solution and set it as a build dependency.

I also needed to add the gainput\lib\include folder to "Additional Include Directories" and for the Linker, added gainput-d.lib to "Additional Dependencies" and added the lib\Debug output directory to "Additional Library Directories".

I now get source-code completion, and the sample gainput code from the basic example builds and everything links. However, when deploying to the Xbox, I get the error message "A dependent dll was not found.

I thought this was because in the AppX folder, the gainput-d.dll file was missing, however copying it there and re-deploying was unsuccessful. I used the Dependency Walker tool and it seems gaininput-d.dll needs kernel32.dll, user32.dll, xinput9_1_0.dll, ws2_32.dll, vcruntime140D.dll, and ucrtbased.dll.

This seemed strange because these look like win32 specific dependencies so I checked the preprocesser build flags for the "gainput" project and sure enough, they included WIN32 and _WINDOWS, which I don't think should be there for x64 builds.

Sorry for the long write-up but wanted to be detailed on exactly what was going on. Do you know of anyone who has been able to use your library for Xbox UWP x64 apps, or even Windows 10 UWP x64 apps? Building/running the samples worked fine for me, but those are simply win32 desktop builds, so it's not a fair comparison. I could very well be running an incorrect build configuration.

I'd like to try using the library on the Xbox for our game, any help on this would be greatly appreciated.

Thanks! Mark

mstorch commented 7 years ago

I believe the following cmake command is what should be used to generate the UWP x64 solution.

CMake -G "Visual Studio 15 2017 Win64" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_GENERATOR_TOOLSET=v141,host=x64 ..

However when opening the resulting solution in Visual Studio 2017 and attempting to build the "basicsample" project or even just "gainput" results in hundreds of unknown identifier errors.

If gainput simply doesn't support what I'm trying to do then that's totally ok, I just wanted to give your library a chance. If so, I can move onto SDL for the time being until some cycles can be freed up to look into this.

@jkuhlmann would it be possible to get a quick heads up so I know whether or not to wait? Thanks a lot!! :)