cmake: when there are alternatives, don't use libusb by default

main
Anonymous Maarten 2022-07-26 02:41:43 +02:00 committed by Sam Lantinga
parent d6a8b43cf7
commit a4e6f3ca9d
2 changed files with 12 additions and 4 deletions

View File

@ -499,8 +499,10 @@ dep_option(SDL_KMSDRM_SHARED "Dynamically load KMS DRM support" ON "SDL_KM
set_option(SDL_OFFSCREEN "Use offscreen video driver" 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_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) 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_HIDAPI "Enable the HIDAPI subsystem" ON)
set_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON) dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" OFF SDL_HIDAPI OFF)
dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF)
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF)
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library")
@ -513,6 +515,12 @@ set_option(SDL_INSTALL_TESTS "Install test-cases" OFF)
set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}") set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}")
if(HIDAPI_ONLY_LIBUSB)
set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE)
elseif(HIDAPI_SKIP_LIBUSB)
set(SDL_HIDAPI_LIBUSB OFF CACHE BOOL "" FORCE)
endif()
if(VITA) if(VITA)
set_option(VIDEO_VITA_PIB "Build with PSVita piglet gles2 support" OFF) set_option(VIDEO_VITA_PIB "Build with PSVita piglet gles2 support" OFF)
set_option(VIDEO_VITA_PVR "Build with PSVita PVR gles/gles2 support" OFF) set_option(VIDEO_VITA_PVR "Build with PSVita PVR gles/gles2 support" OFF)

View File

@ -1176,10 +1176,10 @@ endmacro()
# Check for HIDAPI support # Check for HIDAPI support
macro(CheckHIDAPI) macro(CheckHIDAPI)
set(HAVE_HIDAPI TRUE) set(HAVE_HIDAPI TRUE)
if(NOT HIDAPI_SKIP_LIBUSB) if(SDL_HIDAPI_LIBUSB)
set(HAVE_LIBUSB FALSE) set(HAVE_LIBUSB FALSE)
pkg_check_modules(LIBUSB libusb-1.0) pkg_check_modules(LIBUSB libusb-1.0)
if (LIBUSB_FOUND) if(LIBUSB_FOUND)
check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS}) check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS})
if(HAVE_LIBUSB_H) if(HAVE_LIBUSB_H)
set(HAVE_LIBUSB TRUE) set(HAVE_LIBUSB TRUE)