Add libhidpp as submodule

This commit is contained in:
PixlOne 2019-09-22 22:33:11 -04:00
parent 0002d9f536
commit 00df833c54
4 changed files with 40 additions and 2 deletions

4
.gitmodules vendored Normal file
View File

@ -0,0 +1,4 @@
[submodule "src/logid/hidpp"]
path = src/logid/hidpp
url = https://github.com/PixlOne/hidpp.git
branch = master

View File

@ -11,7 +11,7 @@ You may also refer to logid.example.cfg for an example.
## Building ## Building
This project requires a C++14 compiler, cmake, libevdev, libconfig, and [my fork of libhidpp](https://github.com/PixlOne/hidpp) This project requires a C++14 compiler, cmake, libevdev, libudev, and libconfig
To build this project, run: To build this project, run:
@ -34,4 +34,4 @@ To install, run `sudo make install` after building. You can set the daemon to st
| K350 | Untested | | K350 | Untested |
| M325c | Untested | | M325c | Untested |
I own the MX Master, T400, K400r, K350, and M325c. Feel free to add to this list if you can test any additional devices. I own the MX Master, T400, K400r, K350, and M325c. Feel free to add to this list if you can test any additional devices.

View File

@ -37,6 +37,39 @@ find_library(EVDEV_LIBRARY
include_directories(${HIDPP_INCLUDE_DIR}/hidpp ${EVDEV_INCLUDE_DIR}) include_directories(${HIDPP_INCLUDE_DIR}/hidpp ${EVDEV_INCLUDE_DIR})
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")
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)
endif()
target_link_libraries(logid ${CMAKE_THREAD_LIBS_INIT} ${EVDEV_LIBRARY} config++ ${HIDPP_LIBRARY}) target_link_libraries(logid ${CMAKE_THREAD_LIBS_INIT} ${EVDEV_LIBRARY} config++ ${HIDPP_LIBRARY})
install(TARGETS logid DESTINATION bin) install(TARGETS logid DESTINATION bin)

1
src/logid/hidpp Submodule

@ -0,0 +1 @@
Subproject commit d124f4ecf99ba73a3a190c8a60015d9916b25dc0