-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautoversioning.pri
41 lines (29 loc) · 1.89 KB
/
autoversioning.pri
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# only write new version files in release mode
# in debug mode: only make sure that the files exist, but do not update them
message(AUTOVERSIONING IN $$PWD)
#try to read compiler name and version
COMPILERVERSION=$$system($$QMAKE_CXX --version)
COMPILERVERSION_MACHINE=$$system($$QMAKE_CXX -dumpmachine)
message($$QMAKE_CXX .$${DIR_SEPARATOR}tools$${DIR_SEPARATOR}ls3infotool$${DIR_SEPARATOR}main.cpp -o .$${DIR_SEPARATOR}output$${DIR_SEPARATOR}ls3infotool$${EXE_SUFFIX})
system($$QMAKE_CXX .$${DIR_SEPARATOR}tools$${DIR_SEPARATOR}ls3infotool$${DIR_SEPARATOR}main.cpp -o .$${DIR_SEPARATOR}output$${DIR_SEPARATOR}ls3infotool$${EXE_SUFFIX})
# try to read the GIT version
GITCOMMITCOUNT = $$system(git rev-list HEAD --count)
contains(GITCOMMITCOUNT,exported):GITCOMMITCOUNT=
contains(GITCOMMITCOUNT,exported):GITCOMMITCOUNT=
isEmpty(GITCOMMITCOUNT) {
GITCOMMITCOUNT = ---
}
DATESTR = $$system(.$${DIR_SEPARATOR}output$${DIR_SEPARATOR}ls3infotool$${EXE_SUFFIX} --date)
DATESTRYEAR = $$system(.$${DIR_SEPARATOR}output$${DIR_SEPARATOR}ls3infotool$${EXE_SUFFIX} --year)
message("COMPILE MODE: GITCOMMITCOUNT is: $$GITCOMMITCOUNT")
message("COMPILE MODE: build date is: $$DATESTR")
message("COMPILE MODE: compiler: $$COMPILERVERSION")
message("COMPILE MODE: compiler.machine: $$COMPILERVERSION_MACHINE")
system($$PWD$${DIR_SEPARATOR}output$${DIR_SEPARATOR}ls3infotool$${EXE_SUFFIX} --writedate $$PWD$${DIR_SEPARATOR}compiledate.h)
win32 {
system(echo $$LITERAL_HASH define GITCOMMITCOUNT \"$$GITCOMMITCOUNT\" > gitversion.h )
system(echo $$LITERAL_HASH define COMPILER \"$$COMPILERVERSION (MACHINE: $$COMPILERVERSION_MACHINE)\" > compiler.h )
} else {
system(echo \'$$LITERAL_HASH define GITCOMMITCOUNT \"$$GITCOMMITCOUNT\"\' > gitversion.h )
system(echo \'$$LITERAL_HASH define COMPILER \"$$COMPILERVERSION (MACHINE: $$COMPILERVERSION_MACHINE)\"\' > compiler.h )
}