]> Dogcows Code - chaz/yoink/blob - src/stlplus/portability/build.cpp
import stlplus 3.7
[chaz/yoink] / src / stlplus / portability / build.cpp
1 ////////////////////////////////////////////////////////////////////////////////
2
3 // Author: Andy Rushton
4 // Copyright: (c) Southampton University 1999-2004
5 // (c) Andy Rushton 2004 onwards
6 // License: BSD License, see ../docs/license.html
7
8 // report the platform-specific details of this build
9
10 ////////////////////////////////////////////////////////////////////////////////
11 #include "build.hpp"
12 #include "version.hpp"
13 #include "dprintf.hpp"
14 ////////////////////////////////////////////////////////////////////////////////
15
16 namespace stlplus
17 {
18
19 // STLplus version in the form "STLplus v3.0" - see version.hpp for a way of getting just the version number
20 std::string stlplus_version(void)
21 {
22 return std::string("STLplus v") + version();
23 }
24
25 // platform is the target operating system in the form "Windows" or "Generic Unix"
26 std::string platform(void)
27 {
28 #if defined _WIN32
29 return std::string("Windows");
30 #else
31 // at present there are no variations between different Unix platforms so
32 // they all map onto the generic Unix platform
33 return std::string("Generic Unix");
34 #endif
35 }
36
37 // compiler_name is the short name of the compiler, e.g. "gcc" or "MSVC"
38 std::string compiler_name(void)
39 {
40 #if defined __GNUC__
41 return std::string("gcc");
42 #elif defined _MSC_VER
43 return std::string("MSVC");
44 #elif defined __BORLANDC__
45 return std::string("Borland");
46 #else
47 return std::string("unknown compiler");
48 #endif
49 }
50
51 // compiler_version is the version string of the compiler e.g. "3.4" for gcc or "15.00" for MSVC
52 std::string compiler_version(void)
53 {
54 #if defined __GNUC__
55 return dformat("%d.%d.%d",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
56 #elif defined _MSC_VER
57 return dformat("%0.2f",((float)_MSC_VER)/100.0);
58 #elif defined __BORLANDC__
59 return dformat("%d.%d%d",__BORLANDC__/256,__BORLANDC__/16%16,__BORLANDC__%16);
60 #else
61 return std::string();
62 #endif
63 }
64
65 // compiler is the compilation system and version above combined into a human- readable form e.g. "gcc v3.4"
66 std::string compiler(void)
67 {
68 return compiler_name() + std::string(" v") + compiler_version();
69 }
70
71 // variant is the kind of build - "debug" or "release"
72 std::string variant(void)
73 {
74 #ifndef NDEBUG
75 return std::string("debug");
76 #else
77 return std::string("release");
78 #endif
79
80 }
81
82 std::string build(void)
83 {
84 return stlplus_version() + ", " + platform() + ", " + compiler() + ", " + variant();
85 }
86
87 ////////////////////////////////////////////////////////////////////////////////
88 } // end namespace stlplus
This page took 0.032536 seconds and 4 git commands to generate.