src/version.cc

Sat, 19 Apr 2014 14:00:40 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 19 Apr 2014 14:00:40 +0300
changeset 722
61e2d0ca0018
parent 658
2ca8316e0109
child 745
ab8adddc0f5c
permissions
-rw-r--r--

- conditional lines are now rendered with stippled lines again

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'};
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30
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 const char* versionString()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 {
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
35 if (g_versionString[0] == '\0')
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #if VERSION_PATCH == 0
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
38 sprintf (g_versionString, "%d.%d", VERSION_MAJOR, VERSION_MINOR);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 #else
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
40 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
41 #endif // VERSION_PATCH
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
44 return g_versionString;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 }
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 const char* fullVersionString()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 {
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
51 if (g_fullVersionString[0] == '\0')
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 #if BUILD_ID != BUILD_RELEASE
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
54 strcpy (g_fullVersionString, GIT_DESCRIPTION);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 #else
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
56 sprintf (g_fullVersionString, "v%s", versionString());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 #endif
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59
658
2ca8316e0109 - some tweaks to version.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
60 return g_fullVersionString;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 }

mercurial