Skip to content

Commit 79a3516

Browse files
committed
Merge branch 'master' into connection-callback
- fix merge conflict - fix indentation in a few places
2 parents 1b0b6ac + d0732cd commit 79a3516

34 files changed

Lines changed: 2452 additions & 425 deletions

.github/workflows/builds.yml

Lines changed: 69 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: GitHub Builds
33
on: [push, pull_request]
44

55
env:
6-
NIX_COMPILE_FLAGS: -Wall -Wextra -pedantic -Werror
6+
NIX_COMPILE_FLAGS: -Wall -Wextra -pedantic -Werror
7+
GNU_COMPILE_FLAGS: -Wall -Wextra -pedantic -Werror -Wformat-signedness
78
MSVC_COMPILE_FLAGS: /W4 /WX
89

910
jobs:
@@ -112,8 +113,8 @@ jobs:
112113
- name: Configure CMake
113114
run: |
114115
rm -rf build install
115-
cmake -B build/shared -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/shared -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
116-
cmake -B build/static -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/static -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
116+
cmake -B build/shared -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/shared -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
117+
cmake -B build/static -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install/static -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
117118
- name: Build CMake Shared
118119
working-directory: build/shared
119120
run: make install
@@ -139,7 +140,7 @@ jobs:
139140
-S hidapisrc/hidtest \
140141
-Dhidapi_ROOT=install/shared \
141142
-DCMAKE_INSTALL_PREFIX=install/shared_test \
142-
"-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
143+
"-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
143144
cd build/shared_test
144145
make install
145146
- name: Check CMake Export Package Static
@@ -149,7 +150,7 @@ jobs:
149150
-S hidapisrc/hidtest \
150151
-Dhidapi_ROOT=install/static \
151152
-DCMAKE_INSTALL_PREFIX=install/static_test \
152-
"-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
153+
"-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
153154
cd build/static_test
154155
make install
155156
@@ -169,6 +170,7 @@ jobs:
169170
with:
170171
path: hidapisrc
171172
- name: Install dependencies
173+
shell: cmd
172174
run: |
173175
choco install ninja
174176
pip3 install meson
@@ -180,15 +182,15 @@ jobs:
180182
- name: Build CMake MSVC
181183
working-directory: build/msvc
182184
run: cmake --build . --config RelWithDebInfo --target install
183-
- name: Check artifacts MSVC
185+
- name: Check artifacts CMake MSVC
184186
uses: andstor/file-existence-action@v2
185187
with:
186188
files: "install/msvc/lib/hidapi.lib, \
187189
install/msvc/bin/hidapi.dll, \
188190
install/msvc/include/hidapi/hidapi.h, \
189191
install/msvc/include/hidapi/hidapi_winapi.h"
190192
fail: true
191-
- name: Check CMake Export Package
193+
- name: Check CMake MSVC Export Package
192194
shell: cmd
193195
run: |
194196
cmake ^
@@ -202,28 +204,28 @@ jobs:
202204
- name: Run CTest MSVC
203205
shell: cmd
204206
working-directory: build/msvc
205-
run: ctest -C RelWithDebInfo --rerun-failed --output-on-failure
207+
run: ctest -C RelWithDebInfo --no-compress-output --output-on-failure
206208

