1 /* |
|
2 * LDForge: LDraw parts authoring CAD |
|
3 * Copyright (C) 2013, 2014 Santeri Piippo |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #include <stdio.h> |
|
20 #include <string.h> |
|
21 #include "Version.h" |
|
22 #include "Git.h" |
|
23 |
|
24 char gVersionString[64] = {'\0'}; |
|
25 char gFullVersionString[256] = {'\0'}; |
|
26 |
|
27 // ============================================================================= |
|
28 // |
|
29 const char* versionString() |
|
30 { |
|
31 if (gVersionString[0] == '\0') |
|
32 { |
|
33 #if VERSION_PATCH == 0 |
|
34 sprintf (gVersionString, "%d.%d", VERSION_MAJOR, VERSION_MINOR); |
|
35 #else |
|
36 sprintf (gVersionString, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); |
|
37 #endif // VERSION_PATCH |
|
38 } |
|
39 |
|
40 return gVersionString; |
|
41 } |
|
42 |
|
43 // ============================================================================= |
|
44 // |
|
45 const char* fullVersionString() |
|
46 { |
|
47 if (gFullVersionString[0] == '\0') |
|
48 { |
|
49 #if BUILD_ID != BUILD_RELEASE |
|
50 strcpy (gFullVersionString, GIT_DESCRIPTION); |
|
51 #else |
|
52 sprintf (gFullVersionString, "v%s", versionString()); |
|
53 #endif |
|
54 } |
|
55 |
|
56 return gFullVersionString; |
|
57 } |
|