| 1 |
|
| 2 |
|
| 3 |
set(HIDAPI_SOURCES |
| 4 |
hidapi/hidapi.h |
| 5 |
hidapi/hidparse.h |
| 6 |
hidparser/hidparse.c |
| 7 |
) |
| 8 |
|
| 9 |
if (WIN32) |
| 10 |
list(APPEND HIDAPI_SOURCES |
| 11 |
windows/hid.c |
| 12 |
windows/hidapi_cfgmgr32.h |
| 13 |
windows/hidapi_descriptor_reconstruct.c |
| 14 |
windows/hidapi_descriptor_reconstruct.h |
| 15 |
windows/hidapi_hidclass.h |
| 16 |
windows/hidapi_hidpi.h |
| 17 |
windows/hidapi_hidsdi.h) |
| 18 |
elseif(APPLE) |
| 19 |
list(APPEND HIDAPI_SOURCES mac/hid.c) |
| 20 |
else() |
| 21 |
list(APPEND HIDAPI_SOURCES linux/hid.c) |
| 22 |
endif(WIN32) |
| 23 |
|
| 24 |
|
| 25 |
#add_definitions( -DHAVE_CONFIG_H ) # to use fgfs config.h to get FG version, if needed |
| 26 |
#add_definitions( -DLIBVER="SVN 261" ) # add an iaxclient_lib version string |
| 27 |
|
| 28 |
add_library(hidapi STATIC |
| 29 |
${HIDAPI_SOURCES} |
| 30 |
) |
| 31 |
|
| 32 |
if(WIN32) |
| 33 |
target_compile_definitions(hidapi |
| 34 |
# prevent marking functions as __declspec(dllexport) for static library build |
| 35 |
# #480: this should be refactored for v1.0 |
| 36 |
PUBLIC HID_API_NO_EXPORT_DEFINE |
| 37 |
) |
| 38 |
|
| 39 |
# target_link_libraries(hidapi PUBLIC SetupApi) |
| 40 |
elseif(APPLE) |
| 41 |
find_library(IOKIT_FRAMEWORK IOKit) |
| 42 |
target_link_libraries(hidapi ${IOKIT_FRAMEWORK}) |
| 43 |
else() |
| 44 |
# Linux-y things |
| 45 |
find_package(UDev QUIET) |
| 46 |
if (UDEV_FOUND) |
| 47 |
target_link_libraries(hidapi ${UDEV_LIBRARIES}) |
| 48 |
else() |
| 49 |
message(FATAL_ERROR "Failed to find UDev") |
| 50 |
endif() |
| 51 |
endif() |
| 52 |
|
| 53 |
target_include_directories(hidapi PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/hidapi) |
| 54 |
target_include_directories(hidapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) |
| 55 |
|
| 56 |
# eof |