从git读取版本

This commit is contained in:
hm
2020-09-26 17:55:46 +08:00
parent 0987cd8b93
commit 28a2b2dd29
19 changed files with 463 additions and 93 deletions
+20
View File
@@ -18,6 +18,26 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
# 获取当前的版本号,分支等
exists (../.git) {
GIT_HEAD = $$system(git rev-list --tags --max-count=1)
GIT_TAG = $$system(git describe --tags $${GIT_HEAD})
GIT_BRANCH = $$system(git rev-parse --abbrev-ref HEAD)
GIT_TIME = $$system(git show --oneline --format=\"%ci%H\" -s HEAD)
APP_VERSION = "$${GIT_TAG} $${GIT_BRANCH} $${GIT_TIME}"
} else {
APP_VERSION = None
}
DEFINES += APP_VERSION=\"\\\"$$APP_VERSION\\\"\"
msvc {
QMAKE_CFLAGS += /utf-8
QMAKE_CXXFLAGS += /utf-8
}
include(./ComponentUI/ComponentUI.pri)
include (./ToolsUI/ToolsUI.pri)