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