Electronicks / JoyShockMapper

A tool for PC gamers to play games with DualShock 4s, JoyCons, and Pro Controllers. Gyro aiming, flick stick.
Other
343 stars 20 forks source link

CMake fixes for Linux building #41

Closed TauAkiou closed 2 years ago

TauAkiou commented 2 years ago

This pull request fixes a few CMake build problems on Linux and eliminates some confusion by changing build behavior.

First, I looked into why HIDAPI wasn't being set, and isolated it to a compatibility with older JSM versions (https://cmake.org/cmake/help/latest/policy/CMP0077.html).Since JSM is mostly being run with modern Linux and CMake versions, this should not affect many people. I have set CMake by default to use New style variable behavior, which should not affect Windows.

Second, SDL is now the default input handler for Linux. Most if not all Linux users are bound to have it installed anyway, and JSL is currently broken under Linux anyway. CMake will now automatically use SDL if -DSDL is undefined or set to 1.

Third, I have cleaned up readme.md and added Arch packages.

These changes should allow JSM to build cleanly under Linux with less confusion and fewer strange issues although clang++ will still be required.

Electronicks commented 2 years ago

Ok, cool. I'll pull into my integration branch, called next. Thanks!

gardotd426 commented 2 years ago

Still fails to build here on Arch Linux, using the next branch, with a bunch of undefined reference stuff seemingly related to sdl2 and wayland.

[ 48%] Linking C shared library libSDL2-2.0.so
/usr/bin/ld: CMakeFiles/SDL2.dir/src/video/wayland/SDL_waylanddatamanager.c.o: in function `wl_data_offer_receive':
SDL_waylanddatamanager.c:(.text+0x54): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: CMakeFiles/SDL2.dir/src/video/wayland/SDL_waylanddatamanager.c.o: in function `wl_data_offer_destroy':
SDL_waylanddatamanager.c:(.text+0x9f): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: CMakeFiles/SDL2.dir/src/video/wayland/SDL_waylanddatamanager.c.o: in function `wl_data_source_offer':
SDL_waylanddatamanager.c:(.text+0xf1): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: CMakeFiles/SDL2.dir/src/video/wayland/SDL_waylanddatamanager.c.o: in function `wl_data_source_destroy':
SDL_waylanddatamanager.c:(.text+0x138): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: CMakeFiles/SDL2.dir/src/video/wayland/SDL_waylanddatamanager.c.o: in function `wl_data_device_set_selection':
SDL_waylanddatamanager.c:(.text+0x193): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: CMakeFiles/SDL2.dir/src/video/wayland/SDL_waylandevents.c.o:SDL_waylandevents.c:(.text+0xab): more undefined references to `wl_proxy_marshal_flags' follow
collect2: error: ld returned 1 exit status
make[2]: *** [_deps/sdl2-build/CMakeFiles/SDL2.dir/build.make:3449: _deps/sdl2-build/libSDL2-2.0.so.0.18.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:226: _deps/sdl2-build/CMakeFiles/SDL2.dir/all] Error 2
make: *** [Makefile:136: all] Error 2