summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/version.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-10-18 16:09:51 -0700
committerMatthew Cline <zelgadis@sourceforge.net>2009-10-18 16:09:51 -0700
commitdee470bf63c25c3d99ea89e9d9f5979ab01d53bb (patch)
tree0b8a3a91c89e0ad6713e62702dfc23bf875ec9b7 /crawl-ref/source/version.cc
parentb3475474824eb75feb901ed9fa3b5826626a185b (diff)
downloadcrawl-ref-dee470bf63c25c3d99ea89e9d9f5979ab01d53bb.tar.gz
crawl-ref-dee470bf63c25c3d99ea89e9d9f5979ab01d53bb.zip
Add compilation information to Version namespace
The Version namespace now provides the compiler which was used, the OS, machine type and processor type the compilation was done on, and the CFLAGS, CFLAGS_L and LDFLAGS which were used. If GCC was the compiler, it also provides the compiler version. This information is included in crash reports, and can be dumped using the new command line option "-version".
Diffstat (limited to 'crawl-ref/source/version.cc')
-rw-r--r--crawl-ref/source/version.cc69
1 files changed, 69 insertions, 0 deletions
diff --git a/crawl-ref/source/version.cc b/crawl-ref/source/version.cc
index 0805bb5c8e..6d9ee55797 100644
--- a/crawl-ref/source/version.cc
+++ b/crawl-ref/source/version.cc
@@ -7,6 +7,7 @@
#include "AppHdr.h"
#include "build.h"
+#include "compflag.h"
namespace Version
{
@@ -49,5 +50,73 @@ namespace Version
{
return CRAWL_VERSION_PREREL_NUM;
}
+
+ std::string Compiler()
+ {
+#if defined(__GNUC__) && defined(__VERSION__)
+ return make_stringf("GCC %s", __VERSION__);
+#elif defined(__GNUC__)
+ return ("GCC (unknown version)");
+#elif defined(TARGET_COMPILER_MINGW)
+ return ("MINGW");
+#elif defined(TARGET_COMPILER_CYGWIN)
+ return ("CYGWIN");
+#elif defined(TARGET_COMPILER_VC)
+ return ("Visual C++");
+#elif defined(TARGET_COMPILER_ICC)
+ return ("Intel C++");
+#else
+ return ("Unknown compiler");
+#endif
+ }
+
+ std::string BuildOS()
+ {
+ return CRAWL_BUILD_OS;
+ }
+
+ std::string BuildMachine()
+ {
+ return CRAWL_BUILD_MACHINE;
+ }
+
+ std::string BuildProcessor()
+ {
+ return CRAWL_BUILD_PROCESSOR;
+ }
+
+ std::string CFLAGS()
+ {
+ return CRAWL_CFLAGS;
+ }
+
+ std::string CFLAGS_L()
+ {
+ return CRAWL_CFLAGS_L;
+ }
+
+ std::string LDFLAGS()
+ {
+ return CRAWL_LDFLAGS;
+ }
}
+std::string compilation_info()
+{
+ std::string out = "";
+
+ out += make_stringf("Compiled with %s on %s at %s" EOL,
+ Version::Compiler().c_str(), __DATE__, __TIME__);
+ out += make_stringf("Compiled on OS: %s" EOL,
+ Version::BuildOS().c_str());
+ out += make_stringf("Compiled on machine type: %s" EOL,
+ Version::BuildMachine().c_str());
+ out += make_stringf("Compiled on processor type: %s" EOL,
+ Version::BuildProcessor().c_str());
+
+ out += make_stringf("CLFAGS: %s" EOL, Version::CFLAGS().c_str());
+ out += make_stringf("CFLAGS_L: %s" EOL, Version::CFLAGS_L().c_str());
+ out += make_stringf("LDFLAGS: %s" EOL, Version::LDFLAGS().c_str());
+
+ return (out);
+}