Commit graph

45 commits

Author SHA1 Message Date
Ryan Volz
14d9452a15 utils: Fix prefix determination in get_lib_path()
get_lib_path() uses the libuhd location on disk to dynamically
determine the installation prefix at runtime. This fix normalizes the
libuhd path before any path operations are done to extract the library
directory and then prefix directory.

Previously, using a non-normalized library path, the returned prefix
directory would be incorrect in some cases (e.g. when loaded through
GNU Radio). In these error cases, the libuhd path would be
  $PREFIX/lib/./libuhd.so
(with a no-op /. inserted) which would result in a technically correct
library directory of `$PREFIX/lib/.` but an incorrect prefix directory
of `$PREFIX/lib`.

With the normalization fix, the libuhd path is corrected to
  $PREFIX/lib/libuhd.so
and the subsequent path manipulation to get the library and prefix
directories will work as intended.
2020-07-13 13:06:04 -07: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
a1f9619469 uhd: cal: Use usrp::cal::database instead of CSV files
Now that we have cal::iq_cal and cal::database, there's no need to
manually wrangle CSV files for calibration data. This commit replaces
all CSV operations with cal::database calls and uses cal::iq_cal as
a container.

CSV files can still be read, but are considered deprecated.
2020-04-02 11:55:17 -05:00
Martin Braun
8055879242 uhd: paths: Add get_cal_data_path() API call
This points to the location where cal data is stored.
2020-03-26 07:46:03 -05:00
Martin Braun
876d4150aa uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
2020-03-03 08:51:32 -06:00
Ryan Volz
965ad05279 lib: utils: Don't use hard-coded path constants
This replaces the package path constant with a runtime library path
lookup. The package path is taken to be the parent directory of the
library directory.

When boost >= 1.61 is not available, this maintains the current behavior
of using CMake to set path contants.

Runtime path determination is preferable for making a relocatable
library so that it is not necessary to do string substitution on
relocated binaries (as with, for example, building a conda package).
2020-02-07 09:12:56 -06:00
Martin Braun
d3a16b7022 uhd: Replace all occurrences of boost::bind with std::bind
Note: Replacing everything with a lambda would be even better, but that
can't be easily scripted so we'll do this as a first step to reduce the
Boost footprint.

This also removes occurences of #include <boost/bind.hpp>, and makes
sure all usages of std::bind have an #include <functional>. clang-format
wasn't always applied to minimize the changeset in this commit, however,
it was applied to the blocks of #includes.

Due to conflicts with other Boost libraries, the placeholders _1, _2,
etc. could not be directly used, but had to be explicitly called out
(as std::placeholders::_1, etc.). This makes the use of std::bind even
uglier, which serves as another reminder that using std::bind (and even
more so, boost::bind) should be avoided.

nirio/rpc/rpc_client.cpp still contains a reference to boost::bind. It
was not possible to remove it by simply doing a search and replace, so
it will be removed in a separate commit.
2019-11-26 12:21:32 -08: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
a99e89a689 lib: Add path_expandvars() internal API call 2018-02-20 16:23:46 -08:00
Martin Braun
ae5211d71d uhd: Update license headers
All copyright is now attributed to "Ettus Research, a National
Instruments company".

SPDX headers were also updated to latest version 3.0.
2018-02-19 16:54:52 -08:00
Martin Braun
4f948e2c8b Move all license headers to SPDX format. 2017-12-22 10:45:51 -08:00
Andrej Rode
26cc20847c uhd: replace BOOST_FOREACH with C++11 range-based for loop
Note: This is the first commit that uses for-range, and range-based
for-loops are now usable for UHD development.
2017-02-10 16:44:33 -08:00
Ashish Chaudhari
1c2f56bbc1 Merge branch 'maint'
Conflicts:
	host/lib/usrp/cores/gpio_core_200.cpp
	host/lib/usrp/dboard/db_ubx.cpp
