Skip to content

Commit 5a2b62d

Browse files
committed
cmake: Require libusb 1.0.20 on Linux
Tell users at configure time libusb 1.0.19 does not work. But do not enforce this on Windows or Mac OSX.
1 parent 2cee7df commit 5a2b62d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

cmake_modules/FindLibUSB.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ IF(PKG_CONFIG_FOUND)
1111
IF(DEPENDS_DIR) #Otherwise use System pkg-config path
1212
SET(ENV{PKG_CONFIG_PATH} "${DEPENDS_DIR}/libusb/lib/pkgconfig")
1313
ENDIF()
14+
SET(MODULE "libusb-1.0")
15+
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
16+
SET(MODULE "libusb-1.0>=1.0.20")
17+
ENDIF()
1418
IF(LibUSB_FIND_REQUIRED)
15-
PKG_CHECK_MODULES(LibUSB REQUIRED libusb-1.0)
16-
ELSE()
17-
PKG_CHECK_MODULES(LibUSB libusb-1.0)
19+
SET(LisUSB_REQUIRED "REQUIRED")
1820
ENDIF()
21+
PKG_CHECK_MODULES(LibUSB ${LibUSB_REQUIRED} ${MODULE})
1922

2023
FIND_LIBRARY(LibUSB_LIBRARY
2124
NAMES ${LibUSB_LIBRARIES}

src/libfreenect2.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,13 @@ class Freenect2Impl
298298
initialized(false),
299299
has_device_enumeration_(false)
300300
{
301+
#ifdef __linux__
301302
if (libusb_get_version()->nano < 10952)
302303
{
303304
LOG_ERROR << "Your libusb does not support large iso buffer!";
304305
return;
305306
}
307+
#endif
306308

307309
if(managed_usb_context_)
308310
{

0 commit comments

Comments
 (0)