1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-01-31 21:22:58 +08:00
TaoQuick/mkspecs/features/taoVersion.prf
2020-12-28 00:48:09 +08:00

62 lines
1.5 KiB
Plaintext

defineTest(setTaoVersion) {
TAO_VERSION_TAG = 1.0
# current commit hash
REVISION=$$system("git rev-parse HEAD")
REVISION=$$str_member($${REVISION}, 0, $$num_add(10, -1))
isEmpty(REVISION) {
REVISION = 0000000000
}
# last tag
Ver=$$system("git describe --abbrev=0 --tags")
isEmpty(Ver) {
Ver=0.0.0
}
VerList =$$split(Ver, .)
MAJ = $$take_first(VerList)
MIN = $$take_first(VerList)
PAT = $$take_first(VerList)
equals(TEMPLATE, lib) {
CONFIG += skip_target_version_ext
VER_MAJ = $${MAJ}
VER_MIN = $${MIN}
VER_PAT = $${PAT}
VERSION = $${Ver}
}
TaoREVISION=$${REVISION}
TaoREVISIONSTR=\"$${REVISION}\"
TaoVer=\"$${Ver}\"
TaoMAJ=$${MAJ}
TaoMIN=$${MIN}
TaoPAT=$${PAT}
TaoDATETIME=\"$${_DATE_}\"
CXX_COMPILER_ID=\"$${QMAKE_COMPILER}\"
export(TaoREVISION)
export(TaoREVISIONSTR)
export(TaoVer)
export(TaoMAJ)
export(TaoMIN)
export(TaoPAT)
export(TaoDATETIME)
export(CXX_COMPILER_ID)
# DEFINES += TaoREVISION=$${REVISION}
# DEFINES += TaoREVISIONSTR=\"\\\"$${REVISION}\\\"\"
# DEFINES += TaoVer=\"\\\"$${Ver}\\\"\"
# DEFINES += TaoMAJ=$${MAJ}
# DEFINES += TaoMIN=$${MIN}
# DEFINES += TaoPAT=$${PAT}
# DEFINES += TaoDATETIME=\"\\\"$${_DATE_}\\\"\"
# DEFINES += CXX_COMPILER_ID=\"\\\"$${QMAKE_COMPILER}\\\"\"
export(CONFIG)
export(VER_MAJ)
export(VER_MIN)
export(VER_PAT)
export(VERSION)
# export(DEFINES)
}