mirror of
https://github.com/jaredtao/TaoQuick.git
synced 2025-01-31 21:22:58 +08:00
45 lines
1.1 KiB
Plaintext
45 lines
1.1 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}
|
|
}
|
|
|
|
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)
|
|
}
|
|
|