Commit Graph

12 Commits

Author SHA1 Message Date
Martin Anderseck
1af4625e84 cmake: Enable Ubuntu 26.04
These changes are required to build on Ubuntu 26.04 cleanly while still
maintaining backwards compatibility until Ubuntu 22.04.

- Set CMP0167 to NEW in UHD CMake paths that resolve Boost
- Scope policy changes with guard checks so older CMake versions remain
  compatible
- Ensure dependency resolution order applies policy before Boost
  discovery in package config
- Reduce CMake 3.30+ FindBoost policy warnings without breaking Ubuntu
  22.04-era toolchains
2026-08-03 12:55:00 +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
c65e7b7178 cmake: Use NEW policy CMP0167 when using cmake 3.30 or later.
Enable NEW cmake policy CMP0167 that stops using the depreciated FindBoost
module and rely in upstream BoostConfig.cmake configuration files.
This may also avoid conflicts between upstream BoostConfig.cmake configuration
files and the depreciated, legacy implementation in FindBoost.
2026-04-13 16:47:52 +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
Henrik Eriksson
966760f7a6 cmake: Add MinGW support
- Explicitly link to mswsock for MinGW instead of linking against
  thread_win32
2026-03-03 09:25:23 +01: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
170f1133e5 cmake: Remove Boost version hacks from UHDBoost
Our internal helper UHDBoost.cmake includes several hacks for Boost
version compatibility. Now that we require at least Boost 1.71, these
hacks are just clutter and can be removed.
2025-09-24 11:35:07 +02:00
Martin Braun
3c6df18579 cmake: Fix Boost settings for static builds
Building static libraries with UHD was broken due to the way that
UHDBoost was structured. The following changes to UHDBoost.cmake were
applied:

- This file no longer observes ENABLE_STATIC_LIBS. That's because in UHD,
  setting ENABLE_STATIC_LIBS is supposed to build both static and shared
  libraries, but the way UHDBoost.cmake was written, it would apply
  settings for static builds to all libraries. If ENABLE_STATIC_LIBS was
  set, then this would cause linker errors.
  - As a consequence, users of UHDBoost.cmake must specify
    Boost_USE_STATIC_LIBS manually before including it.
- BUILD_SHARED_LIBS is no longer modified. UHD always specifies the
  correct library modifier (SHARED, STATIC, etc.) directly in the
  add_library() call, and that is good practice. By overriding
  BUILD_SHARED_LIBS in UHDBoost.cmake, this file can make changes to
  CMake files that call add_library() without a modifier.

In host/lib/CMakeLists.txt, we now call UHDBoost a second time for
static builds but set Boost_USE_STATIC_LIBS beforehand. This allows to
specify linker targets for the static library independently from the
shared library.

We also factored out some common library property manipulations that are
shared between uhd and uhd_static.
2025-09-18 15:38:01 +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
Martin Braun
3e97df7a80 cmake: uhdboost: Fix check for UHD_BOOST_REQUIRED being set
Previously, applying `-DUHD_BOOST_REQUIRED` to the cmake command line
would do nothing. Now, it is possible to skip Boost checking, e.g., to
only build the manual by calling

    cmake -DUHD_BOOST_REQUIRED=OFF -DENABLE_LIBUHD=OFF
2022-01-26 14:48:46 -06:00
Steven Koo
9aafc0ace2 uhd: enable vcpkg support on windows
vcpkg can be used for the Windows C++ dependencies for uhd with this commit.

To use vcpkg on Windows:
1) Copy the custom triplets in host/cmake/vcpkg/ to the vcpkg/triplets/ folder.
2) Install boost and libusb for the custom triplet

"vcpkg install libusb:uhd-x64-windows-static-md boost:uhd-x64-windows-static-md"

3) Call CMake with vcpkg toolchain file flags:
-DVCPKG_TARGET_TRIPLET=uhd-x64-windows-static-md
-DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALL_DIR%/scripts/buildsystems/vcpkg.cmake
-G "Visual Studio 16 2019" -A x64

Replace the -G with the installed version of Visual Studio and matching
architecture. Then build normally by running vcvarsall.bat and msbuild.

Signed-off-by: Steven Koo <steven.koo@ni.com>
2021-03-19 15:40:09 -05: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