Skip to content

Commit f4b5632

Browse files
authored
Fix Windows build and CI with libusb (#253)
* Fix Windows build * Fix Windows LibUSB in CI * Add test that libusb has been included
1 parent 455bdb4 commit f4b5632

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ jobs:
3131
choco install -y .github/workflows/choco_packages.config
3232
curl -L https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z -o libusb.7z
3333
7z x libusb.7z -olibusb
34+
ls libusb
3435
- name: Set LIBUSB_ROOT (Windows)
3536
if: runner.os == 'Windows'
36-
shell: bash
37-
run: echo "LIBUSB_ROOT=$(pwd)/libusb" >> "$GITHUB_ENV"
37+
run: |
38+
"LIBUSB_ROOT=$(pwd)/libusb" >> $env:GITHUB_ENV
39+
- name: Check LIBUSB_ROOT (Windows)
40+
if: runner.os == 'Windows'
41+
run: |
42+
echo $env:LIBUSB_ROOT
3843
3944
- name: Install dependencies (macOS)
4045
if: runner.os == 'macOS'
@@ -71,6 +76,13 @@ jobs:
7176
picotool info -a blink.uf2
7277
picotool info -a hello_world.uf2
7378
picotool info -a flash_nuke.uf2
79+
80+
- name: Test libusb compiled
81+
if: matrix.libusb == 'libusb'
82+
run: |
83+
picotool help load
84+
picotool help save
85+
picotool help erase
7486
7587
test-examples:
7688
# Prevent running twice for PRs from same repo

picoboot_connection/picoboot_connection_cxx.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
#include <algorithm>
1111
#include "picoboot_connection_cxx.h"
1212

13+
#ifdef _WIN32
14+
#undef min
15+
#undef max
16+
17+
#define _CRT_SECURE_NO_WARNINGS
18+
#endif
19+
1320
using picoboot::connection;
1421
using picoboot::connection_error;
1522
using picoboot::command_failure;

0 commit comments

Comments
 (0)