##// END OF EJS Templates
Fix building debug & release at the same time...
Jani Honkonen -
r1433:37348a205270
parent child
Show More
@@ -1,93 +1,97
1 1
2 2 LIBRARY_NAME = QtCommercialChart
3 3 coverage: CONFIG+=debug
4 4
5 5 ##################### SHADOW CONFIG #################################################
6 6
7 7 !contains($${PWD}, $${OUT_PWD}){
8 8 search = "$$PWD:::"
9 9 temp = $$split(search,"/")
10 10 temp = $$last(temp)
11 11 path = $$replace(search,$$temp,'')
12 12 temp = $$split(OUT_PWD,$$path)
13 13 temp = $$split(temp,'/')
14 14 temp = $$first(temp)
15 15 path = "$${path}$${temp}"
16 16 SHADOW=$$path
17 17 }else{
18 18 SHADOW=$$PWD
19 19 CONFIG-=development_build
20 20 }
21 21
22 22 ##################### BUILD PATHS ##################################################
23 23
24 24 CHART_BUILD_PUBLIC_HEADER_DIR = $$SHADOW/include
25 25 CHART_BUILD_PRIVATE_HEADER_DIR = $$CHART_BUILD_PUBLIC_HEADER_DIR/private
26 26 CHART_BUILD_LIB_DIR = $$SHADOW/lib
27 27 CHART_BUILD_DIR = $$SHADOW/build
28 28 CHART_BUILD_BIN_DIR = $$SHADOW/bin
29 29 CHART_BUILD_PLUGIN_DIR = $$CHART_BUILD_BIN_DIR/QtCommercial/Chart
30 30 CHART_BUILD_DOC_DIR = $$SHADOW/doc
31 31
32 # Use own folders for debug and release builds
33 CONFIG(debug, debug|release):CHART_BUILD_DIR = $$join(CHART_BUILD_DIR,,,/debug)
34 CONFIG(release, debug|release): CHART_BUILD_DIR = $$join(CHART_BUILD_DIR,,,/release)
35
32 36 win32:{
33 37 CHART_BUILD_PUBLIC_HEADER_DIR = $$replace(CHART_BUILD_PUBLIC_HEADER_DIR, "/","\\")
34 38 CHART_BUILD_PRIVATE_HEADER_DIR = $$replace(CHART_BUILD_PRIVATE_HEADER_DIR, "/","\\")
35 39 CHART_BUILD_BUILD_DIR = $$replace(CHART_BUILD_BUILD_DIR, "/","\\")
36 40 CHART_BUILD_BIN_DIR = $$replace(CHART_BUILD_BIN_DIR, "/","\\")
37 41 CHART_BUILD_PLUGIN_DIR = $$replace(CHART_BUILD_PLUGIN_DIR, "/","\\")
38 42 CHART_BUILD_DOC_DIR = $$replace(CHART_BUILD_DOC_DIR, "/","\\")
39 43 CHART_BUILD_LIB_DIR = $$replace(CHART_BUILD_LIB_DIR, "/","\\")
40 44 }
41 45
42 46 mac: {
43 47 # TODO: The following qmake flags are a work-around to make QtCommercial Charts compile on
44 48 # QtCommercial 4.8. On the other hand Charts builds successfully with Qt open source 4.8
45 49 # without these definitions, so this is probably a configuration issue on QtCommercial 4.8;
46 50 # it should probably define the minimum OSX version to be 10.5...
47 51 QMAKE_CXXFLAGS *= -mmacosx-version-min=10.5
48 52 QMAKE_LFLAGS *= -mmacosx-version-min=10.5
49 53 }
50 54
51 55 ##################### DEVELOPMENT BUILD ###################################################
52 56
53 57 development_build: {
54 58 DEFINES+=DEVELOPMENT_BUILD
55 59 CONFIG+=debug_and_release
56 60 }
57 61
58 62
59 63 ##################### BUILD CONFIG ########################################################
60 64
61 65 CONFIG(debug, debug|release) {
62 66 mac: LIBRARY_NAME = $$join(LIBRARY_NAME,,,_debug)
63 67 win32: LIBRARY_NAME = $$join(LIBRARY_NAME,,,d)
64 68 }
65 69
66 70 !system_build:{
67 71
68 72 INCLUDEPATH += $$CHART_BUILD_PUBLIC_HEADER_DIR
69 73
70 74 !win32: {
71 75 LIBS += -L $$CHART_BUILD_LIB_DIR -Wl,-rpath,$$CHART_BUILD_LIB_DIR
72 76 } else {
73 77 win32-msvc*: {
74 78 # hack fix for error:
75 79 # "LINK : fatal error LNK1146: no argument specified with option '/LIBPATH:'"
76 80 QMAKE_LIBDIR += $$CHART_BUILD_LIB_DIR
77 81 } else {
78 82 LIBS += -L $$CHART_BUILD_LIB_DIR
79 83 }
80 84 }
81 85
82 86 LIBS += -l$$LIBRARY_NAME
83 87 } else {
84 88 CONFIG += qtcommercialchart
85 89 }
86 90
87 91 ##################### UNIT TESTS ##############################################################
88 92
89 93 CONFIG(debug, debug|release) {
90 94 CONFIG+=test_private
91 95 DEFINES+=BUILD_PRIVATE_UNIT_TESTS
92 96 }
93 97
@@ -1,44 +1,55
1 1 TARGET = qtcommercialchartqml
2 2 QT += declarative
3 3
4 4 !include( ../plugins.pri ) {
5 5 error( "Couldn't find the plugins.pri file!" )
6 6 }
7 7
8 8 contains(QT_MAJOR_VERSION, 5) {
9 9 # TODO: QtQuick2 not supported by the implementation currently
10 10 DEFINES += QTQUICK2
11 11 }
12 12
13 CONFIG(debug, debug|release) {
14 mac: TARGET = $$join(TARGET,,,_debug)
15 win32: TARGET = $$join(TARGET,,,d)
16 }
17
18 # enable building debug and release at the same time
19 CONFIG += debug_and_release
20
21 # On windows by default build both debug and release at the same time
22 win32:CONFIG += build_all
23
13 24 SOURCES += \
14 25 plugin.cpp \
15 26 declarativechart.cpp \
16 27 declarativexypoint.cpp \
17 28 declarativexyseries.cpp \
18 29 declarativelineseries.cpp \
19 30 declarativesplineseries.cpp \
20 31 declarativeareaseries.cpp \
21 32 declarativescatterseries.cpp \
22 33 declarativepieseries.cpp \
23 34 declarativebarseries.cpp
24 35
25 36 HEADERS += \
26 37 declarativechart.h \
27 38 declarativexypoint.h \
28 39 declarativexyseries.h \
29 40 declarativelineseries.h \
30 41 declarativesplineseries.h \
31 42 declarativeareaseries.h \
32 43 declarativescatterseries.h \
33 44 declarativepieseries.h \
34 45 declarativebarseries.h
35 46
36 47 TARGETPATH = QtCommercial/Chart
37 48 target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
38 49 qmldir.files += $$PWD/qmldir
39 50 qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
40 51 INSTALLS += target qmldir
41 52
42 53 FILE = $$PWD/qmldir
43 54 win32:{FILE = $$replace(FILE, "/","\\")}
44 55 QMAKE_POST_LINK += $$QMAKE_COPY $$FILE $$CHART_BUILD_PLUGIN_DIR
@@ -1,247 +1,253
1 1 !include( ../config.pri ):error( "Couldn't find the config.pri file!" )
2 2
3 3 ############################# BUILD CONFIG ######################################
4 4
5 5 TARGET = $$LIBRARY_NAME
6 6 DESTDIR = $$CHART_BUILD_LIB_DIR
7 7 TEMPLATE = lib
8 8 QT = core gui
9 9 DEFINES += QTCOMMERCIALCHART_LIBRARY
10 10 win32:CONFIG += create_prl
11 11 # treat warnings as errors
12 12 win32-msvc*: {
13 13 QMAKE_CXXFLAGS += /WX
14 14 } else {
15 15 QMAKE_CXXFLAGS += -Werror
16 16 }
17 17
18 18 unix:{
19 19 QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
20 20 }
21 21
22 # enable building debug and release at the same time
23 CONFIG += debug_and_release
24
25 # On windows by default build both debug and release at the same time
26 win32:CONFIG += build_all
27
22 28 ############################# DEPEDENCES ########################################
23 29
24 30 win32-msvc*: LIBS += User32.lib
25 31 LIBS -= -l$$LIBRARY_NAME
26 32 INCLUDEPATH += ../include .
27 33
28 34 ############################# SOURCES ##########################################
29 35
30 36 SOURCES += \
31 37 $$PWD/chartdataset.cpp \
32 38 $$PWD/chartpresenter.cpp \
33 39 $$PWD/charttheme.cpp \
34 40 $$PWD/domain.cpp \
35 41 $$PWD/qchart.cpp \
36 42 $$PWD/qchartview.cpp \
37 43 $$PWD/qabstractseries.cpp \
38 44 $$PWD/chartbackground.cpp \
39 45 $$PWD/chart.cpp \
40 46 $$PWD/scroller.cpp
41 47 PRIVATE_HEADERS += \
42 48 $$PWD/chartdataset_p.h \
43 49 $$PWD/chartitem_p.h \
44 50 $$PWD/chartpresenter_p.h \
45 51 $$PWD/charttheme_p.h \
46 52 $$PWD/domain_p.h \
47 53 $$PWD/chartbackground_p.h \
48 54 $$PWD/chart_p.h \
49 55 $$PWD/chartconfig_p.h \
50 56 $$PWD/qchart_p.h \
51 57 $$PWD/qchartview_p.h \
52 58 $$PWD/scroller_p.h \
53 59 $$PWD/qabstractseries_p.h
54 60 PUBLIC_HEADERS += \
55 61 $$PWD/qchart.h \
56 62 $$PWD/qchartglobal.h \
57 63 $$PWD/qabstractseries.h \
58 64 $$PWD/qchartview.h
59 65
60 66 include(animations/animations.pri)
61 67 include(areachart/areachart.pri)
62 68 include(axis/axis.pri)
63 69 include(barchart/barchart.pri)
64 70 include(legend/legend.pri)
65 71 include(linechart/linechart.pri)
66 72 include(piechart/piechart.pri)
67 73 include(scatterchart/scatter.pri)
68 74 include(splinechart/splinechart.pri)
69 75 include(themes/themes.pri)
70 76 include(xychart/xychart.pri)
71 77
72 78 HEADERS += $$PUBLIC_HEADERS
73 79 HEADERS += $$PRIVATE_HEADERS
74 80 HEADERS += $$THEMES
75 81
76 82 ############################# BUILD PATH ##########################################
77 83
78 84 OBJECTS_DIR = $$CHART_BUILD_DIR/lib
79 85 MOC_DIR = $$CHART_BUILD_DIR/lib
80 86 UI_DIR = $$CHART_BUILD_DIR/lib
81 87 RCC_DIR = $$CHART_BUILD_DIR/lib
82 88
83 89 ############################# PUBLIC HEADERS GENERTOR ##########################################
84 90
85 91 #this is very primitive and lame parser , TODO: make perl script insted
86 92 !exists($$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal)
87 93 {
88 94 system($$QMAKE_MKDIR $$CHART_BUILD_PUBLIC_HEADER_DIR)
89 95 win32:{
90 96 command = "echo $${LITERAL_HASH}include \"qchartglobal.h\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal"
91 97 }else{
92 98 command = "echo \"$${LITERAL_HASH}include \\\"qchartglobal.h\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal"
93 99 }
94 100 PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal
95 101 system($$command)
96 102 }
97 103
98 104 for(file, PUBLIC_HEADERS) {
99 105 name = $$split(file,'/')
100 106 name = $$last(name)
101 107 class = "$$cat($$file)"
102 108 class = $$find(class,class)
103 109 !isEmpty(class){
104 110 class = $$split(class,QTCOMMERCIALCHART_EXPORT)
105 111 class = $$member(class,1)
106 112 class = $$split(class,' ')
107 113 class = $$replace(class,' ','')
108 114 class = $$member(class,0)
109 115 win32:{
110 116 command = "echo $${LITERAL_HASH}include \"$$name\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class"
111 117 }else{
112 118 command = "echo \"$${LITERAL_HASH}include \\\"$$name\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class"
113 119 }
114 120 PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class
115 121 system($$command)
116 122 }
117 123 }
118 124
119 125 ############################# INSTALLERS ##########################################
120 126
121 127 public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart
122 128 public_headers.files = $$PUBLIC_HEADERS $$PUBLIC_QT_HEADERS
123 129 INSTALLS += public_headers
124 130
125 131 install_build_public_headers.name = build_public_headers
126 132 install_build_public_headers.output = $$CHART_BUILD_PUBLIC_HEADER_DIR/${QMAKE_FILE_BASE}.h
127 133 install_build_public_headers.input = PUBLIC_HEADERS
128 134 install_build_public_headers.commands = $$QMAKE_COPY \
129 135 ${QMAKE_FILE_NAME} \
130 136 $$CHART_BUILD_PUBLIC_HEADER_DIR
131 137 install_build_public_headers.CONFIG += target_predeps \
132 138 no_link
133 139
134 140 install_build_private_headers.name = buld_private_headers
135 141 install_build_private_headers.output = $$CHART_BUILD_PRIVATE_HEADER_DIR/${QMAKE_FILE_BASE}.h
136 142 install_build_private_headers.input = PRIVATE_HEADERS
137 143 install_build_private_headers.commands = $$QMAKE_COPY \
138 144 ${QMAKE_FILE_NAME} \
139 145 $$CHART_BUILD_PRIVATE_HEADER_DIR
140 146 install_build_private_headers.CONFIG += target_predeps \
141 147 no_link
142 148
143 149 QMAKE_EXTRA_COMPILERS += install_build_public_headers \
144 150 install_build_private_headers \
145 151
146 152 win32:{
147 153 bintarget.CONFIG += no_check_exist
148 154 bintarget.files = $$CHART_BUILD_LIB_DIR\\$${TARGET}.dll
149 155 win32-msvc*:CONFIG(debug, debug|release): {
150 156 bintarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.pdb
151 157 }
152 158 bintarget.path = $$[QT_INSTALL_BINS]
153 159
154 160 libtarget.CONFIG += no_check_exist
155 161 libtarget.files = $$CHART_BUILD_LIB_DIR\\$${TARGET}.prl
156 162 win32-msvc*: {
157 163 libtarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.lib
158 164 } else {
159 165 libtarget.files += $$CHART_BUILD_LIB_DIR\\lib$${TARGET}.a
160 166 }
161 167 libtarget.path = $$[QT_INSTALL_LIBS]
162 168
163 169 DLLDESTDIR = $$CHART_BUILD_BIN_DIR
164 170 INSTALLS += bintarget libtarget
165 171 }else{
166 172 target.path=$$[QT_INSTALL_LIBS]
167 173 INSTALLS += target
168 174 }
169 175
170 176 mac: {
171 177 # Update the name (id) of the library on OSX to point to the lib path
172 178 MAC_CHARTS_LIB_NAME = "lib"$$LIBRARY_NAME".1.dylib"
173 179 QMAKE_POST_LINK += "install_name_tool -id $$CHART_BUILD_LIB_DIR"/"$$MAC_CHARTS_LIB_NAME $$CHART_BUILD_LIB_DIR"/"$$MAC_CHARTS_LIB_NAME"
174 180
175 181 # Update the name (id) of the installed library on OSX to point to the installation path
176 182 postinstall.path = $$[QT_INSTALL_LIBS]
177 183 postinstall.extra = "install_name_tool -id $$[QT_INSTALL_LIBS]"/"$$MAC_CHARTS_LIB_NAME $$[QT_INSTALL_LIBS]"/"$$MAC_CHARTS_LIB_NAME"
178 184 INSTALLS += postinstall
179 185 }
180 186
181 187 ################################ DEVELOPMENT BUILD ##########################################
182 188 # There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly.
183 189 # This is the case at least with shadow builds.
184 190 # http://qt-project.org/wiki/jom
185 191
186 192 development_build:!win32-msvc*:{
187 193 chartversion.target = $$PWD/qchartversion_p.h
188 194
189 195 unix:{
190 196 chartversion.commands = @echo \
191 197 \" $${LITERAL_HASH}ifndef QCHARTVERSION_P_H\\n\
192 198 $${LITERAL_HASH}define QCHARTVERSION_P_H\\n\
193 199 const char *buildTime = \\\"`date +'%y%m%d%H%M'`\\\" ; \\n\
194 200 const char *gitHead = \\\"`git rev-parse HEAD`\\\" ; \\n \
195 201 $${LITERAL_HASH}endif \" \
196 202 > \
197 203 $$chartversion.target;
198 204 }else{
199 205 chartversion.commands = @echo \
200 206 "const char *buildTime = \"%date%_%time%\" ; \
201 207 const char *gitHead = \"unknown\" ; " \
202 208 > \
203 209 $$chartversion.target
204 210 }
205 211
206 212 chartversion.depends = $$HEADERS \
207 213 $$SOURCES
208 214
209 215 PRE_TARGETDEPS += $$chartversion.target
210 216 QMAKE_CLEAN += $$PWD/qchartversion_p.h
211 217 QMAKE_EXTRA_TARGETS += chartversion
212 218 }
213 219
214 220 ############################### CLEAN ###########################################
215 221
216 222 unix:QMAKE_DISTCLEAN += -r \
217 223 $$CHART_BUILD_HEADER_DIR \
218 224 $$CHART_BUILD_LIB_DIR
219 225 win32:QMAKE_DISTCLEAN += /Q \
220 226 $$CHART_BUILD_HEADER_DIR \
221 227 $$CHART_BUILD_LIB_DIR
222 228
223 229 ############################## COVERAGE #########################################
224 230
225 231 unix:coverage:{
226 232
227 233 QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
228 234 QMAKE_LDFLAGS += -fprofile-arcs -ftest-coverage
229 235
230 236 LIBS += -lgcov
231 237
232 238 QMAKE_CLEAN += $$OBJECTS_DIR/*.gcda $$OBJECTS_DIR/*.gcno $$PWD/*.gcov ../coverage/*.info
233 239 QMAKE_EXTRA_TARGETS += preparecoverage gencoverage
234 240
235 241 preparecoverage.target = prepare_coverage
236 242 preparecoverage.depends = all
237 243 preparecoverage.commands = lcov --directory $$OBJECTS_DIR --zerocounters ;\
238 244 lcov -i -d $$OBJECTS_DIR -c -o ../coverage/base.info -b $$PWD;
239 245
240 246 gencoverage.target = gen_coverage
241 247 gencoverage.depends = all
242 248 gencoverage.commands = lcov -d $$OBJECTS_DIR -c -o ../coverage/src.info -b $$PWD;\
243 249 lcov -e ../coverage/base.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/base.info;\
244 250 lcov -e ../coverage/src.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/src.info;\
245 251 lcov -a ../coverage/base.info -a ../coverage/src.info -o ../coverage/coverage.info;
246 252 }
247 253
General Comments 0
You need to be logged in to leave comments. Login now