Skip to content

Commit

Permalink
Fixed building on Mac OS X on the command line and with an older macO…
Browse files Browse the repository at this point in the history
…S SDK
  • Loading branch information
slouken committed Nov 21, 2020
1 parent 1df593f commit fd89446
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 86 deletions.
164 changes: 82 additions & 82 deletions Xcode/SDL/SDL.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions configure
Expand Up @@ -25394,7 +25394,12 @@ $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h

$as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h


$as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h

SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
have_joystick=yes
fi
# Set up files for the haptic library
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Expand Up @@ -4053,7 +4053,10 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
# Set up files for the joystick library
if test x$enable_joystick = xyes; then
AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
have_joystick=yes
fi
# Set up files for the haptic library
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config.h.in
Expand Up @@ -289,6 +289,7 @@
#undef SDL_JOYSTICK_XINPUT
#undef SDL_JOYSTICK_DUMMY
#undef SDL_JOYSTICK_IOKIT
#undef SDL_JOYSTICK_MFI
#undef SDL_JOYSTICK_LINUX
#undef SDL_JOYSTICK_ANDROID
#undef SDL_JOYSTICK_WINMM
Expand Down
2 changes: 1 addition & 1 deletion src/haptic/darwin/SDL_syshaptic.c
Expand Up @@ -28,7 +28,7 @@
#include "../SDL_syshaptic.h"
#include "SDL_joystick.h"
#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
#include "../../joystick/darwin/SDL_sysjoystick_c.h" /* For joystick hwdata */
#include "../../joystick/darwin/SDL_iokitjoystick_c.h" /* For joystick hwdata */
#include "SDL_syshaptic_c.h"

#include <IOKit/IOKitLib.h>
Expand Down
Expand Up @@ -26,7 +26,7 @@
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
#include "SDL_sysjoystick_c.h"
#include "SDL_iokitjoystick_c.h"
#include "../hidapi/SDL_hidapijoystick_c.h"
#include "../../haptic/darwin/SDL_syshaptic_c.h" /* For haptic hot plugging */

Expand Down
File renamed without changes.
Expand Up @@ -21,7 +21,7 @@
#include "../../SDL_internal.h"

/* This is the iOS implementation of the SDL joystick API */
#include "SDL_sysjoystick_c.h"
#include "SDL_mfijoystick_c.h"

#if !TARGET_OS_OSX
/* needed for SDL_IPHONE_MAX_GFORCE macro */
Expand All @@ -46,6 +46,10 @@
#import <CoreMotion/CoreMotion.h>
#endif

#if TARGET_OS_OSX
#include <IOKit/hid/IOHIDManager.h>
#endif

#ifdef SDL_JOYSTICK_MFI
#import <GameController/GameController.h>

Expand All @@ -58,6 +62,11 @@
/* remove compilation warnings for strict builds by defining these selectors, even though
* they are only ever used indirectly through objc_msgSend
*/
@interface GCController (SDL)
#if TARGET_OS_OSX && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 101600)
+ (BOOL)supportsHIDDevice:(IOHIDDeviceRef)device;
#endif
@end
@interface GCExtendedGamepad (SDL)
#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 121000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 121000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1401000))
@property (nonatomic, readonly, nullable) GCControllerButtonInput *leftThumbstickButton;
Expand Down Expand Up @@ -1359,7 +1368,7 @@ -(void)cleanup
SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
{
if (@available(macOS 11.0, *)) {
return [GCController supportsHIDDevice:device] ? SDL_TRUE: SDL_FALSE;
return [GCController supportsHIDDevice:device] ? SDL_TRUE : SDL_FALSE;
} else {
return SDL_FALSE;
}
Expand Down
File renamed without changes.

0 comments on commit fd89446

Please sign in to comment.