diff options
| author | Martin Braun <martin.braun@ettus.com> | 2015-01-28 22:10:10 +0100 | 
|---|---|---|
| committer | Martin Braun <martin.braun@ettus.com> | 2015-01-28 22:10:10 +0100 | 
| commit | db3fac73beb30ceaaf6a275d9668a38af3b839f5 (patch) | |
| tree | d0713571a7a4d14d38c4d6c59337e6fbfca1f4a1 /host/include | |
| parent | 156c21206e8bccf4b5680a62c28a7dc7544aa9be (diff) | |
| parent | 75d519706b9b0956307a6a4bdc53c36376f19f03 (diff) | |
| download | uhd-db3fac73beb30ceaaf6a275d9668a38af3b839f5.tar.gz uhd-db3fac73beb30ceaaf6a275d9668a38af3b839f5.tar.bz2 uhd-db3fac73beb30ceaaf6a275d9668a38af3b839f5.zip  | |
Merge paths-fix branch into maint.
Diffstat (limited to 'host/include')
| -rw-r--r-- | host/include/uhd/config.hpp | 12 | ||||
| -rw-r--r-- | host/include/uhd/transport/nirio/nifpga_lvbitx.h | 2 | ||||
| -rw-r--r-- | host/include/uhd/utils/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | host/include/uhd/utils/images.hpp | 53 | ||||
| -rw-r--r-- | host/include/uhd/utils/paths.hpp | 58 | 
5 files changed, 70 insertions, 56 deletions
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp index 619bd0787..7ecc4924a 100644 --- a/host/include/uhd/config.hpp +++ b/host/include/uhd/config.hpp @@ -92,4 +92,16 @@ typedef ptrdiff_t ssize_t;      #define UHD_PLATFORM_BSD  #endif +// Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes +// variable arguments so that it can deal with strings that contain commas. +// There are two different versions because MSVC handles this syntax a bit +// differently than other compilers. +#if defined(BOOST_MSVC) +    #define XSTR(x,...) #x +#else +    #define XSTR(x...) #x +#endif + +#define STR(x) XSTR(x) +  #endif /* INCLUDED_UHD_CONFIG_HPP */ diff --git a/host/include/uhd/transport/nirio/nifpga_lvbitx.h b/host/include/uhd/transport/nirio/nifpga_lvbitx.h index 598f7fcbe..f037ffd47 100644 --- a/host/include/uhd/transport/nirio/nifpga_lvbitx.h +++ b/host/include/uhd/transport/nirio/nifpga_lvbitx.h @@ -51,8 +51,8 @@ public:  protected:      std::string _get_bitstream_checksum(const std::string& file_path); -    std::string _get_fpga_images_dir(const std::string search_paths);  }; +  }}  #endif /* INCLUDED_UHD_TRANSPORT_NIRIO_NIFPGA_LVBITX_H */ diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt index c308c9cde..05f6892d2 100644 --- a/host/include/uhd/utils/CMakeLists.txt +++ b/host/include/uhd/utils/CMakeLists.txt @@ -25,7 +25,6 @@ UHD_INSTALL(FILES      cast.hpp      csv.hpp      gain_group.hpp -    images.hpp      log.hpp      math.hpp      msg.hpp diff --git a/host/include/uhd/utils/images.hpp b/host/include/uhd/utils/images.hpp deleted file mode 100644 index a0934fb08..000000000 --- a/host/include/uhd/utils/images.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright 2010,2012 Ettus Research LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program.  If not, see <http://www.gnu.org/licenses/>. -// - -#ifndef INCLUDED_UHD_UTILS_IMAGES_HPP -#define INCLUDED_UHD_UTILS_IMAGES_HPP - -#include <uhd/config.hpp> -#include <string> - -namespace uhd{ - -    /*! -     * Search for an image in the system image paths: -     * Search compiled-in paths and environment variable paths -     * for a specific image file with the provided file name. -     * \param image_name the name of the file -     * \return the full system path to the file -     * \throw exception if the image was not found -     */ -    UHD_API std::string find_image_path(const std::string &image_name); - -    /*! -     * Search for the location of the UHD Images Downloader script. -     * \return the full system path to uhd_images_downloader.py -     */ - -    UHD_API std::string find_images_downloader(void); - -    /*! -     * Return the error string for recommending using the UHD Images Downloader. -     * String depends on OS. -     * \return the message suggesting the use of uhd_images_downloader.py -     */ - -    UHD_API std::string print_images_error(void); - -} //namespace uhd - -#endif /* INCLUDED_UHD_UTILS_IMAGES_HPP */ diff --git a/host/include/uhd/utils/paths.hpp b/host/include/uhd/utils/paths.hpp index e0f455e92..8edb87546 100644 --- a/host/include/uhd/utils/paths.hpp +++ b/host/include/uhd/utils/paths.hpp @@ -19,9 +19,15 @@  #define INCLUDED_UHD_UTILS_PATHS_HPP  #include <uhd/config.hpp> + +#include <boost/filesystem.hpp> +  #include <string> +#include <vector> -namespace uhd{ +namespace fs = boost::filesystem; + +namespace uhd {      //! Get a string representing the system's temporary directory      UHD_API std::string get_tmp_path(void); @@ -32,6 +38,56 @@ namespace uhd{      //! Get a string representing the system's pkg directory      UHD_API std::string get_pkg_path(void); +    //! Get UHD library paths +    std::vector<fs::path> get_module_paths(void); + +    /*! Return the UHD images directory path. +    * +    * This function returns the UHD images installation path on this system. The +    * returned directory path is guaranteed to exist (assuming a valid path is +    * found). This function will look for a directory that exists using this +    * order of precedence: +    * +    *   1) `UHD_IMAGES_DIR` environment variable +    *   2) Any paths passed to this function via `search_paths' +    *   3) UHD package path / share / uhd / images +    * +    * The `search_paths` parameter may contain Windows registry keys.  If no +    * directory is found, an empty string is returned. +    * +    * \param search_paths A comma-separated list of hints for paths to include. +    * \returns A path string if one is found, or an empty string on failure. +    */ +    UHD_API std::string get_images_dir(const std::string search_paths); + +    /*! Return the full path to particular UHD binary image. +     * +     * This function searches for the passed image name, and returns an absolute +     * path to it. The returned path is guaranteed to exist. The caller can also +     * provide a full path to the image in the argument, and this function will +     * validate it and convert it to an absolute system path. +     * +     * \param image_name The name of the file to search for, or the full path. +     * \param search_paths Hints / paths to use when calling `get_images_dir` +     * \return the full system path to the file +     * \throw exception uhd::io_error if the file was not found. +     */ +    UHD_API std::string find_image_path(const std::string &image_name, const std::string search_paths = ""); + +    /*! +     * Search for the location of a particular UHD utility. +     * The utility must be installed in the `uhd/utils` directory. +     * \param the name of the utility to search for +     * \return the full system path to @param +     */ +    UHD_API std::string find_utility(std::string name); + +    /*! +     * Return an error string recommending the user run the utility. +     * The error string will include the full path to the utility to run. +     * \return the message suggesting the use of the named utility. +     */ +    UHD_API std::string print_utility_error(std::string name);  } //namespace uhd  #endif /* INCLUDED_UHD_UTILS_PATHS_HPP */  | 
