Skip to content

Commit 89eef1b

Browse files
committed
cmake: Android always needs a native HIDAPI implementation
1 parent 279dabf commit 89eef1b

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,9 +1358,7 @@ if(ANDROID)
13581358
set(HAVE_SDL_HAPTIC TRUE)
13591359
endif()
13601360

1361-
if(SDL_HIDAPI)
1362-
CheckHIDAPI()
1363-
endif()
1361+
CheckHIDAPI()
13641362

13651363
if(SDL_JOYSTICK)
13661364
set(SDL_JOYSTICK_ANDROID 1)

cmake/sdlchecks.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,14 @@ endmacro()
11081108

11091109
# Check for HIDAPI support
11101110
macro(CheckHIDAPI)
1111+
if(ANDROID)
1112+
enable_language(CXX)
1113+
sdl_sources("${SDL3_SOURCE_DIR}/src/hidapi/android/hid.cpp")
1114+
endif()
1115+
if(IOS OR TVOS)
1116+
sdl_sources("${SDL3_SOURCE_DIR}/src/hidapi/ios/hid.m")
1117+
set(SDL_FRAMEWORK_COREBLUETOOTH 1)
1118+
endif()
11111119
if(SDL_HIDAPI)
11121120
set(HAVE_HIDAPI ON)
11131121
if(SDL_HIDAPI_LIBUSB)
@@ -1140,14 +1148,6 @@ macro(CheckHIDAPI)
11401148
endif()
11411149

11421150
if(HAVE_HIDAPI)
1143-
if(ANDROID)
1144-
enable_language(CXX)
1145-
sdl_sources("${SDL3_SOURCE_DIR}/src/hidapi/android/hid.cpp")
1146-
endif()
1147-
if(IOS OR TVOS)
1148-
sdl_sources("${SDL3_SOURCE_DIR}/src/hidapi/ios/hid.m")
1149-
set(SDL_FRAMEWORK_COREBLUETOOTH 1)
1150-
endif()
11511151
set(HAVE_SDL_HIDAPI TRUE)
11521152

11531153
if(SDL_JOYSTICK AND SDL_HIDAPI_JOYSTICK)

0 commit comments

Comments
 (0)