Skip to content

Commit

Permalink
Merge pull request #1202 from Crest/openbsd
Browse files Browse the repository at this point in the history
Fixed compliation for OpenBSD 7.0
  • Loading branch information
Nightwalker-87 committed Dec 1, 2021
2 parents e97f438 + 8dfebbe commit cb0f91a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cmake/modules/Findlibusb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") # FreeBSD; libusb is
message(FATAL_ERROR "Expected libusb library not found on your system! Verify your system integrity.")
endif ()

elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") # OpenBSD; libusb-1.0 is available from ports
FIND_PATH(
LIBUSB_INCLUDE_DIR NAMES libusb.h
HINTS /usr/local/include
PATH_SUFFIXES libusb-1.0
)
set(LIBUSB_NAME usb-1.0)
find_library(
LIBUSB_LIBRARY NAMES ${LIBUSB_NAME}
HINTS /usr/local
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(libusb DEFAULT_MSG LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR)
mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY)
if (NOT LIBUSB_FOUND)
message(FATAL_ERROR "No libusb-1.0 library found on your system! Install libusb-1.0 from ports or packages.")
endif ()

elseif (WIN32 OR (EXISTS "/etc/debian_version" AND MINGW)) # Windows or MinGW-toolchain on Debian
# MinGW/MSYS/MSVC: 64-bit or 32-bit?
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
Expand Down
2 changes: 2 additions & 0 deletions src/stlink-lib/libusb_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#if defined (__FreeBSD__)
#define MINIMAL_API_VERSION 0x01000102 // v1.0.16
#elif defined (__OpenBSD__)
#define MINIMAL_API_VERSION 0x01000104 // v1.0.20
#elif defined (__linux__)
#define MINIMAL_API_VERSION 0x01000104 // v1.0.20
#elif defined (__APPLE__)
Expand Down

0 comments on commit cb0f91a

Please sign in to comment.