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)
|
2022-05-21 13:09:05 +00:00
|
|
|
dolphin_disable_warnings_msvc(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)
|
2021-02-11 20:58:15 +00:00
|
|
|
target_link_libraries(hidapi PRIVATE ${LIBUSB_LIBRARIES})
|
2017-04-25 03:06:39 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(Hidapi::Hidapi ALIAS hidapi)
|