hidapi: Add SDL_hidapi.c, allows support for multiple hidapi backends.
This is currently supported on Linux and macOS. iOS and Android are not supported at all, Windows support could be added with some changes to the libusb backend. The Visual Studio and Xcode projects do not use this feature. Based on Valve Software's hid.cpp, written in collaboration with Andrew Eikum.
This commit is contained in:
parent
571fc2a8b1
commit
55c49e7d33
7 changed files with 847 additions and 27 deletions
|
@ -1088,8 +1088,15 @@ macro(CheckHIDAPI)
|
|||
set(SOURCE_FILES ${SOURCE_FILES} ${HIDAPI_SOURCES})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS} -I${SDL2_SOURCE_DIR}/src/hidapi/hidapi")
|
||||
if(NOT HIDAPI_SKIP_LIBUSB)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c)
|
||||
list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
|
||||
if(HIDAPI_ONLY_LIBUSB)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c)
|
||||
list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
|
||||
else()
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/SDL_hidapi.c)
|
||||
# libusb is loaded dynamically, so don't add it to EXTRA_LIBS
|
||||
FindLibraryAndSONAME("usb-1.0")
|
||||
set(SDL_LIBUSB_DYNAMIC "\"${USB_LIB_SONAME}\"")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue