diff --git a/3rdparty/hidapi/CMakeLists.txt b/3rdparty/hidapi/CMakeLists.txt index b2f624e50..50d05572a 100644 --- a/3rdparty/hidapi/CMakeLists.txt +++ b/3rdparty/hidapi/CMakeLists.txt @@ -1,4 +1,5 @@ + set(HIDAPI_SOURCES hidapi/hidapi.h hidapi/hidparse.h @@ -17,26 +18,27 @@ 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 -add_library(hidapi STATIC - ${HIDAPI_SOURCES} +add_library(hidapi STATIC + ${HIDAPI_SOURCES} ) -# only needed for Linux, but doesn't do any harm here -target_link_libraries(hidapi ${UDEV_LIBRARIES}) - if(WIN32) find_library(SETUP_API_LIB Setupapi) if (NOT SETUP_API_LIB) - message(WARNING "Failed to find Setupapi.lib") - endif() - + message(FATAL_ERROR "Failed to find Setupapi.lib") + endif() target_link_libraries(hidapi ${SETUP_API_LIB}) -endif() - - -if(APPLE) +elseif(APPLE) find_library(IOKIT_FRAMEWORK IOKit) target_link_libraries(hidapi ${IOKIT_FRAMEWORK}) +else() + # Linux-y things + find_package(UDev) + if (UDEV_FOUND) + target_link_libraries(hidapi ${UDEV_LIBRARIES}) + else() + message(FATAL_ERROR "Failed to find UDev") + endif() endif() target_include_directories(hidapi PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/hidapi) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf25f6dc1..785b049d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,10 @@ IF(APPLE) find_library(COCOA_LIBRARY Cocoa) list(APPEND PLATFORM_LIBS ${COCOA_LIBRARY} ${CORESERVICES_LIBRARY}) elseif(WIN32) - set(EVENT_INPUT_DEFAULT 1) + find_library(SETUP_API_LIB Setupapi) + if (SETUP_API_LIB) + set(EVENT_INPUT_DEFAULT 1) + endif() list(APPEND PLATFORM_LIBS "Shlwapi.lib") @@ -197,12 +200,11 @@ option(ENABLE_JS_DEMO "Set to ON to build the js_demo application (default)" option(ENABLE_METAR "Set to ON to build the metar application (default)" ON) option(ENABLE_STGMERGE "Set to ON to build the stgmerge application (default)" OFF) option(ENABLE_FGCOM "Set to ON to build the FGCom application (default)" ON) -option(ENABLE_FLITE "Set to ON to build the Flite text-to-speech module" ON) option(ENABLE_QT "Set to ON to build the internal Qt launcher" ON) option(ENABLE_TRAFFIC "Set to ON to build the external traffic generator modules" ON) option(ENABLE_FGQCANVAS "Set to ON to build the Qt-based remote canvas application" OFF) option(ENABLE_DEMCONVERT "Set to ON to build the dem conversion tool (default)" ON) -option(ENABLE_HID_INPUT "Set to ON to build HID-based input code" ON) +option(ENABLE_HID_INPUT "Set to ON to build HID-based input code" ${EVENT_INPUT_DEFAULT}) option(ENABLE_PLIB_JOYSTICK "Set to ON to enable legacy joystick code (default)" ON) option(ENABLE_COMPOSITOR "Set to ON to enable the Compositor-based Viewer" OFF) option(ENABLE_SWIFT "Set to ON to build the swift module" ON) @@ -259,7 +261,13 @@ if(EVENT_INPUT) endif() else() # Windows - add_definitions(-DWITH_EVENTINPUT) + if (NOT SETUP_API_LIB) + message(WARNING "Setupapi.lib not found, HID/event input is disabled") + set(ENABLE_HID_INPUT 0) + set(EVENT_INPUT 0) + else() + add_definitions(-DWITH_EVENTINPUT) + endif() endif() if (ENABLE_HID_INPUT)