hh79 / gzdoomvr

Classic Doom/Heretic/Hexen games in stereo 3D and VR; modified version of gzdoom.
GNU General Public License v3.0
125 stars 10 forks source link

Win32 only code breaks Linux compilation #36

Closed dikonov closed 3 years ago

dikonov commented 3 years ago

The file _gzdoomvr-openvr_controller/src/rendering/gl/stereo3d/glopenvr.cpp contains reference to two functions I_StartupOpenVR() and I_OpenVRGetYaw(), which are provided by a win32 only part of the source

make[2]: Leaving directory '/home/slava/RPM/BUILD/gzdoomvr-openvr_controller/BUILD'
make[2]: Entering directory '/home/slava/RPM/BUILD/gzdoomvr-openvr_controller/BUILD'
[100%] Linking CXX executable ../gzdoom
/usr/bin/ld.default: CMakeFiles/zdoom.dir/rendering/gl/stereo3d/gl_openvr.cpp.o: in function `s3d::OpenVRMode::SetUp() const':
/home/slava/RPM/BUILD/gzdoomvr-openvr_controller/src/rendering/gl/stereo3d/gl_openvr.cpp:1462: undefined reference to `I_StartupOpenVR()'
/usr/bin/ld.default: /home/slava/RPM/BUILD/gzdoomvr-openvr_controller/src/rendering/gl/stereo3d/gl_openvr.cpp:1471: undefined reference to `I_OpenVRGetYaw()'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/zdoom.dir/build.make:7084: gzdoom] Error 1
make[2]: Leaving directory '/home/slava/RPM/BUILD/gzdoomvr-openvr_controller/BUILD'
make[1]: *** [CMakeFiles/Makefile2:1005: src/CMakeFiles/zdoom.dir/all] Error 2
make: *** [Makefile:171: all] Error 2

Deleting these with gzdoomvr-delwin32refs.patch.txt allows to complete compilation. I am not sure yet, if the binaries remain functional after this. Please, fix!

hh79 commented 3 years ago

This method is needed for controllers to work, at least in Windows. I cannot help with Linux build, sorry.

dikonov commented 3 years ago

The code cannot be compiled while linux build references win32-only methods. They must be removed or placed under some ifdef. I have no idea what these two lines of code do and why controller support is linked to windows (I do not know C or C+). VR controllers work in Linux through native OpenVR-SteamVR or OpenXR without any windows libs. I cannot test functionality of VR controllers yet (my VR rig is incomplete right now). It is possible that I_StartupOpenVR() and I_OpenVRGetYaw() are improperly tagged win32-only, if they are part of OpenVR.

Gamepads in Linux certainly do not need the I_StartupOpenVR() and I_OpenVRGetYaw(), because they can perfectly emulate keyboard+mouse combo with qjoypad or antimicro, which always works.