2017-04-25 03:06:39 +00:00
|
|
|
project(hidapi)
|
|
|
|
|
2024-01-29 19:12:26 +00:00
|
|
|
add_library(hidapi STATIC hidapi-src/hidapi/hidapi.h)
|
2024-03-19 06:08:54 +00:00
|
|
|
dolphin_disable_warnings(hidapi)
|
2024-01-29 19:12:26 +00:00
|
|
|
target_include_directories(hidapi PUBLIC hidapi-src/hidapi)
|
2017-04-25 03:06:39 +00:00
|
|
|
|
|
|
|
if(APPLE)
|
2024-01-29 19:12:26 +00:00
|
|
|
target_sources(hidapi PRIVATE hidapi-src/mac/hid.c)
|
2017-04-25 03:06:39 +00:00
|
|
|
elseif(MSVC)
|
2024-01-29 19:12:26 +00:00
|
|
|
target_sources(hidapi PRIVATE hidapi-src/windows/hid.c)
|
2017-04-25 03:06:39 +00:00
|
|
|
else()
|
2022-05-28 11:26:08 +00:00
|
|
|
find_package(LIBUDEV)
|
2017-04-25 03:06:39 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND LIBUDEV_FOUND)
|
2024-01-29 19:12:26 +00:00
|
|
|
target_sources(hidapi PRIVATE hidapi-src/linux/hid.c)
|
2017-04-25 03:06:39 +00:00
|
|
|
target_link_libraries(hidapi PRIVATE udev)
|
|
|
|
else()
|
2024-01-29 19:12:26 +00:00
|
|
|
target_sources(hidapi PRIVATE hidapi-src/libusb/hid.c)
|
2024-05-06 17:44:32 +00:00
|
|
|
target_link_libraries(hidapi PRIVATE LibUSB::LibUSB)
|
2017-04-25 03:06:39 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(Hidapi::Hidapi ALIAS hidapi)
|