Last active
October 6, 2015 18:55
-
-
Save ChadyG/0284bd4cd60d93561d62 to your computer and use it in GitHub Desktop.
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
#------------------------------------------------- | |
# Generate version based on Git describe | |
# | |
# On Windows, assumes tag format is x.y | |
# Format is [last tag].[commits since tag].[dirty] | |
# Currently, we throw away the hash because Windows versions do not support non-integer versions. | |
# The hash would be useful to determine the exact branch/commit from which the executable was built. | |
# Makes available the version string in C++ define VERSION_STRING | |
#------------------------------------------------- | |
GIT_VERSION = $$system(git describe --dirty) | |
CLEAN_VERSION = $$split(GIT_VERSION, -) | |
VER_MAJ = $$member(CLEAN_VERSION,0) | |
VER_MIN = $$member(CLEAN_VERSION,1) | |
VER_PAT = 0 | |
equals(VER_MAJ, "") { | |
VER_MAJ = 0.0 | |
} | |
equals(VER_MIN, "") { | |
VER_MIN = 0 | |
} | |
DIRTY = $$member(CLEAN_VERSION,3) | |
equals(DIRTY, "dirty") { | |
VER_PAT = 1 | |
} | |
VERSION = $$sprintf("%1.%2.%3", $$VER_MAJ, $$VER_MIN, $$VER_PAT) | |
message(Version set to $$VERSION) | |
QMAKE_TARGET_COMPANY = $$COMPANY | |
QMAKE_TARGET_DESCRIPTION = $$TARGET | |
QMAKE_TARGET_COPYRIGHT = $$COMPANY Inc. | |
QMAKE_TARGET_PRODUCT = $$TARGET | |
DEFINES += VERSION_STRING=\\\"$$VERSION\\\" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment