-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Need to discard STDERR so get path to NULL device | ||
win32 { | ||
NULL_DEVICE = NUL # Windows doesn't have /dev/null but has NUL | ||
} else { | ||
NULL_DEVICE = /dev/null | ||
} | ||
|
||
# Need to call git with manually specified paths to repository | ||
BASE_GIT_COMMAND = git --git-dir $$PWD/../.git rev-parse --short HEAD | ||
|
||
# Get the short git sha | ||
GIT_SHA = $$system($$BASE_GIT_COMMAND 2> $$NULL_DEVICE) | ||
|
||
# Adding C preprocessor #DEFINE so we can use it in C++ code | ||
DEFINES += GIT_SHA=\\\"$$GIT_SHA\\\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
This file is part of Allie Chess. | ||
Copyright (C) 2018, 2019 Adam Treat | ||
Allie Chess is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Allie Chess is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Allie Chess. If not, see <http://www.gnu.org/licenses/>. | ||
Additional permission under GNU GPL version 3 section 7 | ||
*/ | ||
|
||
#ifndef VERSION_H | ||
#define VERSION_H | ||
|
||
#include <QString> | ||
|
||
static int s_majorVersion = 0; | ||
static int s_minorVersion = 2; | ||
static bool s_isDev = true; | ||
|
||
static QString versionString() | ||
{ | ||
const QString maj = QString::number(s_majorVersion); | ||
const QString min = QString::number(s_minorVersion); | ||
#if defined(GIT_SHA) | ||
const QString git = QString("(%0)").arg(GIT_SHA); | ||
#else | ||
const QString git = QString(); | ||
#endif | ||
const QString dev = s_isDev ? QLatin1String("-dev") : QLatin1String(""); | ||
return QString("v%0.%1%2 %3").arg(maj).arg(min).arg(dev).arg(git); | ||
} | ||
|
||
#endif // VERSION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters