diff --git a/3rdparty/hidapi/CMakeLists.txt b/3rdparty/hidapi/CMakeLists.txt index c7d95ba83..b2f624e50 100644 --- a/3rdparty/hidapi/CMakeLists.txt +++ b/3rdparty/hidapi/CMakeLists.txt @@ -21,8 +21,23 @@ 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() + + target_link_libraries(hidapi ${SETUP_API_LIB}) +endif() + + +if(APPLE) + find_library(IOKIT_FRAMEWORK IOKit) + target_link_libraries(hidapi ${IOKIT_FRAMEWORK}) +endif() target_include_directories(hidapi PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/hidapi) target_include_directories(hidapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb414a521..952f025f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,8 @@ IF(APPLE) find_library(COCOA_LIBRARY Cocoa) list(APPEND PLATFORM_LIBS ${COCOA_LIBRARY} ${CORESERVICES_LIBRARY}) elseif(WIN32) + set(EVENT_INPUT_DEFAULT 1) + list(APPEND PLATFORM_LIBS "Shlwapi.lib") set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "bin") @@ -200,7 +202,7 @@ 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" OFF) +option(ENABLE_HID_INPUT "Set to ON to build HID-based input code" ON) 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" OFF) @@ -256,7 +258,8 @@ if(EVENT_INPUT) message(STATUS "event-based input enabled. Using ${UDEV_LIBRARIES}") endif() else() - message(WARNING "event-based input is not supported on this platform yet") + # Windows + add_definitions(-DWITH_EVENTINPUT) endif() if (ENABLE_HID_INPUT) diff --git a/src/Input/CMakeLists.txt b/src/Input/CMakeLists.txt index 606d30846..680991e9d 100644 --- a/src/Input/CMakeLists.txt +++ b/src/Input/CMakeLists.txt @@ -3,8 +3,8 @@ include(FlightGearComponent) IF(APPLE) set(EVENT_INPUT_SOURCES FGMacOSXEventInput.cxx) set(EVENT_INPUT_HEADERS FGMacOSXEventInput.hxx) -elseif(MSVC) - message(STATUS "EventInput not implemented for Windows yet") +elseif(WIN32) + # no Win32 specific implementation, at least for now else() set(EVENT_INPUT_SOURCES FGLinuxEventInput.cxx) set(EVENT_INPUT_HEADERS FGLinuxEventInput.hxx) diff --git a/src/Input/FGHIDEventInput.cxx b/src/Input/FGHIDEventInput.cxx index bef67e04b..447229e26 100644 --- a/src/Input/FGHIDEventInput.cxx +++ b/src/Input/FGHIDEventInput.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include diff --git a/src/Input/input.cxx b/src/Input/input.cxx index 171670bd6..fb84d8e23 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -33,27 +33,24 @@ #include "FGKeyboardInput.hxx" #if defined(ENABLE_PLIB_JOYSTICK) -#include "FGJoystickInput.hxx" + #include "FGJoystickInput.hxx" #endif #ifdef WITH_EVENTINPUT -#if defined( SG_WINDOWS ) -//to be developed -//#include "FGDirectXEventInput.hxx" -//#define INPUTEVENT_CLASS FGDirectXEventInput -#elif defined ( SG_MAC ) -#include "FGMacOSXEventInput.hxx" -#define INPUTEVENT_CLASS FGMacOSXEventInput -#else -#include "FGLinuxEventInput.hxx" -#define INPUTEVENT_CLASS FGLinuxEventInput -#endif + #if defined ( SG_MAC ) + #include "FGMacOSXEventInput.hxx" + #define INPUTEVENT_CLASS FGMacOSXEventInput + #elif defined(SG_WINDOWS) -#if defined(ENABLE_HID_INPUT) -#include "FGHIDEventInput.hxx" -#endif + #else + #include "FGLinuxEventInput.hxx" + #define INPUTEVENT_CLASS FGLinuxEventInput + #endif -#endif + #if defined(ENABLE_HID_INPUT) + #include "FGHIDEventInput.hxx" + #endif +#endif // of WITH_EVENTINPUT //////////////////////////////////////////////////////////////////////// // Implementation of FGInput.