aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2015-12-18 12:17:53 -0800
committerMartin Braun <martin.braun@ettus.com>2015-12-30 14:23:05 -0800
commitf4656fcb7b4a60cb603ce90abac8266a7e47ec7f (patch)
tree3be67568b7a185ab9419a187a8ddbef26931857f /host/utils
parentdb9ebd80dd0d675b2018f1ac504745e9bd110cd9 (diff)
downloaduhd-f4656fcb7b4a60cb603ce90abac8266a7e47ec7f.tar.gz
uhd-f4656fcb7b4a60cb603ce90abac8266a7e47ec7f.tar.bz2
uhd-f4656fcb7b4a60cb603ce90abac8266a7e47ec7f.zip
Added uhd_config_info utility
Diffstat (limited to 'host/utils')
-rw-r--r--host/utils/CMakeLists.txt1
-rw-r--r--host/utils/uhd_config_info.cpp89
2 files changed, 90 insertions, 0 deletions
diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt
index 9ab95596d..bf8d88799 100644
--- a/host/utils/CMakeLists.txt
+++ b/host/utils/CMakeLists.txt
@@ -19,6 +19,7 @@
# Utilities that get installed into the runtime path
########################################################################
SET(util_runtime_sources
+ uhd_config_info.cpp
uhd_find_devices.cpp
uhd_usrp_probe.cpp
uhd_image_loader.cpp
diff --git a/host/utils/uhd_config_info.cpp b/host/utils/uhd_config_info.cpp
new file mode 100644
index 000000000..4279c325d
--- /dev/null
+++ b/host/utils/uhd_config_info.cpp
@@ -0,0 +1,89 @@
+//
+// Copyright 2015 National Instruments Corp.
+//
+// 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/>.
+//
+
+#include <uhd/build_info.hpp>
+#include <uhd/version.hpp>
+#include <uhd/utils/safe_main.hpp>
+
+#include <boost/format.hpp>
+#include <boost/program_options.hpp>
+
+namespace po = boost::program_options;
+
+int UHD_SAFE_MAIN(int argc, char* argv[]) {
+ // Program Options
+ po::options_description desc("Allowed Options");
+ desc.add_options()
+ ("build-date", "Print build date")
+ ("c-compiler", "Print C compiler")
+ ("cxx-compiler", "Print C++ compiler")
+ ("c-flags", "Print C compiler flags")
+ ("cxx-flags", "Print C++ compiler flags")
+ ("enabled-components", "Print built-time enabled components")
+ ("install-prefix", "Print install prefix")
+ ("libusb-version", "Print libusb version")
+ ("print-all", "Print everything")
+ ("version", "Print this UHD build's version")
+ ("help", "Print help message")
+ ;
+
+ po::variables_map vm;
+ po::store(po::parse_command_line(argc, argv, desc), vm);
+ po::notify(vm);
+
+ // Print the help message
+ if(vm.count("help") > 0) {
+ std::cout << boost::format("UHD Config Info - %s") % desc << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ bool print_all = (vm.count("print-all") > 0);
+
+ if(vm.count("version") > 0 or print_all) {
+ std::cout << "UHD " << uhd::get_version_string() << std::endl;
+ }
+ if(vm.count("build-date") > 0 or print_all) {
+ std::cout << "Build date: " << uhd::build_info::build_date() << std::endl;
+ }
+ if(vm.count("c-compiler") > 0 or print_all) {
+ std::cout << "C compiler: " << uhd::build_info::c_compiler() << std::endl;
+ }
+ if(vm.count("cxx-compiler") > 0 or print_all) {
+ std::cout << "C++ compiler: " << uhd::build_info::cxx_compiler() << std::endl;
+ }
+ if(vm.count("c-flags") > 0 or print_all) {
+ std::cout << "C flags: " << uhd::build_info::c_flags() << std::endl;
+ }
+ if(vm.count("cxx-flags") > 0 or print_all) {
+ std::cout << "C++ flags: " << uhd::build_info::cxx_flags() << std::endl;
+ }
+ if(vm.count("enabled-components") > 0 or print_all) {
+ std::cout << "Enabled components: " << uhd::build_info::enabled_components() << std::endl;
+ }
+ if(vm.count("install-prefix") > 0 or print_all) {
+ std::cout << "Install prefix: " << uhd::build_info::install_prefix() << std::endl;
+ }
+ if(vm.count("boost-version") > 0 or print_all) {
+ std::cout << "Boost version: " << uhd::build_info::boost_version() << std::endl;
+ }
+ if(vm.count("libusb-version") > 0 or print_all) {
+ std::string _libusb_version = uhd::build_info::libusb_version();
+ std::cout << "Libusb version: " << (_libusb_version.empty() ? "N/A" : _libusb_version) << std::endl;
+ }
+
+ return EXIT_SUCCESS;
+}