2016-02-18 17:40:47 -08:00
vkakade
83c1493e03 Rectified the usage of UHD_IMAGES_DIR_WINREG_KEY in search paths. 2016-02-11 08:47:05 -08:00
Martin Braun
17712af3b8 Merge branch 'maint' 2016-01-21 20:49:28 +01:00
Brooks Prumo
23ed1af481 uhd: add CMake flag for the Windows registry key to specify UHD images directory 2016-01-21 20:39:35 +01:00
Martin Braun
4dd7cea6e0 cmake: Proper selection of files for ENABLE_X300 2015-10-26 16:56:04 -07:00
Nicholas Corgan
6178184c93 paths: consistency in usage of string parameters 2015-08-12 08:32:01 -07:00
Nicholas Corgan
290b85a961 Fixed minor warnings 2015-07-24 10:38:15 -07:00
Martin Braun
b3bfba0f3e uhd: Added args arg to print_utility_warning 2015-04-30 10:52:40 -07:00
Ashish Chaudhari
ec7eedcca8 Merge branch 'bhilburn/uhdcalibpath' into maint 2015-02-11 16:33:58 -08:00
Ben Hilburn
08267a8c02 Creating the $UHD_CONFIG_DIR env var, here used for custom cal data storage.
This is a renaming of the previously created $UHDCALIBPATH.
2015-02-11 16:28:35 -08:00
Ben Hilburn
b10c9dd446 uhd::paths - fixing get_app_path to use correct get_env_var function
Also added new enviornment variable, "UHDCALIBPATH", so that users can
use something other than system-required environment paths.
2015-02-10 15:56:50 -08:00
Ben Hilburn
064634b05c uhd::paths: Fixed empty string in error message 2015-02-10 16:18:05 +01:00
Ben Hilburn
75d519706b Merging new UHD_IMAGES_DIR utilities and bug fixes.
Also includes NI-USRP Windows Registry Key fixes.
2015-01-27 16:07:43 -08:00
Ben Hilburn
9e47ad607b Squashed merge of Coverity fixes. 2013-11-27 12:11:23 -08:00
Nicholas Corgan
e6a1de6dd1 paths: get_module_paths adds share/uhd/modules to the list of applicable paths 2013-10-30 09:08:03 -07:00
Michael Dickens
a48dbb654e utils: fix declaration of "env_path_sep" such that it is always initialized before it is used in the "get_env_paths" function, by moving it from the global scope to inside that function. This change allows UHD_STATIC_BLOCK(load_modules) to work correctly. 2013-10-28 20:58:46 -04:00
Josh Blum
6b2a212842 uhd: work on moving binaries to lib/uhd 2012-11-08 18:36:59 -08:00
Josh Blum
98074d0c29 uhd: added uhd::get_pkg_data_path 2012-06-05 17:59:44 -07:00
Josh Blum
8d5dc71d64 uhd: used shared get_tmp_path for logging as well
Moved some of the log.cpp tmp paths smarts into paths as well
2012-05-16 10:59:09 -07:00
Josh Blum
8459432067 usrp: basically working iq cal on tx 2011-11-10 20:22:54 -08:00
Josh Blum
00bc8d50d5 uhd: removed constants.hpp.in, replaced w/ per source compile defines 2011-04-19 16:58:12 -07:00
Josh Blum
06e10b5f46 uhd: use UHD_PKG_DATA_PATH environment variable to override the one in constants
The installer sets UHD_PKG_DATA_PATH, we can can handle transplanted builds.
2011-04-19 14:20:37 -07:00
Josh Blum
291a46b86e uhd: specify the UHD_PKG_DATA_PATH once (since images shipped w/ drivers) 2011-04-14 09:34:37 -07:00
Josh Blum
4357f5d3c0 uhd: replaced instanced of std::exception with the uhd exceptions 2011-02-24 16:35:29 -08:00
Josh Blum
db1fd30da6 uhd: fixed maxosx bug, was resizing the transport buffer
but it cant be resized on macos and I messed up the code that blocked that behavior

reimplemented block in usrp2_impl, seems more correct here
2011-01-26 11:27:25 -08:00
Josh Blum
261bb80d73 uhd: update copyright dates on host code 2011-01-13 16:22:07 -08:00
Josh Blum
771b5cebda uhd: integrated boost split or tokenizer into source files, remove string split from algorithms header 2011-01-06 15:38:56 -08:00
Josh Blum
d99e229719 uhd: added image utils code to search the images paths for image files 2010-08-19 17:10:16 -07:00
Josh Blum
7d110e73e6 uhd: added the concept of installer path (along with local path) for package data 2010-08-16 23:28:37 -07:00
Josh Blum
7b084e3af2 uhd: use cmake to convert the pkg data dir to native system format 2010-08-15 12:18:35 -07:00
Josh Blum
805d4a0cff uhd: made split string utility function 2010-08-12 10:08:17 -07:00
Josh Blum
836c6bcda0 uhd: avoid segfaults - use CPP macros for paths and dont split empty string 2010-08-11 21:13:34 -07:00
Josh Blum
2a87970a9c uhd: created library code to handle paths for images and modules
- read from environment variable paths
- utility functions to get paths and search for images
- modified load modules to call the utility functions
- added private header constants.hpp to contain cmake variables of interest
- modified version.cpp to use this constants file
2010-08-09 11:24:08 -07:00