mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 06:11:11 -05:00
More robust automatic version determination
Should work also with older qmake that miss take_first function
This commit is contained in:
parent
dde9acb40a
commit
4f4e2d2bbb
@ -303,35 +303,42 @@ defined(RS_MAJOR_VERSION,var):\
|
||||
defined(RS_MINOR_VERSION,var):\
|
||||
defined(RS_MINI_VERSION,var):\
|
||||
defined(RS_EXTRA_VERSION,var) {
|
||||
message("RetroShare version $${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION} defined in command line")
|
||||
message("RetroShare version\
|
||||
$${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION}\
|
||||
defined in command line")
|
||||
DEFINES += RS_MAJOR_VERSION=$${RS_MAJOR_VERSION}
|
||||
DEFINES += RS_MINOR_VERSION=$${RS_MINOR_VERSION}
|
||||
DEFINES += RS_MINI_VERSION=$${RS_MINI_VERSION}
|
||||
DEFINES += RS_EXTRA_VERSION=\\\"$${RS_EXTRA_VERSION}\\\"
|
||||
} else {
|
||||
RS_GIT_DESCRIBE = $$system(git describe)
|
||||
isEmpty(RS_GIT_DESCRIBE) {
|
||||
warning("Determining RetroShare version via git failed plese specify it trough qmake command line arguments!")
|
||||
} else {
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE,v)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT,.)
|
||||
contains(RS_GIT_DESCRIBE, ^v\d+\.\d+\.\d+.*) {
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE, v)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT, .)
|
||||
|
||||
RS_MAJOR_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_MINOR_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_MAJOR_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 0)
|
||||
RS_MINOR_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 1)
|
||||
|
||||
RS_GIT_DESCRIBE_SPLIT = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT,-)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$member(RS_GIT_DESCRIBE_SPLIT, 2)
|
||||
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT, -)
|
||||
|
||||
RS_MINI_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 0)
|
||||
|
||||
RS_GIT_DESCRIBE_SPLIT = $$member(RS_GIT_DESCRIBE_SPLIT, 1, -1)
|
||||
|
||||
RS_MINI_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
|
||||
RS_EXTRA_VERSION = $$join(RS_GIT_DESCRIBE_SPLIT,-,-)
|
||||
|
||||
message("RetroShare version $${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION} determined via git")
|
||||
message("RetroShare version\
|
||||
$${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION}\
|
||||
determined via git")
|
||||
|
||||
DEFINES += RS_MAJOR_VERSION=$${RS_MAJOR_VERSION}
|
||||
DEFINES += RS_MINOR_VERSION=$${RS_MINOR_VERSION}
|
||||
DEFINES += RS_MINI_VERSION=$${RS_MINI_VERSION}
|
||||
DEFINES += RS_EXTRA_VERSION=\\\"$${RS_EXTRA_VERSION}\\\"
|
||||
} else {
|
||||
warning("Determining RetroShare version via git failed plese specify it\
|
||||
trough qmake command line arguments!")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user