2017-10-25 21:56:38 +00:00
|
|
|
|
2019-05-28 16:09:58 +00:00
|
|
|
|
2017-10-25 21:56:38 +00:00
|
|
|
set(HIDAPI_SOURCES
|
|
|
|
hidapi/hidapi.h
|
|
|
|
hidapi/hidparse.h
|
|
|
|
hidparser/hidparse.c
|
|
|
|
)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
list(APPEND HIDAPI_SOURCES windows/hid.c)
|
|
|
|
elseif(APPLE)
|
|
|
|
list(APPEND HIDAPI_SOURCES mac/hid.c)
|
|
|
|
else()
|
|
|
|
list(APPEND HIDAPI_SOURCES linux/hid.c)
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
|
|
|
|
#add_definitions( -DHAVE_CONFIG_H ) # to use fgfs config.h to get FG version, if needed
|
|
|
|
#add_definitions( -DLIBVER="SVN 261" ) # add an iaxclient_lib version string
|
|
|
|
|
2019-05-28 16:09:58 +00:00
|
|
|
add_library(hidapi STATIC
|
|
|
|
${HIDAPI_SOURCES}
|
2017-10-25 21:56:38 +00:00
|
|
|
)
|
|
|
|
|
2019-04-27 17:49:03 +00:00
|
|
|
if(WIN32)
|
|
|
|
find_library(SETUP_API_LIB Setupapi)
|
|
|
|
if (NOT SETUP_API_LIB)
|
2019-05-28 16:09:58 +00:00
|
|
|
message(FATAL_ERROR "Failed to find Setupapi.lib")
|
|
|
|
endif()
|
2019-04-27 17:49:03 +00:00
|
|
|
target_link_libraries(hidapi ${SETUP_API_LIB})
|
2019-05-28 16:09:58 +00:00
|
|
|
elseif(APPLE)
|
2019-04-27 17:49:03 +00:00
|
|
|
find_library(IOKIT_FRAMEWORK IOKit)
|
|
|
|
target_link_libraries(hidapi ${IOKIT_FRAMEWORK})
|
2019-05-28 16:09:58 +00:00
|
|
|
else()
|
|
|
|
# Linux-y things
|
2019-05-28 16:14:49 +00:00
|
|
|
find_package(UDev QUIET)
|
2019-05-28 16:09:58 +00:00
|
|
|
if (UDEV_FOUND)
|
|
|
|
target_link_libraries(hidapi ${UDEV_LIBRARIES})
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Failed to find UDev")
|
|
|
|
endif()
|
2019-04-27 17:49:03 +00:00
|
|
|
endif()
|
2017-12-20 12:01:32 +00:00
|
|
|
|
2017-10-25 21:56:38 +00:00
|
|
|
target_include_directories(hidapi PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/hidapi)
|
|
|
|
target_include_directories(hidapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
|
|
# eof
|