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".
HYVYGSYBKN6CE7NGBGXAAXVNVR3FMIXQOR6ONVPLBDIISIKFDXQQC
376NMV7AXSD44BCEY62VI53QWLG74TF33KTTNTJHICVU4WOBMT7QC
QZ45TYPR6CD2NNV55TTNRTWE3TJTDRQA3QUSK2RZ42FLIESXNWDQC
NCYUW5C4IA6JQMFGJQUZNB2GBLKG6ROI7I3ZKO5O5DIQSQNXLNDAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
7OEQPUSDZ3CTUQYZLALUI7PHZOUBL2TTOKRJBCVEYTL5J2LQUNRQC
RRJ46VMOKMHIUVOOKCFBSVXNT3GPNWTHG2PGBFV7224AWEG7NS2AC
GL5T36G3A2LUTTYSL7ZQVUYONUCXL5DK36532FM6XRAQCLYDWW2QC
HCTDAXFRE6LXGHLKOMM7GX3YXGWJYM4DLZS7ITWYTXC5NWZBB2OQC
FHMTFYXFX5OBWFLRH4PU4ZOWP5JGDCH4OBCJSAMPIC5SREHXM5AQC
POACC5YR6QQGEX6GGMUJKGCDQNX6P6FUF4UQTYGOSHFOHJ26X4SQC
Z3RI4XAN7J2GUABAQ5G6YIOQYMBOAEQFFGRBWHMUEB2A2QYXO5MQC
C55G5JGGSVWMU7XVEJL6YZZLDXQZGRN7JQOAALS6WIKFPX3L2U6QC
C25ULNTKMNOXT72ERWSFQZQW5E2OIM3TOGAAA33Z7EZQMZHRS2MAC
Z5PVF4BKRAUD3CTW26IDYI2XV7H2YDKFKBWDQYWUUABCKWHF4KWAC
FDJFPTPB5IT7IFTUXKLIKOODLUC32YH7SPPBIVF4GV5GGTEFTLEAC
RNIAOCLZYEW5GB7I536HRPYJ7DSDEXITH5RZP5CPKJYHVUTWBKRQC
FPEDPMNC2PK2N636TO46VYNGQGGBSBSDEFOPV7M26I25LK4XMPEAC
MI3OUXIF33ZKK7TBGHTRUQXZJINRCEBXNLTMCVHMQITDR4XRFCMAC
KOMZPTDEZP3P6EWBUECWDY7OWELOUTMAUKNEOJ7PWX5LJBTMRVQAC
CH7JECYYH35H4TRHRNRTRJCQTQLZ2WRH62TKV72SUIU2RTK5OH7AC
NAJUBSMKYFGRRP747VRIPBJBPTOIRR4DM5PLCSY6YBHNMBBAI2QAC
GVDKSZGU5NDWQAADOPCIURSBQG2T7VMFDKAF75Z5T3KVVP6744VQC
//! The compiler used.
/*!
* Names the compiler used to genrate the executable.
*/
std::string Compiler();
//! The operating system.
/*!
* Names the operating system that the executable was compiled on.
*/
std::string BuildOS();
//! The machine type.
/*!
* Names the machine type (e.g., "i686") the executable was compiled on.
*/
std::string BuildMachine();
//! The processor type.
/*!
* Names the processor type the executable was compiled on.
*/
std::string BuildProcessor();
//! The CFLAGS.
/*!
* Returns the CFLAGS the executable was compiled with.
*/
std::string CFLAGS();
//! The CFLAGS_L.
/*!
* Returns the CFLAGS_L the executable was compiled with.
*/
std::string CFLAGS_L();
//! The LDFLAGS.
/*!
* Returns the flags the executable was linked with.
*/
std::string LDFLAGS();
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;
}
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);
}
$(GAME): $(GAME_DEPENDS)
# This information is included in crash reports, and is printed with
# "crawl -version"
compile-flags:
@echo "// Automatically generated by makefile" > .compflag.h
@echo "#ifndef __included_crawl_compiler_flags_h" >> .compflag.h
@echo "#define __included_crawl_compiler_flags_h" >> .compflag.h
@echo -n "#define CRAWL_CFLAGS \"" >> .compflag.h
@echo -n $(CFLAGS) | sed s/\"/\\\"/g >> .compflag.h
@echo "\"" >> .compflag.h
@echo -n "#define CRAWL_CFLAGS_L \"" >> .compflag.h
@echo -n $(CFLAGS_L) | sed s/\"/\\\"/g >> .compflag.h
@echo "\"" >> .compflag.h
@echo -n "#define CRAWL_LDFLAGS \"" >> .compflag.h
@echo -n $(LDFLAGS) | sed s/\"/\\\"/g >> .compflag.h
@echo "\"" >> .compflag.h
@echo "#endif" >> .compflag.h
@if [ "`diff -N -q .compflag.h compflag.h`" ]; then \
echo Updating compflag.h; \
mv .compflag.h compflag.h; \
fi
compflag.h: compile-flags
$(GAME): $(GAME_DEPENDS) compile-flags
fprintf(file, "Platform: unix" EOL);
fprintf(file, "Platform: unix");
# if defined(TARGET_OS_MACOSX)
fprintf(file, " (OS X)");
# endif
fprintf(file, EOL);
#elif defined(TARGET_OS_WINDOWS)
fprintf(file, "Platform: Windows" EOL);
#elif defined(TARGET_OS_DOS)
fprintf(file, "Platform: DOS" EOL);
#endif // UNIX
#if TARGET_CPU_BITS == 64
fprintf(file, "Bits: 64" EOL);
#else
fprintf(file, "Bits: 32" EOL);