cmake: enable disabing hidapi

This commit is contained in:
Anonymous Maarten 2022-07-26 02:51:07 +02:00 committed by Sam Lantinga
parent a4e6f3ca9d
commit 17b329d199
2 changed files with 46 additions and 40 deletions

View File

@ -515,10 +515,12 @@ set_option(SDL_INSTALL_TESTS "Install test-cases" OFF)
set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}")
if(HIDAPI_ONLY_LIBUSB)
if(SDL_HIDAPI)
if(HIDAPI_ONLY_LIBUSB)
set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE)
elseif(HIDAPI_SKIP_LIBUSB)
elseif(HIDAPI_SKIP_LIBUSB)
set(SDL_HIDAPI_LIBUSB OFF CACHE BOOL "" FORCE)
endif()
endif()
if(VITA)

View File

@ -1176,6 +1176,7 @@ endmacro()
# Check for HIDAPI support
macro(CheckHIDAPI)
set(HAVE_HIDAPI TRUE)
if(SDL_HIDAPI)
if(SDL_HIDAPI_LIBUSB)
set(HAVE_LIBUSB FALSE)
pkg_check_modules(LIBUSB libusb-1.0)
@ -1220,6 +1221,9 @@ macro(CheckHIDAPI)
list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES})
endif()
endif()
else()
set(SDL_HIDAPI_DISABLED 1)
endif()
endmacro()
# Requires: