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,11 +515,13 @@ set_option(SDL_INSTALL_TESTS "Install test-cases" OFF)
set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}") set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}")
if(SDL_HIDAPI)
if(HIDAPI_ONLY_LIBUSB) if(HIDAPI_ONLY_LIBUSB)
set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE) set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE)
elseif(HIDAPI_SKIP_LIBUSB) elseif(HIDAPI_SKIP_LIBUSB)
set(SDL_HIDAPI_LIBUSB OFF CACHE BOOL "" FORCE) set(SDL_HIDAPI_LIBUSB OFF CACHE BOOL "" FORCE)
endif() endif()
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)

View File

@ -1176,6 +1176,7 @@ endmacro()
# Check for HIDAPI support # Check for HIDAPI support
macro(CheckHIDAPI) macro(CheckHIDAPI)
set(HAVE_HIDAPI TRUE) set(HAVE_HIDAPI TRUE)
if(SDL_HIDAPI)
if(SDL_HIDAPI_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)
@ -1220,6 +1221,9 @@ macro(CheckHIDAPI)
list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES}) list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES})
endif() endif()
endif() endif()
else()
set(SDL_HIDAPI_DISABLED 1)
endif()
endmacro() endmacro()
# Requires: # Requires: