Skip to content

Commit 03a450c

Browse files
committed
Use git tag as application version
1 parent fa72d03 commit 03a450c

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

application/application.pro

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
QT += quick serialport widgets quickcontrols2 svg
22

33
TARGET = qFlipper
4-
VERSION = 0.1
5-
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
4+
5+
GIT_VERSION = $$system("git describe --tags --abbrev=0","lines", HAS_VERSION)
6+
7+
equals(HAS_VERSION, 0) {
8+
RC_SUFFIX = -rc
9+
10+
contains(GIT_VERSION, .*$$RC_SUFFIX) {
11+
# Remove -rc suffix as it isn't allowed in Windows manifest
12+
VERSION = $$str_member($$GIT_VERSION, 0, $$num_add($$str_size($$GIT_VERSION), -$$num_add($$str_size($$RC_SUFFIX), 1)))
13+
} else {
14+
VERSION = $$GIT_VERSION
15+
}
16+
17+
} else {
18+
VERSION = 0.0.0
19+
GIT_VERSION = unknown
20+
}
21+
22+
DEFINES += APP_VERSION=\\\"$$GIT_VERSION\\\"
623
DESTDIR = ..
724

825
CONFIG += c++11

0 commit comments

Comments
 (0)