FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
version.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2013 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_VERSION_H
23 #define FIFE_VERSION_H
24 
28 #ifndef FIFE_MAJOR_VERSION
29  #define FIFE_MAJOR_VERSION 0
30 #endif
31 #ifndef FIFE_MINOR_VERSION
32  #define FIFE_MINOR_VERSION 4
33 #endif
34 #ifndef FIFE_PATCH_VERSION
35  #define FIFE_PATCH_VERSION 0
36 #endif
37 
44 #ifndef FIFE_PRERELEASE_TYPE
45  #define FIFE_PRERELEASE_TYPE 0
46 #endif
47 #ifndef FIFE_PRERELEASE_VERSION
48  #define FIFE_PRERELEASE_VERSION 0
49 #endif
50 
51 /***************************************************************************
52  * Do not update anything below this line!
53  ***************************************************************************/
54 
55 #define FIFE_STR(s) # s
56 #define FIFE_XSTR(s) FIFE_STR(s)
57 
58 #define FIFE_DOT(a,b) a.b
59 #define FIFE_XDOT(a,b) FIFE_DOT(a,b)
60 
61 #define FIFE_PLUS(a,b) a+b
62 #define FIFE_XPLUS(a,b) FIFE_PLUS(a,b)
63 
64 #define FIFE_MINUS(a,b) a-b
65 #define FIFE_XMINUS(a,b) FIFE_MINUS(a,b)
66 
67 #if FIFE_PRERELEASE_TYPE==1
68  #define FIFE_PRERELEASE alpha
69 #elif FIFE_PRERELEASE_TYPE==2
70  #define FIFE_PRERELEASE beta
71 #elif FIFE_PRERELEASE_TYPE==3
72  #define FIFE_PRERELEASE rc
73 #endif
74 
75 #if FIFE_PRERELEASE_VERSION>0
76  #ifdef FIFE_PRERELEASE
77  #define FIFE_PRERELEASE_STR \
78  FIFE_XDOT( \
79  FIFE_PRERELEASE, \
80  FIFE_PRERELEASE_VERSION \
81  )
82  #endif
83 #endif
84 
85 #define FIFE_VERSION \
86  FIFE_XDOT( \
87  FIFE_XDOT(FIFE_MAJOR_VERSION, FIFE_MINOR_VERSION), \
88  FIFE_PATCH_VERSION \
89  )
90 
91 #ifdef FIFE_PRERELEASE_STR
92  #define FIFE_VERSION_STRING \
93  FIFE_XMINUS( \
94  FIFE_VERSION, \
95  FIFE_PRERELEASE_STR \
96  )
97 #endif
98 #ifdef FIFE_GIT_HASH
99  #ifndef FIFE_VERSION_STRING
100  #define FIFE_VERSION_STRING \
101  FIFE_XPLUS( \
102  FIFE_VERSION, \
103  FIFE_GIT_HASH \
104  )
105  #else
106  #undef FIFE_VERSION_STRING
107  #ifdef FIFE_PRERELEASE_STR
108  #define FIFE_VERSION_STRING \
109  FIFE_XMINUS( \
110  FIFE_VERSION, \
111  FIFE_XPLUS( \
112  FIFE_PRERELEASE_STR, \
113  FIFE_GIT_HASH \
114  ) \
115  )
116  #else
117  #define FIFE_VERSION_STRING \
118  FIFE_XPLUS( \
119  FIFE_VERSION, \
120  FIFE_GIT_HASH \
121  )
122  #endif
123  #endif
124 #else
125  #define FIFE_GIT_HASH ""
126 #endif
127 
128 
129 // This is an actual release
130 #ifndef FIFE_VERSION_STRING
131  #define FIFE_VERSION_STRING FIFE_VERSION
132 #endif
133 
138 namespace FIFE {
139  inline const char* getVersion() {
141  }
142 
143  inline int getMajor() {
144  return FIFE_MAJOR_VERSION;
145  }
146 
147  inline int getMinor() {
148  return FIFE_MINOR_VERSION;
149  }
150 
151  inline int getPatch() {
152  return FIFE_PATCH_VERSION;
153  }
154 
155  inline const char* getHash() {
156  return FIFE_XSTR(FIFE_GIT_HASH);
157  }
158 } //FIFE
159 
160 //cleanup
161 #undef FIFE_STR
162 #undef FIFE_XSTR
163 #undef FIFE_DOT
164 #undef FIFE_XDOT
165 #undef FIFE_PLUS
166 #undef FIFE_XPLUS
167 #undef FIFE_MINUS
168 #undef FIFE_XMINUS
169 #undef FIFE_VERSION_STRING
170 #undef FIFE_VERSION
171 #undef FIFE_PRERELEASE
172 #undef FIFE_PRERELEASE_STR
173 
174 #endif //FIFE_VERSION_H
175 
#define FIFE_XSTR(s)
Definition: version.h:56
#define FIFE_MAJOR_VERSION
These version numbers should be checked and updated as part of the release process for FIFE...
Definition: version.h:29
int getMinor()
Definition: version.h:147
const char * getVersion()
Definition: version.h:139
int getMajor()
Definition: version.h:143
#define FIFE_MINOR_VERSION
Definition: version.h:32
#define FIFE_PATCH_VERSION
Definition: version.h:35
#define FIFE_GIT_HASH
Definition: version.h:125
const char * getHash()
Definition: version.h:155
int getPatch()
Definition: version.h:151
#define FIFE_VERSION_STRING
Definition: version.h:131