Skip to content

Fix Windows build and CI with libusb #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ jobs:
choco install -y .github/workflows/choco_packages.config
curl -L https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z -o libusb.7z
7z x libusb.7z -olibusb
ls libusb
- name: Set LIBUSB_ROOT (Windows)
if: runner.os == 'Windows'
shell: bash
run: echo "LIBUSB_ROOT=$(pwd)/libusb" >> "$GITHUB_ENV"
run: |
"LIBUSB_ROOT=$(pwd)/libusb" >> $env:GITHUB_ENV
- name: Check LIBUSB_ROOT (Windows)
if: runner.os == 'Windows'
run: |
echo $env:LIBUSB_ROOT

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
Expand Down Expand Up @@ -71,6 +76,13 @@ jobs:
picotool info -a blink.uf2
picotool info -a hello_world.uf2
picotool info -a flash_nuke.uf2

- name: Test libusb compiled
if: matrix.libusb == 'libusb'
run: |
picotool help load
picotool help save
picotool help erase

test-examples:
# Prevent running twice for PRs from same repo
Expand Down
7 changes: 7 additions & 0 deletions picoboot_connection/picoboot_connection_cxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
#include <algorithm>
#include "picoboot_connection_cxx.h"

#ifdef _WIN32
#undef min
#undef max

#define _CRT_SECURE_NO_WARNINGS
#endif

using picoboot::connection;
using picoboot::connection_error;
using picoboot::command_failure;
Expand Down
Loading