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