Fix finding the latest tag distance.
Switch to git.
This commit is contained in:
parent
475bdadf9b
commit
93fb90153f
47
common.pri
47
common.pri
|
@ -263,34 +263,53 @@ CONFIG(debug, debug|release){
|
||||||
return(\\\"unknown\\\")
|
return(\\\"unknown\\\")
|
||||||
}else{
|
}else{
|
||||||
# Release mode
|
# Release mode
|
||||||
|
|
||||||
macx{
|
macx{
|
||||||
HG = /usr/local/bin/hg # Can't defeat PATH variable on Mac OS.
|
GIT = /usr/local/bin/git # Can't defeat PATH variable on Mac OS.
|
||||||
}else {
|
}else {
|
||||||
HG = hg # All other platforms are OK.
|
GIT = git # All other platforms are OK.
|
||||||
}
|
}
|
||||||
|
|
||||||
#build revision number for using in version
|
|
||||||
unix {
|
|
||||||
DVCS_HESH=$$system("$${HG} log -r. --template '{node|short}'")
|
|
||||||
} else {
|
|
||||||
# Use escape character before "|" on Windows
|
|
||||||
DVCS_HESH=$$system($${HG} log -r. --template "{node^|short}")
|
|
||||||
}
|
|
||||||
isEmpty(DVCS_HESH){
|
|
||||||
DVCS_HESH=$$system("git rev-parse --short HEAD")
|
DVCS_HESH=$$system("git rev-parse --short HEAD")
|
||||||
isEmpty(DVCS_HESH){
|
isEmpty(DVCS_HESH){
|
||||||
DVCS_HESH = \\\"unknown\\\" # if we can't find build revision left unknown.
|
DVCS_HESH = \\\"unknown\\\" # if we can't find build revision left unknown.
|
||||||
} else {
|
} else {
|
||||||
DVCS_HESH=\\\"Git:$${DVCS_HESH}\\\"
|
DVCS_HESH=\\\"Git:$${DVCS_HESH}\\\"
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
DVCS_HESH=\\\"Hg:$${DVCS_HESH}\\\"
|
|
||||||
}
|
|
||||||
return($${DVCS_HESH})
|
return($${DVCS_HESH})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineReplace(FindLatestTagDistance){
|
||||||
|
CONFIG(debug, debug|release){
|
||||||
|
# Debug mode
|
||||||
|
return(0)
|
||||||
|
}else{
|
||||||
|
# Release mode
|
||||||
|
#get latest git tag and it's distance from HEAD
|
||||||
|
macx{
|
||||||
|
GIT = /usr/local/bin/git # Can't defeat PATH variable on Mac OS.
|
||||||
|
}else {
|
||||||
|
GIT = GIT # All other platforms all OK.
|
||||||
|
}
|
||||||
|
|
||||||
|
# tag is formatted as TAG-N-gSHA:
|
||||||
|
# 1. latest stable version is TAG, or vX.Y.Z
|
||||||
|
# 2. number of commits since latest stable version is N
|
||||||
|
# 3. latest commit is gSHA
|
||||||
|
tag_all = $$system(git describe --tags)
|
||||||
|
tag_split = $$split(tag_all, "-") #split at the dashes
|
||||||
|
GIT_DISTANCE = $$member(tag_split,1) #get 2nd element of results
|
||||||
|
|
||||||
|
isEmpty(GIT_DISTANCE){
|
||||||
|
GIT_DISTANCE = 0 # if we can't find local revision left 0.
|
||||||
|
}
|
||||||
|
|
||||||
|
message("Latest tag distance:" $${GIT_DISTANCE})
|
||||||
|
|
||||||
|
return($${GIT_DISTANCE})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Default prefix. Use for creation install path.
|
# Default prefix. Use for creation install path.
|
||||||
DEFAULT_PREFIX = /usr
|
DEFAULT_PREFIX = /usr
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,6 @@ include(warnings.pri)
|
||||||
|
|
||||||
CONFIG(debug, debug|release){
|
CONFIG(debug, debug|release){
|
||||||
# Debug mode
|
# Debug mode
|
||||||
#Calculate latest tag distance and build revision only in release mode. Change number each time requare
|
|
||||||
#recompilation precompiled headers file.
|
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=0"
|
|
||||||
}else{
|
}else{
|
||||||
# Release mode
|
# Release mode
|
||||||
!*msvc*:CONFIG += silent
|
!*msvc*:CONFIG += silent
|
||||||
|
@ -91,19 +88,8 @@ CONFIG(debug, debug|release){
|
||||||
QMAKE_LFLAGS_RELEASE =
|
QMAKE_LFLAGS_RELEASE =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macx{
|
DEFINES += "LATEST_TAG_DISTANCE=$$FindLatestTagDistance()" # Make available latest tag distance number in sources.
|
||||||
HG = /usr/local/bin/hg # Can't defeat PATH variable on Mac OS.
|
|
||||||
}else {
|
|
||||||
HG = hg # All other platforms all OK.
|
|
||||||
}
|
|
||||||
#latest tag distance number for using in version
|
|
||||||
HG_DISTANCE=$$system($${HG} log -r. --template '{latesttagdistance}')
|
|
||||||
isEmpty(HG_DISTANCE){
|
|
||||||
HG_DISTANCE = 0 # if we can't find local revision left 0.
|
|
||||||
}
|
|
||||||
message("Latest tag distance:" $${HG_DISTANCE})
|
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=$${HG_DISTANCE}" # Make available latest tag distance number in sources.
|
|
||||||
}
|
|
||||||
|
|
||||||
include (../libs.pri)
|
include (../libs.pri)
|
||||||
|
|
|
@ -62,9 +62,6 @@ include(warnings.pri)
|
||||||
|
|
||||||
CONFIG(debug, debug|release){
|
CONFIG(debug, debug|release){
|
||||||
# Debug mode
|
# Debug mode
|
||||||
#Calculate latest tag distance and build revision only in release mode. Change number each time requare
|
|
||||||
#recompilation precompiled headers file.
|
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=0"
|
|
||||||
}else{
|
}else{
|
||||||
# Release mode
|
# Release mode
|
||||||
!*msvc*:CONFIG += silent
|
!*msvc*:CONFIG += silent
|
||||||
|
@ -84,19 +81,6 @@ CONFIG(debug, debug|release){
|
||||||
QMAKE_LFLAGS_RELEASE =
|
QMAKE_LFLAGS_RELEASE =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macx{
|
|
||||||
HG = /usr/local/bin/hg # Can't defeat PATH variable on Mac OS.
|
|
||||||
}else {
|
|
||||||
HG = hg # All other platforms all OK.
|
|
||||||
}
|
|
||||||
#latest tag distance number for using in version
|
|
||||||
HG_DISTANCE=$$system($${HG} log -r. --template '{latesttagdistance}')
|
|
||||||
isEmpty(HG_DISTANCE){
|
|
||||||
HG_DISTANCE = 0 # if we can't find local revision left 0.
|
|
||||||
}
|
|
||||||
message("Latest tag distance:" $${HG_DISTANCE})
|
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=$${HG_DISTANCE}" # Make available latest tag distance number in sources.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include (../libs.pri)
|
include (../libs.pri)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user