34
|
1 |
#
|
|
2 |
#############################################################################
|
|
3 |
##
|
|
4 |
## Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
5 |
## All rights reserved.
|
|
6 |
## Contact: Nokia Corporation (developer.feedback@nokia.com)
|
|
7 |
##
|
|
8 |
## This file is part of the UI Extensions for Mobile.
|
|
9 |
##
|
|
10 |
## GNU Lesser General Public License Usage
|
|
11 |
## This file may be used under the terms of the GNU Lesser General Public
|
|
12 |
## License version 2.1 as published by the Free Software Foundation and
|
|
13 |
## appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
14 |
## Please review the following information to ensure the GNU Lesser General
|
|
15 |
## Public License version 2.1 requirements will be met:
|
|
16 |
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
17 |
##
|
|
18 |
## In addition, as a special exception, Nokia gives you certain additional
|
|
19 |
## rights. These rights are described in the Nokia Qt LGPL Exception
|
|
20 |
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
21 |
##
|
|
22 |
## If you have questions regarding the use of this file, please contact
|
|
23 |
## Nokia at developer.feedback@nokia.com.
|
|
24 |
##
|
|
25 |
#############################################################################
|
|
26 |
#
|
|
27 |
|
|
28 |
defineReplace(hbLibraryTarget) {
|
|
29 |
unset(LIBRARY_NAME)
|
|
30 |
LIBRARY_NAME = $$1
|
|
31 |
# the following leads to ugly vcproj names but had to be commented
|
|
32 |
# out, because it broke vcproj generator dependency checks
|
|
33 |
#!debug_and_release|build_pass { <--
|
|
34 |
CONFIG(debug, debug|release) {
|
|
35 |
mac:RET = $$member(LIBRARY_NAME, 0)_debug
|
|
36 |
else:win32:RET = $$member(LIBRARY_NAME, 0)d
|
|
37 |
}
|
|
38 |
#}
|
|
39 |
isEmpty(RET):RET = $$LIBRARY_NAME
|
|
40 |
return($$RET)
|
|
41 |
}
|
|
42 |
|
|
43 |
# params: <collection/library>
|
|
44 |
# eg. hbAddLibrary(hbcore/HbCore)
|
|
45 |
defineTest(hbAddLibrary) {
|
|
46 |
PARTS = $$split(1, "/")
|
|
47 |
COLLECTION = $$lower($$first(PARTS))
|
|
48 |
LIBRARY = $$last(PARTS)
|
|
49 |
|
|
50 |
INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
|
|
51 |
INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/restricted
|
|
52 |
INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
|
|
53 |
DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
|
|
54 |
DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/restricted
|
|
55 |
DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
|
|
56 |
|
|
57 |
LIBS *= -L$${HB_BUILD_DIR}/lib
|
|
58 |
LIBS *= -l$$hbLibraryTarget($$LIBRARY)
|
|
59 |
unix:HB_COVERAGE_EXCLUDE += \"*/$$COLLECTION/*\"
|
|
60 |
|
|
61 |
export(LIBS)
|
|
62 |
export(INCLUDEPATH)
|
|
63 |
export(DEPENDPATH)
|
|
64 |
export(HB_COVERAGE_EXCLUDE)
|
|
65 |
return(true)
|
|
66 |
}
|
|
67 |
|
|
68 |
# params: <path>
|
|
69 |
# eg. foo_path = $$hbStripDriveLetter($$PWD)/foo.txt
|
|
70 |
defineReplace(hbStripDriveLetter) {
|
|
71 |
stripped_path = $$1
|
|
72 |
symbian {
|
|
73 |
contains(QMAKE_HOST.os, Windows) {
|
|
74 |
colons_found = $$find( stripped_path, "\\:" )
|
|
75 |
!isEmpty(colons_found) {
|
|
76 |
stripped_path = $$section(stripped_path, ":", 1)
|
|
77 |
}
|
|
78 |
}
|
|
79 |
}
|
|
80 |
return($$stripped_path)
|
|
81 |
}
|
|
82 |
|
|
83 |
# params: <sourcepath> <targetpath>
|
|
84 |
# e.g. hbPrjExport("$${PWD}/foo.txt", "$${EPOCROOT}epoc32/release/foo.txt")
|
|
85 |
defineTest(hbPrjExport) {
|
|
86 |
BLD_INF_RULES.prj_exports += "$$hbStripDriveLetter($$1) $$hbStripDriveLetter($$2)"
|
|
87 |
export(BLD_INF_RULES.prj_exports)
|
|
88 |
return(true)
|
|
89 |
}
|
|
90 |
|
|
91 |
# params: <sourcepath> <targetpath>
|
|
92 |
# e.g. hbToolExport("$${HB_BUILD_DIR}/bin/docml2bin", "$${HB_BIN_DIR}/docml2bin")
|
|
93 |
defineTest(hbToolExport) {
|
|
94 |
contains(QMAKE_HOST.os, Windows) {
|
|
95 |
1 = "$${1}.exe"
|
|
96 |
2 = "$${2}.exe"
|
|
97 |
}
|
|
98 |
exists($$1) {
|
|
99 |
hbPrjExport($$1, $$2)
|
|
100 |
return(true)
|
|
101 |
}
|
|
102 |
return(false)
|
|
103 |
}
|
|
104 |
|
|
105 |
# params: <collection>
|
|
106 |
# NOTE: exports PUBLIC_HEADERS, RESTRICTED_HEADERS and CONVENIENCE_HEADERS
|
|
107 |
# eg. hbExportHeaders(hbcore)
|
|
108 |
defineTest(hbExportHeaders) {
|
|
109 |
for(PUBLIC_HEADER, PUBLIC_HEADERS) {
|
|
110 |
contains(QMAKE_HOST.os, Windows):PUBLIC_HEADER = $$section(PUBLIC_HEADER, ":", 1)
|
|
111 |
EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(PUBLIC_HEADER))
|
|
112 |
BLD_INF_RULES.prj_exports *= "$$PUBLIC_HEADER $$EXPORT_PATH"
|
|
113 |
}
|
|
114 |
for(RESTRICTED_HEADER, RESTRICTED_HEADERS) {
|
|
115 |
contains(QMAKE_HOST.os, Windows):RESTRICTED_HEADER = $$section(RESTRICTED_HEADER, ":", 1)
|
|
116 |
EXPORT_PATH = $$sprintf($$HB_RESTRICTED_EXPORT_DIR, $$1, $$basename(RESTRICTED_HEADER))
|
|
117 |
BLD_INF_RULES.prj_exports *= "$$RESTRICTED_HEADER $$EXPORT_PATH"
|
|
118 |
}
|
|
119 |
for(CONVENIENCE_HEADER, CONVENIENCE_HEADERS) {
|
|
120 |
contains(QMAKE_HOST.os, Windows):CONVENIENCE_HEADER = $$section(CONVENIENCE_HEADER, ":", 1)
|
|
121 |
EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(CONVENIENCE_HEADER))
|
|
122 |
BLD_INF_RULES.prj_exports *= "$$CONVENIENCE_HEADER $$EXPORT_PATH"
|
|
123 |
}
|
|
124 |
export(BLD_INF_RULES.prj_exports)
|
|
125 |
return(true)
|
|
126 |
}
|
|
127 |
|
|
128 |
# params: -
|
|
129 |
# eg. $$hbUnixStyle():CMD=/path/to/cmd else:CMD=\path\to\cmd
|
|
130 |
defineTest(hbUnixStyle) {
|
|
131 |
contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) {
|
|
132 |
unixstyle = false
|
|
133 |
} else {
|
|
134 |
unixstyle = true
|
|
135 |
}
|
|
136 |
return($$unixstyle)
|
|
137 |
}
|
|
138 |
|
|
139 |
# params: <path>
|
|
140 |
# eg. features.path = $$hbNativePath($$[QMAKE_MKSPECS]/features)
|
|
141 |
defineReplace(hbNativePath) {
|
|
142 |
contains(QMAKE_HOST.os, Windows) {
|
|
143 |
isEmpty(QMAKE_SH) {
|
|
144 |
1 = $$replace(1, \\\\, $$QMAKE_DIR_SEP)
|
|
145 |
1 = $$replace(1, /, $$QMAKE_DIR_SEP)
|
|
146 |
} else {
|
|
147 |
1 = $$replace(1, \\\\, /)
|
|
148 |
1 = $$replace(1, /, /)
|
|
149 |
}
|
|
150 |
} else {
|
|
151 |
1 = $$replace(1, \\\\, $$QMAKE_DIR_SEP)
|
|
152 |
1 = $$replace(1, /, $$QMAKE_DIR_SEP)
|
|
153 |
}
|
|
154 |
|
|
155 |
return($$quote(\"$$1\"))
|
|
156 |
}
|
|
157 |
|
|
158 |
# params: <tool name>
|
|
159 |
# eg. hbfoo.command = $$hbToolCommand(hbfoo)
|
|
160 |
defineReplace(hbToolCommand) {
|
|
161 |
symbian {
|
|
162 |
# tool in PATH?
|
|
163 |
exists(/dev/null) {
|
|
164 |
DEVNULL = /dev/null
|
|
165 |
} else {
|
|
166 |
DEVNULL = nul
|
|
167 |
}
|
|
168 |
system($$1 > $$DEVNULL 2>&1):return($$1)
|
|
169 |
|
|
170 |
# host build is runnable?
|
|
171 |
!isEmpty(HB_BUILD_DIR) {
|
|
172 |
hbtoolcmd = $$hbNativePath($$HB_BUILD_DIR/bin/$$1)
|
|
173 |
system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
|
|
174 |
}
|
|
175 |
|
|
176 |
# tool in HB_BIN_DIR?
|
|
177 |
hbtoolcmd = $$hbNativePath($$HB_BIN_DIR/$$1)
|
|
178 |
system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
|
|
179 |
|
|
180 |
# pre-built tool is runnable?
|
|
181 |
hbtoolcmd = $$hbNativePath($$sprintf("%1%2", $$HB_SOURCE_DIR/bin/$$1, "_symbian.exe"))
|
|
182 |
system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
|
|
183 |
}
|
|
184 |
|
|
185 |
!isEmpty(HB_BUILD_DIR) {
|
|
186 |
# prefer <builddir>/bin
|
|
187 |
return($$hbNativePath($$HB_BUILD_DIR/bin/$$1))
|
|
188 |
} else {
|
|
189 |
# fall back to <bindir>
|
|
190 |
return($$hbNativePath($$HB_BIN_DIR/$$1))
|
|
191 |
}
|
|
192 |
}
|
|
193 |
|
|
194 |
# params: <file> <dir>
|
|
195 |
defineReplace(hbCopyCommand) {
|
|
196 |
file = $$hbNativePath($$1)
|
|
197 |
dir = $$hbNativePath($$2)
|
|
198 |
|
|
199 |
contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) {
|
|
200 |
chk_dir_exists = if not exist $$dir
|
|
201 |
mkdir = mkdir $$dir
|
|
202 |
copy = copy /y $$file $$dir
|
|
203 |
} else {
|
|
204 |
chk_dir_exists = test -d $$dir
|
|
205 |
mkdir = mkdir -p $$dir
|
|
206 |
copy = cp $$file $$dir
|
|
207 |
}
|
|
208 |
|
|
209 |
hbUnixStyle(): chk_dir_exists_mkdir = $$chk_dir_exists || $$mkdir
|
|
210 |
else:chk_dir_exists_mkdir = $$chk_dir_exists $$mkdir
|
|
211 |
|
|
212 |
return(($$chk_dir_exists_mkdir) && $$copy)
|
|
213 |
}
|
|
214 |
|
|
215 |
defineReplace(hbCreateDir) {
|
|
216 |
dir = $$hbNativePath($$1)
|
|
217 |
|
|
218 |
contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) {
|
|
219 |
chk_dir_exists = if not exist $$dir
|
|
220 |
mkdir = mkdir $$dir
|
|
221 |
} else {
|
|
222 |
chk_dir_exists = test -d $$dir
|
|
223 |
mkdir = mkdir -p $$dir
|
|
224 |
}
|
|
225 |
|
|
226 |
hbUnixStyle(): chk_dir_exists_mkdir = $$chk_dir_exists || $$mkdir
|
|
227 |
else:chk_dir_exists_mkdir = $$chk_dir_exists $$mkdir
|
|
228 |
|
|
229 |
return($$chk_dir_exists_mkdir)
|
|
230 |
}
|