1 | ###################################################################### |
---|
2 | # |
---|
3 | # TSPSG: TSP Solver and Generator |
---|
4 | # Copyright (C) 2007-2016 Oleksii Serdiuk <contacts[at]oleksii[dot]name> |
---|
5 | # |
---|
6 | # $Id: $Format:%h %ai %an$ $ |
---|
7 | # $URL: http://tspsg.info/ $ |
---|
8 | # |
---|
9 | # This file is part of TSPSG. |
---|
10 | # |
---|
11 | ###################################################################### |
---|
12 | |
---|
13 | !isEmpty(VERSION_TAG) { |
---|
14 | DESC = $$VERSION_TAG |
---|
15 | } else:exists(".git/") { |
---|
16 | DESC = $$system("git describe --abbrev=40") |
---|
17 | } else:exists(".tag") { |
---|
18 | DESC = $$cat(".tag") |
---|
19 | } |
---|
20 | !isEmpty(DESC) { |
---|
21 | DESC = $$split(DESC, "-") |
---|
22 | VER = $$member(DESC, 0) |
---|
23 | VER = $$split(VER, ".") |
---|
24 | |
---|
25 | BUILD_VERSION_MAJOR = $$member(VER, 0) |
---|
26 | BUILD_VERSION_MINOR = $$member(VER, 1) |
---|
27 | BUILD_RELEASE = $$member(VER, 2) |
---|
28 | count(DESC, 2) { |
---|
29 | # We're exactly at a tag - use whatever is provided by it |
---|
30 | BUILD_NUMBER = $$member(VER, 3) |
---|
31 | isEmpty(BUILD_NUMBER) { |
---|
32 | BUILD_NUMBER = 0 |
---|
33 | } |
---|
34 | |
---|
35 | DEFINES += TSPSG_RELEASE_BUILD |
---|
36 | DEFINES += BUILD_STATUS=$$member(DESC, 1) |
---|
37 | } else { |
---|
38 | TMP = $$member(VER, 3) |
---|
39 | TMP = $$replace(TMP, "0$", "") |
---|
40 | BUILD_NUMBER = $$TMP$$member(DESC, 2) |
---|
41 | REVISION = $$member(DESC, 3) |
---|
42 | REVISION = $$replace(REVISION, "^g", "") |
---|
43 | |
---|
44 | DEFINES += REVISION=$$REVISION |
---|
45 | } |
---|
46 | |
---|
47 | SHORT_VERSION = $$sprintf("%1.%2",$$BUILD_VERSION_MAJOR,$$BUILD_VERSION_MINOR) |
---|
48 | win32-msvc*|wincewm* { |
---|
49 | VERSION = $$SHORT_VERSION |
---|
50 | } else { |
---|
51 | VERSION = $$sprintf("%1.%2",$$SHORT_VERSION,$$BUILD_RELEASE) |
---|
52 | } |
---|
53 | } else { |
---|
54 | # We can't deduce in case we don't have git or repo was exported. |
---|
55 | # For this case defaults are provided. |
---|
56 | BUILD_VERSION_MAJOR = 0 |
---|
57 | BUILD_VERSION_MINOR = 1 |
---|
58 | BUILD_RELEASE = 4 |
---|
59 | BUILD_NUMBER = 0 |
---|
60 | } |
---|