Implement raw DeviceMonitor
Multiple things have been done in this commit; the base of the new backend has effectively been created. This branch currently has many vital parts commented out. Therefore, this branch is currently only intended for debugging.
This commit is contained in:
@@ -11,66 +11,29 @@ find_package(PkgConfig REQUIRED)
|
||||
add_executable(logid
|
||||
logid.cpp
|
||||
util.cpp
|
||||
util.h
|
||||
Configuration.cpp
|
||||
Configuration.h
|
||||
Actions.cpp
|
||||
Actions.h
|
||||
Device.cpp
|
||||
Device.h
|
||||
DeviceFinder.cpp
|
||||
DeviceFinder.h
|
||||
EvdevDevice.cpp
|
||||
EvdevDevice.h)
|
||||
DeviceMonitor.cpp
|
||||
backend/raw/DeviceMonitor.cpp
|
||||
backend/raw/RawDevice.cpp
|
||||
backend/hidpp/Device.cpp
|
||||
backend/hidpp/Report.cpp
|
||||
backend/dj/Report.cpp)
|
||||
|
||||
set_target_properties(logid PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
pkg_check_modules(PC_EVDEV libevdev)
|
||||
pkg_check_modules(PC_EVDEV libevdev REQUIRED)
|
||||
pkg_check_modules(SYSTEMD "systemd")
|
||||
pkg_check_modules(LIBCONFIG libconfig)
|
||||
|
||||
find_path(HIDPP_INCLUDE_DIR hidpp)
|
||||
find_library(HIDPP_LIBRARY libhidpp.so)
|
||||
pkg_check_modules(LIBCONFIG libconfig REQUIRED)
|
||||
pkg_check_modules(LIBUDEV libudev REQUIRED)
|
||||
|
||||
find_path(EVDEV_INCLUDE_DIR libevdev/libevdev.h
|
||||
HINTS ${PC_EVDEV_INCLUDE_DIRS} ${PC_EVDEV_INCLUDEDIR})
|
||||
find_library(EVDEV_LIBRARY
|
||||
NAMES evdev libevdev)
|
||||
|
||||
if((NOT HIDPP_INCLUDE_DIR) OR (NOT EXISTS ${HIDPP_INCLUDE_DIR}) OR (NOT HIDPP_LIBRARY) OR FORCE_BUILD_HIDPP)
|
||||
message("Could not find libhidpp include dir, getting submodule")
|
||||
include_directories(${HIDPP_INCLUDE_DIR} ${EVDEV_INCLUDE_DIR} ${DBUSCXX_INCLUDE_DIR} ${LIBUDEV_INCLUDE_DIRECTORIES})
|
||||
|
||||
execute_process(COMMAND git submodule update --init -- hidpp
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(DEFAULT_HID_BACKEND "linux")
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set(DEFAULT_HID_BACKEND "windows")
|
||||
else()
|
||||
message(WARNING "System is not supported")
|
||||
endif()
|
||||
|
||||
set(HID_BACKEND "${DEFAULT_HID_BACKEND}" CACHE STRING "Backend used for accessing HID devices")
|
||||
set_property(CACHE HID_BACKEND PROPERTY STRINGS linux windows)
|
||||
|
||||
if("${HID_BACKEND}" STREQUAL "linux")
|
||||
pkg_check_modules(LIBUDEV libudev REQUIRED)
|
||||
elseif("${HID_BACKEND}" STREQUAL "windows")
|
||||
add_definitions(-DUNICODE -D_UNICODE)
|
||||
add_definitions(-D_WIN32_WINNT=0x0600) # Use vista or later
|
||||
else()
|
||||
message(FATAL_ERROR "HID_BACKEND is invalid.")
|
||||
endif()
|
||||
|
||||
add_subdirectory(hidpp/src/libhidpp)
|
||||
|
||||
set(HIDPP_INCLUDE_DIR "hidpp/src/libhidpp/")
|
||||
set(HIDPP_LIBRARY hidpp)
|
||||
else()
|
||||
set(HIDPP_INCLUDE_DIR ${HIDPP_INCLUDE_DIR}/hidpp)
|
||||
endif()
|
||||
|
||||
include_directories(${HIDPP_INCLUDE_DIR} ${EVDEV_INCLUDE_DIR})
|
||||
target_link_libraries(logid ${CMAKE_THREAD_LIBS_INIT} ${EVDEV_LIBRARY} config++
|
||||
${DBUSCXX_LIBRARIES} ${LIBUDEV_LIBRARIES})
|
||||
|
||||
target_link_libraries(logid ${CMAKE_THREAD_LIBS_INIT} ${EVDEV_LIBRARY} config++ ${HIDPP_LIBRARY})
|
||||
|
||||
|
Reference in New Issue
Block a user