2017-04-25 05:06:39 +02:00
|
|
|
project(hidapi)
|
|
|
|
|
2024-01-29 20:12:26 +01:00
|
|
|
add_library(hidapi STATIC hidapi-src/hidapi/hidapi.h)
|
2024-03-19 07:08:54 +01:00
|
|
|
dolphin_disable_warnings(hidapi)
|
2024-01-29 20:12:26 +01:00
|
|
|
target_include_directories(hidapi PUBLIC hidapi-src/hidapi)
|
2017-04-25 05:06:39 +02:00
|
|
|
|
|
|
|
if(APPLE)
|
2024-01-29 20:12:26 +01:00
|
|
|
target_sources(hidapi PRIVATE hidapi-src/mac/hid.c)
|
2017-04-25 05:06:39 +02:00
|
|
|
elseif(MSVC)
|
2024-01-29 20:12:26 +01:00
|
|
|
target_sources(hidapi PRIVATE hidapi-src/windows/hid.c)
|
2017-04-25 05:06:39 +02:00
|
|
|
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)
|
2024-01-29 20:12:26 +01:00
|
|
|
target_sources(hidapi PRIVATE hidapi-src/linux/hid.c)
|
2017-04-25 05:06:39 +02:00
|
|
|
target_link_libraries(hidapi PRIVATE udev)
|
|
|
|
else()
|
2024-01-29 20:12:26 +01:00
|
|
|
target_sources(hidapi PRIVATE hidapi-src/libusb/hid.c)
|
2024-05-06 19:44:32 +02:00
|
|
|
target_link_libraries(hidapi PRIVATE LibUSB::LibUSB)
|
2017-04-25 05:06:39 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(Hidapi::Hidapi ALIAS hidapi)
|