Commit graph

3 commits

Author SHA1 Message Date
Jon Szymaniak
2cfb00173e cmake: Fixes for version check helper programs (Cygwin)
It appears that although CMake no longer defines WIN32 for Cygwin,
the libusb headers may be defining this macro, causing the code intended for
MSVC builds to be used in libusb_version.c and fail to compile. Hence,
we need to explicitly check for __CYGWIN__ in this program. Thank you to
Jeremy Quirke for pointing out this issue and providing fixes.

The libc version check doesn't make sense for Cygwin builds, so it is now
skipped.
2014-10-30 17:18:28 -04:00
Jon Szymaniak
97a44f94e4 cmake: Explicitly link libusb at runtime for version check in Windows
FindLibUSB.cmake presents issues with its try_compile() invocation
when using some dated CMake versions, such as 2.8.7 and 2.8.11, while
operating fine with more recent versions (e.g., 2.8.12.2, 3.0.0).

Using try_run() is a cleaner solution than a combination of try_compile() and
execute_process(). However, in Windows we need to stage libusb-1.0.dll in the
directory containing the resulting libusb_version.exe. As try_run() creates a
a temporary build directory and deletes it when done, this originally
posed a challenge to copying libusb-1.0.dll to the correct directory.

To address both of these challenges, the Windows version of this program now
explicitly links libusb at runtime, provided the path to the libusb DLL.

OSX and Linux variants assume libusb is in the library path, and link against
the library at compile-time.
2014-10-22 02:54:15 -04:00
Jon Szymaniak
34151f6e71 host: Added a config-time libusb version check and errors/warnings
FindLibUSB.cmake now fetches the libusb version via libusb_get_version()
so that we can warn (or error out) about the system containing an
outdated libusb version.

The following policies have been based upon support experiences and the
libusb changelog:

    Windows: Error out for libusb < 1.0.19
        v1.0.19 provides Windows 8 SuperSpeed detection support,
        and appears to address a number of issues bladeRF users
        have reported with v1.0.18 and earlier.

        We force users to update here, given that some of the failures
        on earlier versions were yielding corrupted samples.

    OSX: Warn for libusb < 1.0.18:
        v1.0.16 - v1.0.18 introduced SuperSpeed and 64-bit support,
        as well as fixes for compile-time and run-time issues.

    Linux: Warn for libusb < 1.0.16:
        This is largely based upon feedback from bladeRF users. While
        older versions may work, a number of users reported that issues
        appeared to be resolved after updating libusb to >= 1.0.16.
        (It isn't always clear if the reported update included Linux
         distro upgrades that included kernel updates.)

The version check may be skipped via LIBUSB_SKIP_VERSION_CHECK=Yes.
This is intentionally not noted in the warnings/errors, as it's
preferred that users update libusb rather than just skip the check.
2014-10-15 20:06:53 -04:00