fafca4c265
Phase 4 foundation, independent of the presentation mechanism: - hid/hid_report.hpp: standard Xbox One report layout (64-byte input: buttons/guide/triggers/sticks; 64-byte output: motors), the HID report descriptor, and GIP state to report mapping. - make_input_report(): remaps GIP button bits to the standard Xbox bitmask, scales 10-bit triggers to 8-bit, sticks pass through. - parse_output_report(): extracts motor intensities from output reports for the rumble relay; malformed reports stop the motors. - test_hid: unit tests for the mapping, scaling, and descriptor. Report packing verified with a descriptor walker: input and output are exactly 64 bytes each. Next step is presentation via DriverKit, which needs a Developer ID with the DriverKit entitlement. Co-Authored-By: qwen3.8-27b@q3_k_xl: implemented HID report layer
69 lines
2.8 KiB
CMake
69 lines
2.8 KiB
CMake
set(TEST_TARGETS "")
|
|
|
|
add_executable(test_usb test_usb.cpp)
|
|
target_include_directories(test_usb PRIVATE "${CMAKE_SOURCE_DIR}/include")
|
|
target_link_libraries(test_usb PRIVATE xone_usb Unity::Unity)
|
|
target_compile_features(test_usb PRIVATE cxx_std_23)
|
|
add_test(NAME test_usb COMMAND test_usb)
|
|
list(APPEND TEST_TARGETS test_usb)
|
|
|
|
add_executable(test_mt76 test_mt76.cpp)
|
|
target_include_directories(test_mt76 PRIVATE "${CMAKE_SOURCE_DIR}/include")
|
|
target_link_libraries(test_mt76 PRIVATE xone_mt76 Unity::Unity)
|
|
target_compile_features(test_mt76 PRIVATE cxx_std_23)
|
|
add_test(NAME test_mt76 COMMAND test_mt76)
|
|
list(APPEND TEST_TARGETS test_mt76)
|
|
|
|
add_executable(test_version test_version.cpp)
|
|
target_include_directories(test_version PRIVATE "${CMAKE_SOURCE_DIR}/include")
|
|
target_link_libraries(test_version PRIVATE xone_api Unity::Unity)
|
|
target_compile_features(test_version PRIVATE cxx_std_23)
|
|
target_compile_definitions(test_version PRIVATE XONE_VERSION="${PROJECT_VERSION}")
|
|
add_test(NAME test_version COMMAND test_version)
|
|
list(APPEND TEST_TARGETS test_version)
|
|
|
|
add_executable(test_types test_types.cpp)
|
|
target_include_directories(test_types PRIVATE "${CMAKE_SOURCE_DIR}/include")
|
|
target_link_libraries(test_types PRIVATE Unity::Unity)
|
|
target_compile_features(test_types PRIVATE cxx_std_23)
|
|
add_test(NAME test_types COMMAND test_types)
|
|
list(APPEND TEST_TARGETS test_types)
|
|
|
|
add_executable(test_crypto test_crypto.cpp)
|
|
target_include_directories(test_crypto PRIVATE "${CMAKE_SOURCE_DIR}/include")
|
|
target_link_libraries(test_crypto PRIVATE xone_auth Unity::Unity)
|
|
target_compile_features(test_crypto PRIVATE cxx_std_23)
|
|
add_test(NAME test_crypto COMMAND test_crypto)
|
|
list(APPEND TEST_TARGETS test_crypto)
|
|
|
|
add_executable(test_auth test_auth.cpp)
|
|
target_include_directories(test_auth PRIVATE "${CMAKE_SOURCE_DIR}/include")
|
|
target_link_libraries(test_auth PRIVATE xone_auth Unity::Unity)
|
|
target_compile_features(test_auth PRIVATE cxx_std_23)
|
|
add_test(NAME test_auth COMMAND test_auth)
|
|
list(APPEND TEST_TARGETS test_auth)
|
|
|
|
add_executable(test_gip test_gip.cpp)
|
|
target_include_directories(test_gip PRIVATE "${CMAKE_SOURCE_DIR}/include")
|
|
target_link_libraries(test_gip PRIVATE xone_gip Unity::Unity)
|
|
target_compile_features(test_gip PRIVATE cxx_std_23)
|
|
add_test(NAME test_gip COMMAND test_gip)
|
|
list(APPEND TEST_TARGETS test_gip)
|
|
|
|
add_executable(test_hid test_hid.cpp)
|
|
target_include_directories(test_hid PRIVATE "${CMAKE_SOURCE_DIR}/include")
|
|
target_link_libraries(test_hid PRIVATE xone_hid Unity::Unity)
|
|
target_compile_features(test_hid PRIVATE cxx_std_23)
|
|
add_test(NAME test_hid COMMAND test_hid)
|
|
list(APPEND TEST_TARGETS test_hid)
|
|
|
|
add_custom_target(check
|
|
COMMAND ${CMAKE_CTEST_COMMAND}
|
|
--test-dir "${CMAKE_BINARY_DIR}"
|
|
--output-on-failure
|
|
--progress
|
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
|
USES_TERMINAL
|
|
DEPENDS ${TEST_TARGETS}
|
|
)
|