Commit Graph

338 Commits

Author SHA1 Message Date
Abhishek Verma
e24b1cb8bb host/mpm: replace mpRPC with gRPC transport
host:
Replace the msgpack-RPC (rpclib) client with a gRPC-based
implementation. Add auto-generated C++ client and Python bindings
from protobuf definitions. Remove rpclib dependency and integrate
FindgRPC into CMake.

mpm:
Replace the msgpack-RPC server with a gRPC server generated from
protobuf definitions. Add pb_utils.py for type conversion between
Python and protobuf. Update rpc_server.py to dispatch calls via
gRPC stubs. Update mpm_shell to use gRPC. Replace pyudev with sysfs
scan in uio device discovery.

Bump MPM compatibility number to 7.0 and RPC version to 2.

This change requires new depedencies. E.g. for Ubuntu 24.04 or 25.10:
libgrpc++-dev, libprotobuf-dev, protobuf-compiler-grpc, python3-grpcio
2026-07-09 12:12:04 +02:00
Martin Braun
736fd1b85c cmake: Remove some Boost dependencies
With the most recent changes, Boost.Thread and all Boost date/time
libraries are no longer required. This updates the CMake and Debian
files to reflect those changes.
2026-06-15 09:50:16 +02:00
Marian Koop
1f9f2a8f78 cmake: win: Restore ability to compile against pre-build Boost binaries
Fixes issue introduced in UHD 4.9.0.1, that prevents local builds on Windows
against prebuild Boost binary (as described in the user manual).
Change is preserving use of Boost library symbols (i.e. Boost::<module>),
but requires use of a different cmake configuration and Boost 1.73.0 or later.
For details see updates to host/docs/build.dox.in for details.
2026-03-17 16:15:43 +01:00
Martin Braun
872df113cb cmake: Update C++ version to 20 2025-10-09 09:48:12 +02:00
Max Köhler
362eda2a8f cmake: process uhdTargets only when needed 2025-09-26 09:22:58 +02:00
Martin Braun
ab724a30ec cmake: Enable usage of UHD:: module
Instead of relying on CMake variables like ${UHD_LIBRARIES}, downstream
projects can now use the UHD::uhd target to link against UHD.
2025-09-24 11:35:24 +02:00
Martin Braun
c45c296d8f cmake: Remove Boost::system from component list
This has multiple reasons:

