2017-04-25 05:06:39 +02:00
|
|
|
project(hidapi)
|
|
|
|
|
|
|
|
add_library(hidapi STATIC hidapi/hidapi.h)
|
2022-05-21 15:09:05 +02:00
|
|
|
dolphin_disable_warnings_msvc(hidapi)
|
2017-04-25 05:06:39 +02:00
|
|
|
target_include_directories(hidapi PUBLIC hidapi)
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
target_sources(hidapi PRIVATE mac/hid.c)
|
|
|
|
elseif(MSVC)
|
|
|
|
target_sources(hidapi PRIVATE windows/hid.c)
|
|
|
|
else()
|
2022-05-28 13:26:08 +02:00
|
|
|
find_package(LIBUDEV)
|
2017-04-25 05:06:39 +02:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND LIBUDEV_FOUND)
|
|
|
|
target_sources(hidapi PRIVATE linux/hid.c)
|
|
|
|
target_link_libraries(hidapi PRIVATE udev)
|
|
|
|
else()
|
|
|
|
target_sources(hidapi PRIVATE libusb/hid.c)
|
2021-02-11 21:58:15 +01:00
|
|
|
target_link_libraries(hidapi PRIVATE ${LIBUSB_LIBRARIES})
|
2017-04-25 05:06:39 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(Hidapi::Hidapi ALIAS hidapi)
|