Line data Source code
1 1 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : /// \file 5 : /// Declares function info_from_build. 6 : 7 : #pragma once 8 : 9 : #include <string> 10 : 11 : /*! 12 : * \ingroup LoggingGroup 13 : * \brief Information about the version, date, host, git commit, and link time 14 : * 15 : * The information returned by this function is invaluable for identifying 16 : * the version of the code used in a simulation, as well as which host, the 17 : * date the code was compiled, and the time of linkage. 18 : */ 19 1 : std::string info_from_build(); 20 : 21 : // We declare these functions `extern "C"` so their symbols are not mangled and 22 : // we can ignore that they are undefined until link time (see `CMakeLists.txt`). 23 : // Note that the `std::string` return type is not compatible with C, but that's 24 : // OK as long as we're not calling or defining the functions in C. See 25 : // Microsoft's C4190: 26 : // https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4190 27 : #if defined(__clang__) 28 : #pragma GCC diagnostic push 29 : #pragma GCC diagnostic ignored "-Wreturn-type-c-linkage" 30 : #endif // defined(__clang__) 31 : /*! 32 : * \ingroup LoggingGroup 33 : * \brief The time and date the executable was linked 34 : */ 35 1 : extern "C" std::string link_date(); 36 : /*! 37 : * \ingroup LoggingGroup 38 : * \brief Name of the linked executable 39 : */ 40 1 : extern "C" std::string executable_name(); 41 : /*! 42 : * \ingroup LoggingGroup 43 : * \brief The git description at the time the executable was linked 44 : */ 45 1 : extern "C" std::string git_description(); 46 : /*! 47 : * \ingroup LoggingGroup 48 : * \brief The git branch at the time the executable was linked 49 : */ 50 1 : extern "C" std::string git_branch(); 51 : #if defined(__clang__) 52 : #pragma GCC diagnostic pop 53 : #endif // defined(__clang__) 54 : 55 : /*! 56 : * \ingroup LoggingGroup 57 : * \brief Retrieve a string containing the current version of SpECTRE 58 : */ 59 1 : std::string spectre_version(); 60 : 61 : /*! 62 : * \ingroup LoggingGroup 63 : * \brief Returns the path to the Unit test directory. 64 : */ 65 1 : std::string unit_test_src_path(); 66 : 67 : /*! 68 : * \ingroup LoggingGroup 69 : * \brief Returns the path to the Unit test directory in the build directory. 70 : */ 71 1 : std::string unit_test_build_path();