Merge pull request #5025 from vladfi1/hidapi-udev-fix

Don't use hidapi-hidraw without udev.
This commit is contained in:
Matthew Parlane 2017-03-07 18:29:42 +13:00 committed by GitHub
commit 48a1ed9bf8
1 changed files with 13 additions and 5 deletions

View File

@ -754,15 +754,22 @@ if(NOT ANDROID)
include_directories(${HIDAPI_INCLUDE_DIRS})
list(APPEND LIBS ${HIDAPI_LIBRARIES})
else()
set(HIDAPI_FOUND 1)
include_directories(Externals/hidapi/hidapi)
if(APPLE)
message(STATUS "Using static hidapi from Externals")
add_subdirectory(Externals/hidapi/mac)
list(APPEND LIBS hidapi)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(STATUS "Using static hidapi-hidraw from Externals")
add_subdirectory(Externals/hidapi/linux)
list(APPEND LIBS hidapi-hidraw udev)
find_package(Libudev)
if(LIBUDEV_FOUND)
message(STATUS "Using static hidapi-hidraw from Externals")
add_subdirectory(Externals/hidapi/linux)
list(APPEND LIBS hidapi-hidraw udev)
else()
message(STATUS "Could not find udev, disabling hidapi")
set(HIDAPI_FOUND 0)
endif()
elseif(MSVC)
message(STATUS "Using static hidapi-hid from Externals")
add_subdirectory(Externals/hidapi/windows)
@ -773,8 +780,9 @@ if(NOT ANDROID)
list(APPEND LIBS hidapi-libusb)
endif()
endif()
set(HIDAPI_FOUND 1)
add_definitions(-DHAVE_HIDAPI=1)
if(HIDAPI_FOUND)
add_definitions(-DHAVE_HIDAPI=1)
endif()
endif()
if(NOT DISABLE_WX)