207-
- name: Configure CMake NMake
209+
- name: Configure CMake NMake MSVC
208210
shell: cmd
209211
run: |
210212
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
211213
cmake -G"NMake Makefiles" -B build\nmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install\nmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
212-
- name: Build CMake NMake
214+
- name: Build CMake NMake MSVC
213215
working-directory: build\nmake
214216
shell: cmd
215217
run: |
216218
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
217219
nmake install
218-
- name: Check artifacts NMake
220+
- name: Check artifacts CMake NMake MSVC
219221
uses: andstor/file-existence-action@v2
220222
with:
221223
files: "install/nmake/lib/hidapi.lib, \
222224
install/nmake/bin/hidapi.dll, \
223225
install/nmake/include/hidapi/hidapi.h, \
224226
install/nmake/include/hidapi/hidapi_winapi.h"
225227
fail: true
226-
- name: Check CMake Export Package NMake
228+
- name: Check CMake NMake MSVC Export Package
227229
shell: cmd
228230
run: |
229231
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
@@ -236,14 +238,52 @@ jobs:
236238
"-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
237239
cd build\nmake_test
238240
nmake install
239-
- name: Run CTest NMake
241+
- name: Run CTest NMake MSVC
240242
working-directory: build\nmake
241-
run: ctest --rerun-failed --output-on-failure
243+
run: ctest --no-compress-output --output-on-failure
244+
245+
- name: Configure CMake NMake ClangCL
246+
shell: cmd
247+
run: |
248+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
249+
cmake -G"NMake Makefiles" -B build\clang_cl -S hidapisrc -D CMAKE_C_COMPILER=clang-cl -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DHIDAPI_ENABLE_ASAN=OFF -DCMAKE_INSTALL_PREFIX=install\clang_cl -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
250+
- name: Build CMake NMake ClangCL
251+
working-directory: build\clang_cl
252+
shell: cmd
253+
run: |
254+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
255+
nmake install
256+
- name: Check artifacts CMake NMake ClangCL
257+
uses: andstor/file-existence-action@v2
258+
with:
259+
files: "install/clang_cl/lib/hidapi.lib, \
260+
install/clang_cl/bin/hidapi.dll, \
261+
install/clang_cl/include/hidapi/hidapi.h, \
262+
install/clang_cl/include/hidapi/hidapi_winapi.h"
263+
fail: true
264+
- name: Check CMake NMake ClangCL Export Package
265+
shell: cmd
266+
run: |
267+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
268+
cmake ^
269+
-G"NMake Makefiles" ^
270+
-B build\clang_cl_test ^
271+
-S hidapisrc\hidtest ^
272+
-D CMAKE_C_COMPILER=clang-cl ^
273+
-Dhidapi_ROOT=install\clang_cl ^
274+
-DCMAKE_INSTALL_PREFIX=install\clang_cl_test ^
275+
"-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
276+
cd build\clang_cl_test
277+
cmake --build . --target install
278+
- name: Run CTest NMake ClangCL
279+
shell: cmd
280+
working-directory: build/clang_cl
281+
run: ctest -C RelWithDebInfo --no-compress-output --output-on-failure
242282

243283
- name: Configure CMake MinGW
244284
shell: cmd
245285
run: |
246-
cmake -G"MinGW Makefiles" -B build\mingw -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DCMAKE_INSTALL_PREFIX=install\mingw -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%NIX_COMPILE_FLAGS%"
286+
cmake -G"MinGW Makefiles" -B build\mingw -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DCMAKE_INSTALL_PREFIX=install\mingw -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%GNU_COMPILE_FLAGS%"
247287
- name: Build CMake MinGW
248288
working-directory: build\mingw
249289
run: cmake --build . --target install
@@ -264,12 +304,12 @@ jobs:
264304
-S hidapisrc\hidtest ^
265305
-Dhidapi_ROOT=install\mingw ^
266306
-DCMAKE_INSTALL_PREFIX=install\mingw_test ^
267-
"-DCMAKE_C_FLAGS=%NIX_COMPILE_FLAGS%"
307+
"-DCMAKE_C_FLAGS=%GNU_COMPILE_FLAGS%"
268308
cd build\mingw_test
269309
cmake --build . --target install
270310
- name: Run CTest MinGW
271311
working-directory: build\mingw
272-
run: ctest --rerun-failed --output-on-failure
312+
run: ctest --no-compress-output --output-on-failure
273313

