1
0
Fork 0

Enable HID-input on Windows

This commit is contained in:
James Turner 2019-04-27 18:49:03 +01:00
parent 3539b13985
commit 9d71d09072
5 changed files with 36 additions and 20 deletions

View file

@ -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})

View file

@ -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)

View file

@ -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)

View file

@ -25,6 +25,7 @@
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <hidapi/hidapi.h>
#include <hidapi/hidparse.h>

View file

@ -37,13 +37,11 @@
#endif
#ifdef WITH_EVENTINPUT
#if defined( SG_WINDOWS )
//to be developed
//#include "FGDirectXEventInput.hxx"
//#define INPUTEVENT_CLASS FGDirectXEventInput
#elif defined ( SG_MAC )
#if defined ( SG_MAC )
#include "FGMacOSXEventInput.hxx"
#define INPUTEVENT_CLASS FGMacOSXEventInput
#elif defined(SG_WINDOWS)
#else
#include "FGLinuxEventInput.hxx"
#define INPUTEVENT_CLASS FGLinuxEventInput
@ -52,8 +50,7 @@
#if defined(ENABLE_HID_INPUT)
#include "FGHIDEventInput.hxx"
#endif
#endif
#endif // of WITH_EVENTINPUT
////////////////////////////////////////////////////////////////////////
// Implementation of FGInput.