Separated the HIDAPI subsystem from HIDAPI joysticks
You can now disable HIDAPI joysticks while retaining the HIDAPI SDL API
This commit is contained in:
@@ -186,9 +186,6 @@ if((WINDOWS AND NOT WINDOWS_STORE) OR IOS OR TVOS OR ANDROID)
|
||||
else()
|
||||
set(HIDAPI_SKIP_LIBUSB FALSE)
|
||||
endif()
|
||||
if (HIDAPI_SKIP_LIBUSB)
|
||||
set(OPT_DEF_HIDAPI ON)
|
||||
endif()
|
||||
|
||||
# On the other hand, *BSD specifically uses libusb only, so we make a special
|
||||
# case just for them.
|
||||
@@ -424,9 +421,9 @@ set_option(SDL_METAL "Enable Metal support" ${APPLE})
|
||||
set_option(SDL_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS})
|
||||
dep_option(SDL_KMSDRM_SHARED "Dynamically load KMS DRM support" ON "SDL_KMSDRM" OFF)
|
||||
set_option(SDL_OFFSCREEN "Use offscreen video driver" OFF)
|
||||
option_string(SDL_BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" "OFF")
|
||||
option_string(SDL_FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" "OFF")
|
||||
set_option(SDL_HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI})
|
||||
option_string(SDL_BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" OFF)
|
||||
option_string(SDL_FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" OFF)
|
||||
set_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON)
|
||||
set_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON)
|
||||
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
|
||||
|
||||
@@ -1053,11 +1050,10 @@ if(ANDROID)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_HAPTIC_SOURCES})
|
||||
set(HAVE_SDL_HAPTIC TRUE)
|
||||
endif()
|
||||
if(SDL_JOYSTICK)
|
||||
if(SDL_HIDAPI)
|
||||
CheckHIDAPI()
|
||||
if(HAVE_HIDAPI)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp)
|
||||
endif()
|
||||
endif()
|
||||
if(SDL_JOYSTICK)
|
||||
set(SDL_JOYSTICK_ANDROID 1)
|
||||
file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_JOYSTICK_SOURCES})
|
||||
@@ -1380,11 +1376,14 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
|
||||
# src/core/unix/*.c is included in a generic if(UNIX) section, elsewhere.
|
||||
endif()
|
||||
|
||||
if(SDL_HIDAPI)
|
||||
CheckHIDAPI()
|
||||
endif()
|
||||
|
||||
if(SDL_JOYSTICK)
|
||||
if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
|
||||
CheckUSBHID()
|
||||
endif()
|
||||
CheckHIDAPI()
|
||||
if(LINUX AND NOT ANDROID)
|
||||
set(SDL_JOYSTICK_LINUX 1)
|
||||
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
|
||||
@@ -1706,8 +1705,11 @@ elseif(WINDOWS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_JOYSTICK)
|
||||
if(SDL_HIDAPI)
|
||||
CheckHIDAPI()
|
||||
endif()
|
||||
|
||||
if(SDL_JOYSTICK)
|
||||
if(NOT WINDOWS_STORE)
|
||||
set(SDL_JOYSTICK_RAWINPUT 1)
|
||||
endif()
|
||||
@@ -1802,14 +1804,11 @@ elseif(APPLE)
|
||||
set(SDL_FRAMEWORK_AVFOUNDATION 1)
|
||||
endif()
|
||||
|
||||
if(SDL_JOYSTICK)
|
||||
if(SDL_HIDAPI)
|
||||
CheckHIDAPI()
|
||||
if(HAVE_HIDAPI)
|
||||
if(IOS OR TVOS)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m)
|
||||
set(SDL_FRAMEWORK_COREBLUETOOTH 1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_JOYSTICK)
|
||||
if(IOS OR TVOS)
|
||||
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
|
||||
set(SDL_JOYSTICK_MFI 1)
|
||||
|
||||
Reference in New Issue
Block a user