diff options
author | Marcus Müller <marcus.mueller@ettus.com> | 2015-01-17 13:29:44 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2015-01-17 13:34:19 +0100 |
commit | ae7fe683f042c5c3b519238a15b44ea3104727f5 (patch) | |
tree | 7f121b3101f2a68ca9ed8c8590233efe86a45c9a | |
parent | 6c121388075c9d7624bef832a5dd835da73798cc (diff) |
gnuradio-config-info: Added --enabled-components
Since this should reflect the CMake enabled components,
this entailed generating constants.cc after CMake has been run.
Since the autonomity of the gnuradio-runtime/CMakeLists.txt shouldn't
be reduced, this is done twice; the build-time overhead is minimal.
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | gnuradio-runtime/apps/gnuradio-config-info.cc | 24 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/constants.h | 5 | ||||
-rw-r--r-- | gnuradio-runtime/lib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-runtime/lib/constants.cc.in | 5 |
5 files changed, 33 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 235596bae5..d84fa04420 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,6 +416,13 @@ CONFIGURE_FILE( ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime/include/gnuradio/config.h ) +#Re-generate the constants file, now that we actually know which components will be enabled. +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-runtime/lib/constants.cc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime/lib/constants.cc + ESCAPE_QUOTES +@ONLY) + # Install config.h in include/gnuradio install( FILES diff --git a/gnuradio-runtime/apps/gnuradio-config-info.cc b/gnuradio-runtime/apps/gnuradio-config-info.cc index bccf99f8d9..c91b080039 100644 --- a/gnuradio-runtime/apps/gnuradio-config-info.cc +++ b/gnuradio-runtime/apps/gnuradio-config-info.cc @@ -26,26 +26,29 @@ #include <gnuradio/constants.h> #include <boost/program_options.hpp> +#include <boost/format.hpp> #include <iostream> namespace po = boost::program_options; +using boost::format; int main(int argc, char **argv) { - po::options_description desc("Program options: gnuradio [options]"); + po::options_description desc((format("Program options: %1% [options]") % argv[0]).str()); po::variables_map vm; desc.add_options() ("help,h", "print help message") - ("prefix", "print gnuradio installation prefix") - ("sysconfdir", "print gnuradio system configuration directory") - ("prefsdir", "print gnuradio preferences directory") - ("builddate", "print gnuradio build date (RFC2822 format)") - ("cc", "print gnuradio C compiler version") - ("cxx", "print gnuradio C++ compiler version") - ("cflags", "print gnuradio CFLAGS") - ("version,v", "print gnuradio version") + ("prefix", "print GNU Radio installation prefix") + ("sysconfdir", "print GNU Radio system configuration directory") + ("prefsdir", "print GNU Radio preferences directory") + ("builddate", "print GNU Radio build date (RFC2822 format)") + ("enabled-components", "print GNU Radio build time enabled components") + ("cc", "print GNU Radio C compiler version") + ("cxx", "print GNU Radio C++ compiler version") + ("cflags", "print GNU Radio CFLAGS") + ("version,v", "print GNU Radio version") ; try { @@ -75,6 +78,9 @@ main(int argc, char **argv) if(vm.count("builddate")) std::cout << gr::build_date() << std::endl; + if(vm.count("enabled-components")) + std::cout << gr::build_time_enabled_components() << std::endl; + if(vm.count("version")) std::cout << gr::version() << std::endl; diff --git a/gnuradio-runtime/include/gnuradio/constants.h b/gnuradio-runtime/include/gnuradio/constants.h index 416f039cf1..95aa80b62c 100644 --- a/gnuradio-runtime/include/gnuradio/constants.h +++ b/gnuradio-runtime/include/gnuradio/constants.h @@ -83,6 +83,11 @@ namespace gr { */ GR_RUNTIME_API const std::string compiler_flags(); + /*! + * \brief return build-time enabled components + */ + GR_RUNTIME_API const std::string build_time_enabled_components(); + } /* namespace gr */ #endif /* INCLUDED_GR_CONSTANTS_H */ diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt index 891f6d343b..cdbb2b70ec 100644 --- a/gnuradio-runtime/lib/CMakeLists.txt +++ b/gnuradio-runtime/lib/CMakeLists.txt @@ -38,6 +38,7 @@ string(REPLACE "\\" "\\\\" GR_PREFSDIR ${GR_PREFSDIR}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/constants.cc.in ${CMAKE_CURRENT_BINARY_DIR}/constants.cc + ESCAPE_QUOTES @ONLY) list(APPEND gnuradio_runtime_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc) diff --git a/gnuradio-runtime/lib/constants.cc.in b/gnuradio-runtime/lib/constants.cc.in index 9ba34e376b..516e2f8798 100644 --- a/gnuradio-runtime/lib/constants.cc.in +++ b/gnuradio-runtime/lib/constants.cc.in @@ -95,4 +95,9 @@ namespace gr { return "@COMPILER_INFO@"; } + const std::string + build_time_enabled_components() + { + return "@_gr_enabled_components@"; + } } /* namespace gr */ |