We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5224

Summary: [PATCH] cmake: Fix building on Windows with -DSDL_HAPTIC=Off
Product: SDL Reporter: Dom <stfx>
Component: buildAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: HG 2.0   
Hardware: x86_64   
OS: Windows 10   
Attachments: Patch

Description Dom 2020-07-08 15:40:36 UTC
Created attachment 4405 [details]
Patch

Similar to Bug 5193 building on Windows with CMake with -DSDL_HAPTIC=Off fails with the following errors:

C requires that a struct or union have at least one member: SDL_windowshaptic_c.h:62

unresolved external symbol _SDL_NumHaptics_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticName_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticOpen_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticOpened_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticIndex_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_MouseIsHaptic_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticOpenFromMouse_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_JoystickIsHaptic_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticOpenFromJoystick_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticClose_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticNumEffects_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticNumEffectsPlaying_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticQuery_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticNumAxes_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticEffectSupported_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticNewEffect_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticUpdateEffect_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticRunEffect_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticStopEffect_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticDestroyEffect_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticGetEffectStatus_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticSetGain_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticSetAutocenter_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticPause_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticUnpause_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticStopAll_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticRumbleSupported_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticRumbleInit_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticRumblePlay_REAL referenced in function _initialize_jumptable
unresolved external symbol _SDL_HapticRumbleStop_REAL referenced in function _initialize_jumptable

unresolved external symbol _SDL_DINPUT_MaybeAddDevice referenced in function _SDL_JoystickThread
unresolved external symbol _SDL_DINPUT_MaybeRemoveDevice referenced in function _SDL_JoystickThread
unresolved external symbol _SDL_XINPUT_MaybeAddDevice referenced in function _SDL_JoystickThread
unresolved external symbol _SDL_XINPUT_MaybeRemoveDevice referenced in function _SDL_JoystickThread

The attached patch fixes it similar to https://hg.libsdl.org/SDL/rev/f1a59a78dcec and https://hg.libsdl.org/SDL/rev/2fabbbee604c

However I am not sure if the fix for MaybeAddDevice/MaybeRemoveDevice is correct. Also this probably needs to be fixed on Linux too.
Comment 1 Ryan C. Gordon 2020-07-08 17:35:23 UTC
This patch is now https://hg.libsdl.org/SDL/rev/b8c8ce11efc7, thanks!

--ryan.
Comment 2 Ryan C. Gordon 2020-07-08 17:40:42 UTC
(In reply to Dom from comment #0)
> Also this probably needs to be fixed on Linux too.

Just tested on Linux; it appears to link corrected with -DSDL_HAPTIC=Off with this patch.

--ryan.