Sat, 17 May 2014 15:45:56 +0300
- removed the build time in favor of commit time which I think is much more important
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013, 2014 Santeri Piippo |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
19 | // Note: only using stock C stuff in this file, keeping the STL/Qt stuff out |
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
20 | // makes this simple file very fast to compile, which is nice since this file |
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
21 | // must be compiled every time I commit something. |
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
22 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include <stdio.h> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include <string.h> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "version.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include "gitinfo.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
28 | char g_versionString[64] = {'\0'}; |
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
29 | char g_fullVersionString[256] = {'\0'}; |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
30 | char g_buildTime[256] = {'\0'}; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | const char* versionString() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | { |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
36 | if (g_versionString[0] == '\0') |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | #if VERSION_PATCH == 0 |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
39 | sprintf (g_versionString, "%d.%d", VERSION_MAJOR, VERSION_MINOR); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | #else |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
41 | sprintf (g_versionString, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | #endif // VERSION_PATCH |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
45 | return g_versionString; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | // ============================================================================= |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | const char* fullVersionString() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | { |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
52 | if (g_fullVersionString[0] == '\0') |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | #if BUILD_ID != BUILD_RELEASE |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
55 | strcpy (g_fullVersionString, GIT_DESCRIPTION); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | #else |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
57 | sprintf (g_fullVersionString, "v%s", versionString()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | #endif |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | |
658
2ca8316e0109
- some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
61 | return g_fullVersionString; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | } |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
63 | |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
64 | // ============================================================================= |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
65 | // |
774
8bce7acd100c
- removed the build time in favor of commit time which I think is much more important
Santeri Piippo <crimsondusk64@gmail.com>
parents:
745
diff
changeset
|
66 | const char* commitTimeString() |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
67 | { |
774
8bce7acd100c
- removed the build time in favor of commit time which I think is much more important
Santeri Piippo <crimsondusk64@gmail.com>
parents:
745
diff
changeset
|
68 | #ifdef GIT_TIME |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
69 | if (g_buildTime[0] == '\0') |
774
8bce7acd100c
- removed the build time in favor of commit time which I think is much more important
Santeri Piippo <crimsondusk64@gmail.com>
parents:
745
diff
changeset
|
70 | strcpy (g_buildTime, GIT_TIME); |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
71 | #endif |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
72 | |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
73 | return g_buildTime; |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
658
diff
changeset
|
74 | } |