Skip to content

Commit 2809b51

Browse files
fix(Linux): Use Release package build and byte helper (#70)
1 parent b875041 commit 2809b51

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,16 +501,16 @@ jobs:
501501
502502
# This intentionally uses a separate BUILD_TESTS=OFF configuration. Test
503503
# builds add lizardbyte-common for test support and therefore cannot prove
504-
# that a normal installed package is independently consumable. Debug keeps
505-
# this packaging regression isolated from the open optimized-GCC P2; switch
506-
# this job to Release when that warning is resolved.
504+
# that a normal installed package is independently consumable. Release also
505+
# keeps an optimized GCC library build under warnings-as-errors without
506+
# changing or publishing the ordinary library artifacts.
507507
- name: Configure tests-disabled package
508508
run: |
509509
cmake \
510510
-DBUILD_DOCS=OFF \
511511
-DBUILD_EXAMPLES=OFF \
512512
-DBUILD_TESTS=OFF \
513-
-DCMAKE_BUILD_TYPE:STRING=Debug \
513+
-DCMAKE_BUILD_TYPE:STRING=Release \
514514
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/cmake-build-package/install" \
515515
-DLIBVIRTUALHID_BUILD_TOOLS=OFF \
516516
-DLIBVIRTUALHID_ENABLE_PACKAGING=OFF \

src/core/profiles.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// standard includes
77
#include <cstddef>
88
#include <cstdint>
9+
#include <initializer_list>
910
#include <string>
1011
#include <string_view>
1112
#include <vector>
@@ -90,6 +91,16 @@ namespace lvh::profiles {
9091
return descriptor;
9192
}
9293

94+
void append_descriptor_bytes(
95+
std::vector<std::uint8_t> &descriptor,
96+
std::initializer_list<std::uint8_t> bytes
97+
) {
98+
descriptor.reserve(descriptor.size() + bytes.size());
99+
for (const auto byte : bytes) {
100+
descriptor.push_back(byte);
101+
}
102+
}
103+
93104
void append_common_gamepad_buttons(std::vector<std::uint8_t> &descriptor, bool include_misc_button) {
94105
descriptor.insert(
95106
descriptor.end(),
@@ -270,8 +281,8 @@ namespace lvh::profiles {
270281
report_id, // Report ID
271282
};
272283
append_common_gamepad_buttons(descriptor, false);
273-
descriptor.insert(
274-
descriptor.end(),
284+
append_descriptor_bytes(
285+
descriptor,
275286
{
276287
0x05,
277288
0x01, // Usage Page (Generic Desktop)
@@ -325,8 +336,8 @@ namespace lvh::profiles {
325336
);
326337

327338
if (supports_rumble) {
328-
descriptor.insert(
329-
descriptor.end(),
339+
append_descriptor_bytes(
340+
descriptor,
330341
{
331342
0x06,
332343
0x00,

0 commit comments

Comments
 (0)