mirror of https://github.com/encounter/SDL.git
cmake: enable disabing hidapi
This commit is contained in:
parent
a4e6f3ca9d
commit
17b329d199
|
@ -515,10 +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)
|
if(SDL_HIDAPI)
|
||||||
set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE)
|
if(HIDAPI_ONLY_LIBUSB)
|
||||||
elseif(HIDAPI_SKIP_LIBUSB)
|
set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE)
|
||||||
set(SDL_HIDAPI_LIBUSB OFF CACHE BOOL "" FORCE)
|
elseif(HIDAPI_SKIP_LIBUSB)
|
||||||
|
set(SDL_HIDAPI_LIBUSB OFF CACHE BOOL "" FORCE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(VITA)
|
if(VITA)
|
||||||
|
|
|
@ -1176,49 +1176,53 @@ endmacro()
|
||||||
# Check for HIDAPI support
|
# Check for HIDAPI support
|
||||||
macro(CheckHIDAPI)
|
macro(CheckHIDAPI)
|
||||||
set(HAVE_HIDAPI TRUE)
|
set(HAVE_HIDAPI TRUE)
|
||||||
if(SDL_HIDAPI_LIBUSB)
|
if(SDL_HIDAPI)
|
||||||
set(HAVE_LIBUSB FALSE)
|
if(SDL_HIDAPI_LIBUSB)
|
||||||
pkg_check_modules(LIBUSB libusb-1.0)
|
set(HAVE_LIBUSB FALSE)
|
||||||
if(LIBUSB_FOUND)
|
pkg_check_modules(LIBUSB libusb-1.0)
|
||||||
check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS})
|
if(LIBUSB_FOUND)
|
||||||
if(HAVE_LIBUSB_H)
|
check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS})
|
||||||
set(HAVE_LIBUSB TRUE)
|
if(HAVE_LIBUSB_H)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}")
|
set(HAVE_LIBUSB TRUE)
|
||||||
if(HIDAPI_ONLY_LIBUSB)
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}")
|
||||||
list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
|
if(HIDAPI_ONLY_LIBUSB)
|
||||||
elseif(OS2)
|
list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
|
||||||
set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"")
|
elseif(OS2)
|
||||||
else()
|
set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"")
|
||||||
# libusb is loaded dynamically, so don't add it to EXTRA_LIBS
|
else()
|
||||||
FindLibraryAndSONAME("usb-1.0")
|
# libusb is loaded dynamically, so don't add it to EXTRA_LIBS
|
||||||
if(USB_1.0_LIB)
|
FindLibraryAndSONAME("usb-1.0")
|
||||||
set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"")
|
if(USB_1.0_LIB)
|
||||||
|
set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
if(HIDAPI_ONLY_LIBUSB AND NOT HAVE_LIBUSB)
|
||||||
|
set(HAVE_HIDAPI FALSE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(HIDAPI_ONLY_LIBUSB AND NOT HAVE_LIBUSB)
|
|
||||||
set(HAVE_HIDAPI FALSE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(HAVE_HIDAPI)
|
if(HAVE_HIDAPI)
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp)
|
list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp)
|
||||||
endif()
|
endif()
|
||||||
if(IOS OR TVOS)
|
if(IOS OR TVOS)
|
||||||
list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m)
|
list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m)
|
||||||
set(SDL_FRAMEWORK_COREBLUETOOTH 1)
|
set(SDL_FRAMEWORK_COREBLUETOOTH 1)
|
||||||
endif()
|
endif()
|
||||||
set(HAVE_SDL_HIDAPI TRUE)
|
set(HAVE_SDL_HIDAPI TRUE)
|
||||||
|
|
||||||
if(SDL_JOYSTICK AND SDL_HIDAPI_JOYSTICK)
|
if(SDL_JOYSTICK AND SDL_HIDAPI_JOYSTICK)
|
||||||
set(SDL_JOYSTICK_HIDAPI 1)
|
set(SDL_JOYSTICK_HIDAPI 1)
|
||||||
set(HAVE_SDL_JOYSTICK TRUE)
|
set(HAVE_SDL_JOYSTICK TRUE)
|
||||||
set(HAVE_HIDAPI_JOYSTICK TRUE)
|
set(HAVE_HIDAPI_JOYSTICK TRUE)
|
||||||
file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c)
|
file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c)
|
||||||
list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES})
|
list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
set(SDL_HIDAPI_DISABLED 1)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue