File tree Expand file tree Collapse file tree 4 files changed +35
-4
lines changed
Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -156,3 +156,20 @@ defineReplace(tsFiles) {
156156
157157 return ($$file_list)
158158}
159+
160+ defineReplace(getVersion) {
161+ version_file = gcodeshared/include/version.h
162+ !exists ($${PROJECT_ROOT_PATH}/$${version_file} ): error (In function getVersion: File \"$${version_file}\" not found )
163+ version_header = $$cat ($${PROJECT_ROOT_PATH }/ $${version_file }, lines )
164+
165+ for (str, version_header ) {
166+ sub_str=$$split (str , " " )
167+
168+ contains (sub_str, GCODEWORKSHOP_VERSION ) {
169+ ver_str=$$find (sub_str , '" .*" ')
170+ !isEmpty (ver_str ): return ($$split(ver_str, '"'))
171+ }
172+ }
173+
174+ error (In function getVersion: GCODEWORKSHOP_VERSION not found in $${version_file} )
175+ }
Original file line number Diff line number Diff line change 11# GCoderFileServer
22
3- VERSION = 0.1.0.0
43TEMPLATE = app
54TARGET = gcodefileserver
65
7- include (../common.pri )
8-
96QT *= widgets serialport network
107MODULES *= kdiff3 qtsingleapplication GCodeShared
118
129include (../common.pri )
1310
11+ defined(VERSION , var) {
12+ # Define the version as a string literal
13+ # https://stackoverflow.com/a/2411008
14+ DEFINES += 'GCODEWORKSHOP_VERSION =\ \"$$VERSION\\"'
15+ } else {
16+ VERSION = $$getVersion ()
17+ }
1418
1519SOURCES = \
1620 filechecker.cpp \
Original file line number Diff line number Diff line change 11
2- VERSION = 2018.07
32TEMPLATE = app
43TARGET = gcodeworkshop
54
@@ -8,6 +7,14 @@ MODULES *= kdiff3 qtsingleapplication GCodeShared GCodeFileServer addons
87
98include (../common.pri )
109
10+ defined(VERSION , var) {
11+ # Define the version as a string literal
12+ # https://stackoverflow.com/a/2411008
13+ DEFINES += 'GCODEWORKSHOP_VERSION =\ \"$$VERSION\\"'
14+ } else {
15+ VERSION = $$getVersion ()
16+ }
17+
1118INCLUDEPATH += include
1219
1320
Original file line number Diff line number Diff line change @@ -53,3 +53,6 @@ win32 {
5353
5454 INSTALLS += translate examples doc
5555}
56+
57+ !defined(VERSION , var): VERSION = $$getVersion ()
58+ message (Project version: $$VERSION )
You can’t perform that action at this time.
0 commit comments