Skip to content

Commit

Permalink
added file and cli flag for retrieving cyclus core and dependency ver…
Browse files Browse the repository at this point in the history
…sions.

Fixes cyclus#578.
  • Loading branch information
rwcarlsen committed Sep 19, 2013
1 parent f675fb6 commit 47b8042
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
4 changes: 4 additions & 0 deletions src/Core/Config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ ELSE()
CONFIGURE_FILE(suffix.h.in ${CMAKE_CURRENT_SOURCE_DIR}/suffix.h @ONLY)
ENDIF()

EXECUTE_PROCESS(COMMAND git describe OUTPUT_VARIABLE core_version OUTPUT_STRIP_TRAILING_WHITESPACE)
CONFIGURE_FILE(version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/version.h @ONLY)

# Here we set some components for installation with cpack
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/cyclus.rng.in
Expand All @@ -25,6 +28,7 @@ INSTALL(FILES
unix_helper_functions.h
windows_helper_functions.h
suffix.h
version.h
DESTINATION include/cyclus
COMPONENT core
)
37 changes: 19 additions & 18 deletions src/app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,17 @@
#include "hdf5_back.h"
#include "csv_back.h"
#include "context.h"
#include "version.h"

namespace po = boost::program_options;
namespace fs = boost::filesystem;

using namespace cyclus;

//-----------------------------------------------------------------------
// Main entry point for the test application...
//-----------------------------------------------------------------------
int main(int argc, char* argv[]) {
using cyclus::Logger;
using cyclus::Env;
using cyclus::Model;
using cyclus::Timer;
using cyclus::Logger;
using cyclus::LogLevel;
using cyclus::LEV_ERROR;
using cyclus::EventManager;
using cyclus::EventBackend;
using cyclus::Hdf5Back;
using cyclus::SqliteBack;
using cyclus::CsvBack;
using cyclus::XMLFileLoader;
using cyclus::Context;

// verbosity help msg
std::string vmessage = "output log verbosity. Can be text:\n\n";
Expand All @@ -52,6 +41,7 @@ int main(int argc, char* argv[]) {
po::options_description desc("Allowed options");
desc.add_options()
("help,h", "produce help message")
("version", "print cyclus core and dependency versions and quit")
("no-model", "only print log entries from cyclus core code")
("no-mem", "exclude memory log statement from logger output")
("verb,v", po::value<std::string>(), vmessage.c_str())
Expand Down Expand Up @@ -91,6 +81,17 @@ int main(int argc, char* argv[]) {
return 0;
}

if (vm.count("version")) {
std::cout << "Cyclus Core " << version::core() << "\n\nDependencies:\n";
std::cout << " Boost " << version::boost() << "\n";
std::cout << " Coin-Cbc " << version::coincbc() << "\n";
std::cout << " Hdf5 " << version::hdf5() << "\n";
std::cout << " Sqlite3 " << version::sqlite3() << "\n";
std::cout << " xml2 " << version::xml2() << "\n";
std::cout << " xml++ " << version::xmlpp() << "\n";
return 0;
}

if (vm.count("no-model")) {
Logger::NoModel() = true;
}
Expand Down Expand Up @@ -130,7 +131,7 @@ int main(int argc, char* argv[]) {
std::string inputFile = vm["input-file"].as<std::string>();
XMLFileLoader loader(&ctx, inputFile);
loader.LoadAll();
} catch (cyclus::Error e) {
} catch (Error e) {
success = false;
CLOG(LEV_ERROR) << e.what();
}
Expand All @@ -141,7 +142,7 @@ int main(int argc, char* argv[]) {
if (vm.count("output-path")){
output_path = vm["output-path"].as<std::string>();
}
} catch (cyclus::Error ge) {
} catch (Error ge) {
success = false;
CLOG(LEV_ERROR) << ge.what();
}
Expand All @@ -166,7 +167,7 @@ int main(int argc, char* argv[]) {
// Run the simulation
try {
ti.RunSim();
} catch (cyclus::Error err) {
} catch (Error err) {
success = false;
CLOG(LEV_ERROR) << err.what();
}
Expand All @@ -177,7 +178,7 @@ int main(int argc, char* argv[]) {
// Close Dynamically loaded modules
try {
Model::UnloadModules();
} catch (cyclus::Error err) {
} catch (Error err) {
success = false;
CLOG(LEV_ERROR) << err.what();
}
Expand Down

0 comments on commit 47b8042

Please sign in to comment.