- We use CMake's FindBoost
  (https://cmake.org/cmake/help/v3.12/module/FindBoost.html) which can
  resolve dependencies itself. We only use boost::system in tandem with
  Boost::asio, which we already list as a dependency.
- There are combinations of CMake versions and Boost versions, where
  specifying this will link against the stub library of Boost::system
  (this is a header-only library since Boost 1.69). Removing it from the
  list avoids any kind of linkage.

Note that UHDBoost.cmake has some compatibility hacks for Boost::system,
which we now also remove.
2025-09-24 11:35:07 +02:00
Martin Braun
402f3d6f4e cmake: More specifically reference linking dependencies
- Instead of blindly linking against all ${Boost_LIBRARIES}, we
  selectively specify the various Boost::* targets.
- Replace include_directories() or link_directories() with target_*()
  CMake functions to avoid cluttering global scope.
- Specify PRIVATE vs. PUBLIC on all link targets.
2025-09-17 12:56:05 +02:00
Jakob Kukla
ba40e9ab2d cmake: support absolute paths for install dirs in pkg-config
The GNUInstallDirs module supports absolute paths for
CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR. Some package managers
like Nix depend on this behaviour.
See https://github.com/NixOS/nixpkgs/issues/144170 for the nixpkgs
tracking issue.
2025-09-17 12:55:43 +02:00
Aki Tomita
9018f578b2 cmake: Adjust the UHD_VERSION check to work with cmake 4.1
UHD_VERSION needs to be also checked against an empty string
since cmake 4.1 sets this variable during project setup, also
if it was undefined before. Furthermore we need to backup and
restore custom UHD_VERSION when defined for e.g. by using option
-DUHD_VERSION=<version>, because project() setup will reset the
version to an empty string.
2025-08-22 16:18:42 +02:00
Martin Braun
c5a56ce822 cmake: Add ENABLE_RFNOC_DEV target
With -DENABLE_RFNOC_DEV=ON (the default is OFF), the HDL sources for
building RFNoC blocks and RFNoC images through rfnoc_image_builder are
now also installed into $PREFIX/share/uhd/rfnoc/fpga/usrp3. This re-uses
the existing share/uhd/rfnoc/fpga directory.

This commit also includes a Python script that copies the fpga/usrp3
directory into a staging directory inside the build dir. The
installation happens from the staging directory, not the fpga/usrp3
directory itself. This allows us to filter the usrp3 source dir without
having to use highly verbose CMake for that.

The uhd-host Debian install file is also modified so that the RFNoC
sources are not packaged into the uhd-host package.
2025-07-17 15:29:54 +02:00
Martin Braun
4a5690d59b cmake: Install UHDUnitTest.cmake
This can be used by RFNoC OOTs.
2025-07-15 11:33:08 +02:00
Martin Braun
f33195843b cmake: Remove reference to UHD_RFNOC_FOUND
This is a vestage from the UHD-3 era, where RFNoC was optional. To
reduce confusion, we remove the CMake variable UHD_RFNOC_FOUND, although
we leave it in UHDConfig.cmake for not breaking 3rd party applications.
2025-05-05 08:49:39 +02:00
Martin Braun
6a4a1650aa cmake: Use GNUInstallDirs instead of hand-crafted code
The UHD CMake code re-implemented some of the features of GNUInstallDirs,
which is not necessary (this feature has been available in CMake for
longer than version 3.12). Here, we replace all hand-defined CMake
variables with their equivalents from GNUInstallDirs.

Short table of replacements:

INCLUDE_DIR   -> CMAKE_INSTALL_INCLUDEDIR
RUNTIME_DIR   -> CMAKE_INSTALL_BINDIR
LIBRARY_DIR   -> CMAKE_INSTALL_LIBDIR
UHD_LIB_DIR   -> CMAKE_INSTALL_LIBDIR
LIB_SUFFIX    -> n/a (no longer necessary)
2025-04-30 15:56:11 +02:00
nzqo
8f92754ca1 cmake: Improve formatting, comments and Apple DPDK support
- Newer versions of cmake do not set install_name, so we need to do it
  ourselves.
- Made Boost a system dependency to suppress compiler warnings from it.
2025-02-20 09:47:01 +01:00
Lars Amsel
8461b905e5 cmake: Set build type before package find
Packages may use the build type to decide whether to look for
release or debug binaries. It is therefore cruicial to set the
build type before searching any package.
2025-01-27 15:58:15 +01:00
Marian Koop
57ef1fb88c cmake: Extend Windows Installer w libusb dll & erllc_uhd_winusb_driver
Simplifying the Windows installer experience by reducing the
number of individual downloads from 4 (for USB devices) to 2.
Including the libusb.dll into the installer will remove a common
onboarding error.
This change introduces a now, optional cmake feature called
-DENABLE_EXTEND_WIN_PACKAGING=ON, that defaults to off.
Enabling this feature will cause a number of convenience components
to be included into the windows deployment package (aka. installer).
Enabling this feature has no effect on other platforms.
The changes to the NSIS itself are trivial and limited to another
license dialog (for libusb redistribution). Most changes were in
the cmake code used by cpack (for which NSIS is the utilized Windows
cpack generator option).
These additional components now controlled via the feature
component are currently:
- incl. of MSVC Runtime binaries into ${RUNTIME_DIR}
- incl. of libusb.dll into ${RUNTIME_DIR}
- incl. of erllc_uhd_winusb_driver into ${PKG_DATA_DIR}/usbdriver
2024-12-13 15:51:56 +01:00
Martin Braun
3ae44b1d96 cmake: Bump minimum CMake from 3.8 to 3.12 2024-12-10 08:36:00 +01:00
Lars Amsel
ab85b85672 cmake: Enable Python API support only if min version is satisfied. 2024-12-09 08:16:10 +01:00
Martin Braun
bfd2312c12 cmake: Increase C++ standard to 17 2024-10-21 17:42:57 +02:00
Martin Braun
38b89ae965 cmake: Make UHDPython.cmake available to OOTs
This installs UHDPython.cmake to lib/uhd/, so that OOT RFNoC modules can
use it (and don't have to use a version that ships with the OOT). This
makes maintanance of that file a lot easier.

Now that this file can (and should) be used outside of UHD, we
"namespace" the macros and functions by prefacing them with 'UHD_'
(e.g., there's now UHD_PYTHON_CHECK_MODULE).

This file requires creating UHDMinDepVersions.cmake, which also gets
installed.
2024-09-02 08:22:58 +02:00
Marian Koop
1d1226f768 python: pybind: Bump min pybind11 version to 2.7 (default on Ubuntu 22)
This will result into use of the in-tree version on Ubuntu 20,
and address an observed crash during object cleanup at program
shutdown that was only observed on Ubuntu 20. This restores the
behavior earlier UHD version to use the in-tree pybind11 module
for Ubuntu 20.
Also corrected some logic determining when the in-tree module
was used to avoid that both a public and our in-tree modules are
part of the INCLUDE_DIRS.
2024-06-11 10:20:08 +02:00
Martin Anderseck
1bd7e1ed8f cmake: Change ENABLE_PYMOD_UTILS default to ON
While 'Python Module (Utils only)' is a subset only of the Python API
'uhd' module for conveniently installing some Python utils only, to the
user it may look like they are missing something if the output of cmake
states that 'Python Module (Utils only)' is not in the enabled
components list by default. This commit changes the default from OFF to
ON.
2024-02-26 14:05:01 -06:00
Martin Braun
56c1a7c63b cmake: Add ENABLE_PYMOD_UTILS option, fix venv
This options allows to install Python utils, including a subset of the
Python API 'uhd' module, without having to compile UHD. The main reason
to do this is to allow installing the RFNoC image builder without the
rest of UHD. To achieve this, run cmake as such:

    cmake /path/to/uhd -DENABLE_LIBUHD=OFF -DENABLE_PYMOD_UTILS=ON

You might also want to disable building the manual in this case.

The refactoring required to enable this also fixes an issues when
installing UHD from source into a venv.  This updates the CMake to use
pip3 to install the module, fixing some warnings and install issues.
2024-02-19 21:12:01 -06:00
Martin Braun
2233b8d05e cmake: Update UHDPython.cmake
- Use find_package(pybind11) to find a system-wide Pybind11. This will
  take preference over the vendored version of Pybind11, unless
  requested otherwise.
- Fix a typo.
2024-02-14 21:53:16 -06:00
Martin Braun
6a67dc6eb7 uhd: Bump minimum Python version to 3.7 2024-02-10 16:14:22 -06:00
Martin Braun
9f4baf0a19 host: Bump minimum gcc version to 7.3.0 2023-05-07 19:28:19 -05:00
mattprost
6ac34b3a9e cmake: Add support for fedora rpm versioning
Adds cmake option for replacing dashes in the UHD Component version with
underscores. This is necessary as Fedora package management is now
enforcing the format <Package>-<Version>-<Release> for all rpm builds,
so dashes in the UHD_VERSION from dev branches is not supported.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-29 12:55:40 -07:00
Aaron Rossetto
6d746fd296 cmake: Replace distutils with CMake for version checks
This commit replaces the use of distutils.version.LooseVersion() with
CMake's version comparison operator, which implements relational version
string checking in the same manner (i.e., comparing numeric components
of a version string numerically).
2022-01-14 14:36:39 -06:00
Steven Koo
2ff98cf43c cmake: Set debug to -Og for Clang builds
This fails to link otherwise on macOS

Signed-off-by: Steven Koo <steven.koo@ni.com>
2022-01-06 15:10:53 -06:00
Lars Amsel
01d81c7fa5 cmake: use LooseVersion to ensure correct version comparisons
current implementation uses version strings for comparisons. This led
version 3.10 to be smaller than 3.6 which is obviously wrong. Use
LooseVersion to have correct version comparison.
2021-10-14 11:03:10 -07:00
Martin Braun
09d94529e5 cmake: Replace CMAKE_{SOURCE,BINARY}_DIR with UHD_*_DIR
See the CMake 3.8 documentation on these two variables:
https://cmake.org/cmake/help/v3.8/variable/PROJECT-NAME_SOURCE_DIR.html
https://cmake.org/cmake/help/v3.8/variable/CMAKE_SOURCE_DIR.html

Under normal circumstances, these two are identical. For sub-projects
(i.e., when building UHD as part of something else that is also a CMake
project), only the former is useful. There is no discernible downside of
using UHD_SOURCE_DIR over CMAKE_SOURCE_DIR.

This was changed using sed:

$ sed -i "s/CMAKE_SOURCE_DIR/UHD_SOURCE_DIR/g" \
    `ag -l CMAKE_SOURCE_DIR **/{CMakeLists.txt,*.cmake}`
$ sed -i "s/CMAKE_BINARY_DIR/UHD_BINARY_DIR/g" \
    `ag -l CMAKE_BINARY_DIR **/{CMakeLists.txt,*.cmake}`

At the same time, we also replace the CMake variable UHD_HOST_ROOT (used
in MPM) with UHD_SOURCE_DIR. There's no reason to have two variables
with the same meaning and different names, but more importantly, this
means that UHD_SOURCE_DIR is defined even in those cases where MPM calls
into CMake files from UHD without any additional patches.

Shoutout to GitHub user marcobergamin for bringing this up.
2021-09-10 15:08:10 -05:00
Steven Koo
699982eef8 cmake: Fix VS names and use relative for images
cmake has newer variables to identify specific Visual Studio version.
This change updates to use those. This also changes how images
files are globbed to be relative paths, which is useful if build files
are moved from machine to machine. This case is possible in Azure
Pipeline's CI.

Signed-off-by: Steven Koo <steven.koo@ni.com>
2021-08-04 15:22:12 -05:00
Aaron Rossetto
ccb9f60fe5 uhd: Update minimum version of dependencies
The minimum version of the following dependencies have been updated for
UHD 4.1:

  * GCC: 5.4.0 --> 6.3.0
  * Clang: 3.8.0 --> 6.0.0
  * Apple Clang: 600 --> 800
  * Python: 3.5 --> 3.6
  * Boost: 1.58 --> 1.65
2021-06-28 13:44:25 -05:00
Joerg Hofrichter
233fc368a3 cmake: tests: Support qemu also for python based tests
This requires python3 to be installed in the target sysroot
2020-08-04 07:38:40 -05:00
Joerg Hofrichter
e08830cbe5 cmake: tests: Added option to use QEMU for running unittests
This is useful when cross-compiling UHD for other architectures like arm or
aarch64.
2020-06-25 13:32:14 -05:00
Aaron Rossetto
1a00949b19 Revert "host: cmake: add boost unit_test_framework required iff ENABLE_TESTS=ON"
This reverts commit 93acdfe380.

The commit introduced an issue when building without specifying
ENABLE_TESTS explicitly to CMake.

Normally, if the user doesn't set ENABLE_TESTS, it gets set to ON by
default, assuming the prerequisites are met. However, there's a
chicken-and-egg problem here. UHDBoost.cmake takes the list of required
Boost components from UHD_BOOST_REQUIRED_COMPONENTS and adds them to the
Boost_LIBRARIES list. This happens before ENABLE_TESTS gets a default
value, so the Boost unit test framework library is never added to this
list, even if ENABLE_TESTS ends up getting set to ON later on by default
in the script.

But, moving LIBUHD_REGISTER_COMPONENT (the macro that sets ENABLE_TESTS
to a default value) to go before UHDBoost.cmake is included won't work,
because that macro needs variables set by UHDBoost.cmake.

It may be possible to break the circular dependency by refactoring
UHDBoost.cmake somewhat, but for the time being, master shouldn't be
broken.
2020-05-01 15:07:01 -05:00
Gwenhael Goavec-Merou
93acdfe380 host: cmake: add boost unit_test_framework required iff ENABLE_TESTS=ON 2020-04-29 15:06:23 -05:00
Martin Braun
a01dd2da5b Revert "cmake: Add ability to pass CXXFLAGS to CMake environment"
This reverts commit 49ca8112c2.
2020-04-15 14:57:27 -05:00
Ajith Saya
49ca8112c2 cmake: Add ability to pass CXXFLAGS to CMake environment
CMAKE_CXX_FLAGS will now respect $CXX_FLAGS.
2020-04-02 13:08:46 -05:00
Martin Braun
1383fde345 uhd: paths: Harmonize around XDG Base Directory specification
Up until now, we completely ignore the XDG specification.

This commit does the following to change that:

- It uses XDG_DATA_HOME and XDG_CONFIG_HOME for cal and config data,
  respectively.
- If config data is in ~/.uhd/uhd.conf, that is still accepted, but if
  it conflicts with $XDG_CONFIG_HOME/uhd.conf, it is ignored and a
  warning is displayed
- The default location for cal data is thus ${HOME}/.local/share/uhd/cal
  on Unix, and %LOCALAPPDATA%\uhd\cal on Windows. This is a change in
  location!
- The UHD_CONFIG_DIR environment variable was confusingly named and is
  now removed. It provided an alternative location than the home
  directory. The same purpose is now much better served by XDG_DATA_HOME
  and XDG_CONFIG_HOME.

The specification can be found here:
specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
2020-04-02 12:36:20 -05:00
Martin Braun
6f96639d25 cmake/doxygen: Fix FPGA manual post-FPGA-merge
While merging the FPGA code into the UHD codebase, the manual building
process was not modified, resulting in either a link to the website
instead of building the FPGA manual as part of the rest, or by using a
residual submodule.
2020-02-06 08:45:27 -06:00
Martin Braun
f773cf9fb9 uhd: Replace boost::regex with std::regex
boost::regex was a requirement until the minimum version of gcc was
increased. Since it is at version 5.3 now, using Boost.Regex is no
longer necessary.
This change is a pure search-and-replace; Boost and std versions of
regex are compatible and use the same syntax.
2019-11-26 12:21:32 -08:00
Martin Braun
7d69dcdcc3 Remove proto-RFNoC files
This commit removes all files and parts of files that are used by
proto-RFNoC only.

uhd: Fix include CMakeLists.txt, add missing files
2019-11-26 12:16:25 -08:00
Lars Amsel
914fbdbcb2 rfnoc: Add a new builder script for FPGA images based on eRFNoC.
The builder has two major jobs:
 * generate an image core file which reflects the FPGA image
   configuration given by the user
 * invoke Xilinx toolchain to actually build the FPGA image

For this purpose it needs to know where to find the FPGA source tree.
This tree can be give by the -F option.

The code that represents the user configurable part of the image is
written to a file called <device>_rfnoc_sandbox.v. To generate the file
these configuration files are needed:
 * io_signatures.yml: A file describing the known IO signatures. This file
                      is global for all devices and contains the superset
                      of all signatures (not all signatures are used by all
                      devices). It resides in usrp3/top/ of the tree given
                      by -F.
* bsp.yml: A file describing interfaces of a specific device such as AXIS
           transport interfaces or IO ports as well as device specific
           settings. It resides in usrp3/top/<device> of the tree given by -F.
* <image>.yml: a file provided by the user with freely chosen name.
               It describes which elements the image should contain
               (RFNoC blocks, streaming endpoints, IO ports) and how
               to connect them. The file also contains image setting
               such as the CHDR width to be used.

The script uses mako templates to generate the sandbox file. Before the
template engine is invoked sanity checks are executed to ensure the
configuration is synthactic correct. The script also build up structures
to ease Verilog code generation in the template engine. The engine should
not invoke more Python than echoing variables or iterating of lists or
dictionaries. This eases debugging as errors in the template engine are
hard to track and difficult to read for the user.

All Python code is placed in a package called rfnoc. The templates used
by the builder are also part of this package. image_builder.py contains
a method called build_image which is the main entry point for the builder.
It can also be utilized by other Python programs. To align with the
existing uhd_image_builder there is also a wrapper in bin called
rfnoc_image_builder which expects similar commands as the uhd_image_builder.

For debugging purpuse the script can be invoked from host/utils using
$ PYTHONPATH=. python bin/rfnoc_image_builder <options>

When installed using cmake/make/make install the builder installs to
${CMAKE_INSTALL_PREFIX}bin and can be invoked without specifying a
PYTHONPATH.

One can also install the package using pip from host/utils
$ pip install .

Image config generation can also be done from  GNU Radio Companion
files. The required GRC files are merged into gr-ettus.

Example usage:

$ rfnoc_image_builder -F ~/src/fpgadev -d x310 \
    -r path/to/x310_rfnoc_image_core.grc \
    -b path/to/gr-ettus/grc

Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Martin Braun <martin.braun@ettus.com>
2019-11-26 11:49:32 -08:00
Martin Braun
9b0702c546 cmake: Bump dependency versions for UHD 4.0.0.0
- Boost >= 1.58
- CMake >= 3.5.1
- gcc >= 5.4.0
- Clang >= 3.8, AppleClang >= 600
- Python >= 3.5 (Py2k no longer supported)
- Numpy >= 1.11
- C++14 for lib, include may now use C++11 constructs.
  - Because there is no more code requiring C++03 syntax, we remove the
    include-specific clang-format file
2019-11-26 11:49:08 -08:00
Michael Dickens
90f8cbc12f cmake: add UHDBoost.cmake and use it for building UHD
Also install UHDBoost.cmake along with the CMake UHD find scripts, so
that it can be used by external modules. Tweak the UHDConfig.cmake
script so that, once installed, the new UHDBoost.cmake script is found.
Note that the project using UHD must first find UHD before trying to find
Boost. Also note that if the C++ standard is not set before UHDBoost is
loaded, it will be set to that currently used by UHD: C++14.
2019-10-15 11:24:48 -07:00
Michael Dickens
c568804fbe cmake: allow setting of PKG_DOC_DIR from the CMake commandline 2019-10-09 14:38:08 -07:00
Martin Braun
f83faf28b3 cmake: Remove ENABLE_PYTHON3 flag and simplify Python detection
- Makes use of more modern find_package(Python2/3) if available
- Moves almost all Python-related code to UHDPython.cmake
- ENABLE_PYTHON3 is no longer necessary
2019-05-24 14:17:13 -07:00
Martin Braun
d2acf841f3 cmake: Change default value for ENABLE_RFNOC to ON
This means that by default:
- Symbols get exported
- Headers get installed
- Examples get compiled

The switch still exists and can be disabled.
2019-05-23 08:46:59 -07:00