]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Version.hpp.in
CMake: Add version logic and make it generate Version.hpp
[lugaru.git] / Source / Version.hpp.in
diff --git a/Source/Version.hpp.in b/Source/Version.hpp.in
new file mode 100644 (file)
index 0000000..180ecc7
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+Copyright (C) 2003, 2010 - Wolfire Games
+Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
+
+This file is part of Lugaru.
+
+Lugaru 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 2 of the License, or
+(at your option) any later version.
+
+Lugaru 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 Lugaru.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/** Version number is either MAJOR.MINOR, or MAJOR.MINOR.PATCH if PATCH != 0 */
+const unsigned int VERSION_MAJOR = @LUGARU_VERSION_MAJOR@;
+const unsigned int VERSION_MINOR = @LUGARU_VERSION_MINOR@;
+const unsigned int VERSION_PATCH = @LUGARU_VERSION_PATCH@;
+const std::string VERSION_NUMBER = "@LUGARU_VERSION_NUMBER@";
+
+/** Set to "" for stable (tagged) builds, "-dev" for dev builds */
+const std::string VERSION_SUFFIX = "@LUGARU_VERSION_SUFFIX@";
+/** Set to 7-char git commit hash if available, otherwise "" */
+const std::string VERSION_HASH = "@LUGARU_VERSION_HASH@";
+/** Optional release string, e.g. for distro packages release number */
+const std::string VERSION_RELEASE = "@LUGARU_VERSION_RELEASE@";
+
+/** Final string built from the above constants, following the scheme
+ *  defined in CMakeLists.txt, typically:
+ *      MAJOR.MINOR[.PATCH][-dev] [(git HASH)] [[RELEASE]]
+ *
+ *  For example:
+ *      "1.2-dev (git ab12c34)"
+ *      "1.2-dev (git ab12c34) [OSS Lugaru official]"
+ *      "1.3.1 [Mageia 1.3.1-2.mga6]"
+ */
+const std::string VERSION_STRING = "@LUGARU_VERSION_STRING@";
+
+/** Build type (Release, Debug, RelWithDebInfo) to output to the terminal */
+const std::string VERSION_BUILD_TYPE = "@CMAKE_BUILD_TYPE@";