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

This commit is contained in:
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)
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_HIDAPI "Enable the HIDAPI subsystem" 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(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}")
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)
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)

View file

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