CASM  1.1.0
A Clusters Approach to Statistical Mechanics
LogRuntimeLibrary.cc
Go to the documentation of this file.
2 
3 #include "casm/casm_io/Log.hh"
5 
6 namespace CASM {
7 
8 void print_runtime_lib_options_help(std::ostream &sout) {
9  sout << "Error compiling clexulator. To fix: \n";
10  sout << " - Check compiler error messages.\n";
11  sout << " - Check compiler options with 'casm settings -l'\n";
12  sout << " - Update compiler options with 'casm settings "
13  "--set-compile-options '...options...'\n";
14  sout << " - Make sure the casm headers can be found by including "
15  "'-I/path/to/casm'\n";
16 };
17 
19 std::shared_ptr<RuntimeLibrary> log_make_shared_runtime_lib(
20  std::string filename_base, std::string compile_options,
21  std::string so_options, std::string compile_msg) {
22  log().compiling<Log::standard>(filename_base + ".cc");
23  log().begin_lap();
24  log() << compile_msg << std::endl;
25  try {
26  std::shared_ptr<RuntimeLibrary> result = std::make_shared<RuntimeLibrary>(
27  filename_base, compile_options, so_options);
28  log() << "compile time: " << log().lap_time() << " (s)\n" << std::endl;
29  return result;
30  } catch (runtime_lib_compile_error &e) {
31  e.print(err_log());
33  throw;
34  } catch (runtime_lib_shared_error &e) {
35  e.print(err_log());
37  throw;
38  } catch (std::exception &e) {
40  throw;
41  }
42 }
43 } // namespace CASM
void compiling(const std::string &what)
Definition: Log.hh:134
void begin_lap()
Definition: Log.cc:47
static const int standard
Definition: Log.hh:52
double lap_time() const
Definition: Log.cc:49
void print(std::ostream &sout) const
Main CASM namespace.
Definition: APICommand.hh:8
std::shared_ptr< RuntimeLibrary > log_make_shared_runtime_lib(std::string filename_base, std::string compile_options, std::string so_options, std::string compile_msg)
Make shared_ptr<RuntimeLibrary>, logging progress and errors.
Log & log()
Definition: Log.hh:424
void print_runtime_lib_options_help(std::ostream &sout)
Log & err_log()
Definition: Log.hh:426