274314
- name: Check Meson build
275315
shell: cmd
@@ -287,14 +327,14 @@ jobs:
287327
steps:
288328
- uses: actions/checkout@v3
289329
- uses: microsoft/setup-msbuild@v1.1
290-
- name: MSBuild x86
330+
- name: MSBuild x86 MSVC
291331
run: msbuild windows\hidapi.sln /p:Configuration=Release /p:Platform=Win32
292332
- name: Check artifacts x86
293333
uses: andstor/file-existence-action@v2
294334
with:
295335
files: "windows/Release/hidapi.dll, windows/Release/hidapi.lib, windows/Release/hidapi.pdb"
296336
fail: true
297-
- name: MSBuild x64
337+
- name: MSBuild x64 MSVC
298338
run: msbuild windows\hidapi.sln /p:Configuration=Release /p:Platform=x64
299339
- name: Check artifacts x64
300340
uses: andstor/file-existence-action@v2
@@ -331,8 +371,8 @@ jobs:
331371
- name: Configure CMake
332372
run: |
333373
rm -rf build install
334-
mingw64-cmake -B build/shared-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
335-
mingw64-cmake -B build/static-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
374+
mingw64-cmake -B build/shared-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
375+
mingw64-cmake -B build/static-cmake -S hidapisrc -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
336376
- name: Configure Automake
337377
working-directory: hidapisrc
338378
run: |
@@ -372,7 +412,7 @@ jobs:
372412
-S hidapisrc/hidtest \
373413
-Dhidapi_DIR=$PWD/install/shared-cmake/lib/cmake/hidapi \
374414
-DCMAKE_INSTALL_PREFIX=install/shared_test \
375-
"-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
415+
"-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
376416
cd build/shared_test
377417
ninja install
378418
- name: Check CMake Export Package Static
@@ -383,7 +423,7 @@ jobs:
383423
-S hidapisrc/hidtest \
384424
-Dhidapi_DIR=$PWD/install/static-cmake/lib/cmake/hidapi \
385425
-DCMAKE_INSTALL_PREFIX=install/static_test \
386-
"-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
426+
"-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
387427
cd build/static_test
388428
ninja install
389429
@@ -399,12 +439,12 @@ jobs:
399439
- name: Install dependencies
400440
run: |
401441
pacman -Sy
402-
pacman -S --noconfirm gcc pkg-config autoconf automake libtool libusb libudev0 cmake make
442+
pacman -S --noconfirm glibc lib32-glibc gcc pkg-config autoconf automake libtool libusb libudev0 cmake make
403443
- name: Configure CMake
404444
run: |
405445
rm -rf build install
406-
cmake -B build/shared-cmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
407-
cmake -B build/static-cmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
446+
cmake -B build/shared-cmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
447+
cmake -B build/static-cmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
408448
- name: Configure Automake
409449
working-directory: hidapisrc
410450
run: |
@@ -447,7 +487,7 @@ jobs:
447487
-S hidapisrc/hidtest \
448488
-Dhidapi_ROOT=install/shared-cmake \
449489
-DCMAKE_INSTALL_PREFIX=install/shared_test \
450-
"-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
490+
"-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
451491
cd build/shared_test
452492
make install
453493
- name: Check CMake Export Package Static
@@ -457,7 +497,7 @@ jobs:
457497
-S hidapisrc/hidtest \
458498
-Dhidapi_ROOT=install/static-cmake \
459499
-DCMAKE_INSTALL_PREFIX=install/static_test \
460-
"-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}"
500+
"-DCMAKE_C_FLAGS=${GNU_COMPILE_FLAGS}"
461501
cd build/static_test
462502
make install
463503
@@ -468,7 +508,7 @@ jobs:
468508
container: alpine:edge
469509
env:
470510
# A bug in musl: https://www.openwall.com/lists/musl/2020/01/20/2
471-
ALPINE_COMPILE_FLAGS: ${NIX_COMPILE_FLAGS} -Wno-overflow
511+
ALPINE_COMPILE_FLAGS: ${GNU_COMPILE_FLAGS} -Wno-overflow
472512
steps:
473513
- uses: actions/checkout@v3
474514
with:

0 commit comments

Comments
 (0)