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.
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.
A USB backend based atop of the Cypress CyAPI (which is based atop the
Cypress CyUSB3 driver) has been introduced. This is intended to provide
Windows users with an additional driver to use if they encounter issues
with their USB host controller and libusb.
To build and use this backend, the Cypress FX3 SDK must be installed and
the following CMake flags should be provided:
-DENABLE_BACKEND_CYAPI=Yes -DFX3_SDK_PATH=<path to SDK>
A modified cyusb3.inf is provided in host/drivers/windows/cyusb3. Upon
performing a build this inf file and the associated driver files from
the FX3 SDK will be copied into the "output" directory along with the
bladeRF.dll and bladeRF-cli.exe. To install the driver, point the
Windows driver update to this location and accept the warning about the
driver being unsigned; this occurs because the Cypress driver wasn't
signed with bladeRF VID/PID values.
The libbladeRF device string for this backend is: "cypress"
Many thanks go out to LazyDodo for all his efforts in spearheading the
development of this backend -- much of this code is either his doing or
is directly based upon his efforts.
When making log_* calls, add these two lines to the corresponding
CMake file prior to add_library() or add_executable():
set(SRC_TO_SHORTEN ${MY_SRC_LIST})
include(ShortFileMacro)
Many thanks to LazyDodo for providing the CMake approach for doing this,
and to rwr for suggesting this change.
Added checks for the following functions so that builds on older setups
will error out with error messages at configuration time, rather than
compilation errors at build time.
- libusb_error_name()
- libusb_get_device_speed()
- libusb_handle_events_timeout()
- libusb_handle_events_timeout_completed()
Fixed Issue #242, where the FindLibUSB.cmake script wasn't finding a
libusb installed to /usr/local/ in the case where pkg-config wasn't
installed. This should also help in cases where pkg-config isn't
installed on Linux systems.
Other touch-ups include removal of an unnecessary warning message,
and some re-arrangement of operations.
The version checks are now enforced. (Fixes#130)
FindLibUsb now warns if the user is using < libusb-1.0.16, as this or
1.0.17 are *highly* recommended.
The redundant version check in Windows (ver.c) has been removed. Testing
with CMake 2.8.11.2 has shown check_library_exists() to be sufficient.
Where possible (and with contributor permission), items have been
changed to LGPLv2.1 or MIT licenses to avoid issues with any proprietary
libraries from vendors (HDL and FW), allow static linking (with headless
mode operation in mind), and to generally present users with more
permissive licenses.
File headers and the COPYING have been updated accordingly. Third party
sources have been either removed, replaced, or relocated in the source
tree, in accordance with the licenses decided upon for each part of the tree.
Contributor Assignment Agreements have been added, and it is required
that these be submitted before significant patches and pull requests
are accepted.
Most of these files had inaccurate copy-paste headers, as the files are
now vastly different than those mentioned. These will all just fall under
the "meta-data" category in upcoming licenses.
Per discussion with FindLibBladeRF.cmake author, the text in
FindLibTecla.cmake was unnecessary, and has been removed.
This includes freqmod's fixes provided in pull request/issue #57,
in addition to some other misc. cleanup items noted while reviewing
the aforementioned changset.
*Warning:* This is a broken nightly commit.
If not obvious, quite a bit of rearranging has been done.
The build script(s) for libbladeRF is mostly complete. This still
requires further configuration of debug builds and version info being
used to populate a version header.
Some cleanup has been done in the (formerly apps, now) utilities
directory. There's no CMake support in here yet...that's comming in the
next commit.