JibbSmart / JoyShockLibrary

Read DualSense, DualShock 4, JoyCon, and Pro Controller input on PC -- compiled for Windows, but code should work on other platforms.
Other
226 stars 42 forks source link

OSX compilation (generating Xcode with cmake) #29

Closed benkuper closed 3 years ago

benkuper commented 3 years ago

Hello, thank you for this super library ! I've integrated it in Chataigne : http://benjamin.kuperberg.fr/chataigne Right now only for Windows of course, but I'm trying to get the compilation working under OSX and linux (and I'll be able to push PR's to your repo with the generated projects and binaries)

First problem I encounter is this :

CMake Error at JoyShockLibrary/CMakeLists.txt:1 (add_library):
  Target "JoyShockLibrary" links to target "JSL_Platform::Dependencies" but
  the target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

I'm not a CMake expert, does this ring a bell to you ? I couldn't find submodules on the repo, nor other repos that would link to that.

JibbSmart commented 3 years ago

Hi! Chataigne looks like a cool project. Thanks for including JSL!

I'm afraid I know very little about CMake. I know in principle it's useful for platform- and compiler- agnostic project setup and building, but I didn't set this up myself. @kicsyromy did in order to fix some Linux issues.

benkuper commented 3 years ago

Hi ! Thanks for the reply :) I actually managed to compile on Mac and Linux, for those who want to do it, I copied the Windows makefile and commented out windows related lines. Then in Xcode, I forced the C++ compiler to use C++ 17 and OSX Deployment target 10.12 (because of the use of share_timed_mutex) On Linux, I had to install some dependencies (libhid related) and I needed to change the #include "hidapi.h" to "hidapi/hidapi.h" (there is some include line to add to the cmake I guess)

I pushed my modifications (except the #include change, because it works on Windows and Mac) : https://github.com/benkuper/JoyShockLibrary

Also you can find the compiled binaries for all platforms here, in case you want to add that to the release : https://github.com/benkuper/Chataigne/tree/master/External/joycon/lib

Saraistupid commented 1 year ago

Hello! I just compiled your repo and I got a .a file, how do i compile it as .dylib to use under Unity and such?