forked from b-com-software-basis/builddefs-qmake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_dependencies.pri
239 lines (219 loc) · 9.98 KB
/
install_dependencies.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# Author(s) : Loic Touraine, Stephane Leduc
# echo R for manage Path instead file!
REMAKEN_XCOPY= echo R | xcopy /Y /Q
# remove/replace forbidden chars
defineReplace(ReplaceSpecialCharacter) {
str = $$ARGS
str = $$replace(str, "<>", "-")
str = $$replace(str, "<", "")
str = $$replace(str, ">", "")
str = $$replace(str, "/", "_")
#str = $$replace(str, "\\", "_")
str = $$replace(str, ":", "_")
#str = $$replace(str, "*", "")
str = $$replace(str, "\?", "")
str = $$replace(str, "\"", "_")
str = $$replace(str, "|", "")
return($${str})
}
equals (MAKEFILE_GENERATOR, MSBUILD) \
|equals (MAKEFILE_GENERATOR, MSVC.NET) \
|isEmpty(QMAKE_SH) {
REMAKEN_DEPS_COPY = xcopy /Y /Q
}
else {
macx {
REMAKEN_DEPS_COPY = cp -f -a
} else {
REMAKEN_DEPS_COPY = cp -f -r --preserve=links
}
}
win32 {
REMAKEN_CONAN_BINDIRS_BASENAME=CONAN_BINDIRS
# bat init header
contains(PROJECTCONFIG,QTVS) {
INSTALL_DEPS_FILE=$$OUT_PWD/$${TARGET}-InstallDependencies_$${OUTPUTDIR}.bat
BAT_HEADER_COMMAND = "@echo off"
write_file($${INSTALL_DEPS_FILE},BAT_HEADER_COMMAND)
}
}
else {
REMAKEN_CONAN_BINDIRS_BASENAME=CONAN_LIBDIRS
}
message(" ")
message("----------------------------------------------------------------")
message("STEP => INSTALL - prepare dependencies installation")
message("----------------------------------------------------------------")
message(" ")
win32 {
!isEmpty(INSTALL_DEPS_FILE) {
message("---- generates $$INSTALL_DEPS_FILE for msvc post Install ----" )
}
}
contains(DEPENDENCIESCONFIG,install_recurse) {
#recursive dependencies parsing
installdeps_depsfiles = $$packagedepsfiles # used in packagedependencies.pri
message("---- Install recurse dependencies for project $${TARGET} :" )
} else {
message("---- Install 1st level dependencies for project $${TARGET} :" )
# No Recursive dependencie parsing!
installdeps_depsfiles = $$OUT_PWD/packagedependencies.txt
win32:!android {
installdeps_depsfiles += $$OUT_PWD/packagedependencies-win.txt
}
unix {
installdeps_depsfiles += $$OUT_PWD/packagedependencies-unix.txt
}
macx:!android {
installdeps_depsfiles += $$OUT_PWD/packagedependencies-mac.txt
}
linux:!android {
installdeps_depsfiles += $$OUT_PWD/packagedependencies-linux.txt
}
android {
installdeps_depsfiles += $$OUT_PWD/packagedependencies-android.txt
}
}
ignorefile = $$_PRO_FILE_PWD_/packageignoreinstall.txt
exists($${ignorefile}) {
message(" -- Search Ignore Dependencies in $${ignorefile} --" )
ignoredeps = $$cat($${ignorefile})
for(var, ignoredeps) {
message (" --> $$var ignored")
}
}
for(depfile, installdeps_depsfiles) {
!exists($${depfile}) {
message(" -- No " $${depfile} " file to process for " $$TARGET)
} else {
message(" -- Install Dependencies Processing $${depfile} --" )
dependencies = $$cat($${depfile})
for(var, dependencies) {
dependencyMetaInf = $$split(var,|)
pkgInformation = $$member(dependencyMetaInf,0)
pkgInfoList = $$split(pkgInformation, $$LITERAL_HASH)
pkg.name = $$member(pkgInfoList,0)
pkg.channel = "stable"
pkgInfoListSize = $$size(pkgInfoList)
equals(pkgInfoListSize,2) {
pkg.channel = $$member(pkgInfoList,1)
}
pkg.version = $$member(dependencyMetaInf,1)
libName = $$member(dependencyMetaInf,2)
pkgTypeInformation = $$member(dependencyMetaInf,3)
pkgTypeInfoList = $$split(pkgTypeInformation, @)
pkg.identifier = $$member(pkgTypeInfoList,0)
pkg.repoType = $${pkg.identifier}
pkgTypeInfoListSize = $$size(pkgTypeInfoList)
equals(pkgTypeInfoListSize,2) {
pkg.repoType = $$member(pkgTypeInfoList,1)
} else {
equals(pkg.identifier,"bcomBuild")|equals(pkg.identifier,"thirdParties") {
pkg.repoType = "artifactory"
} # otherwise pkg.repoType = pkg.identifier
}
pkg.repoUrl=$$member(dependencyMetaInf,4)
pkg.linkMode = $$member(dependencyMetaInf,5)
pkg.toolOptions = $$member(dependencyMetaInf,6)
# check pkg.linkMode not empty and mandatory equals to static|shared, otherwise set to default DEPLINKMODE
equals(pkg.linkMode,"")|equals(pkg.linkMode,"default") {
pkg.linkMode = $${DEPLINKMODE}
} else {
if (!equals(pkg.linkMode,"static"):!equals(pkg.linkMode,"shared"):!equals(pkg.linkMode,"na")){
pkg.linkMode = $${DEPLINKMODE}
}
}
# Artifactory dependencies
equals(pkg.repoType,"artifactory") | equals(pkg.repoType,"github") | equals(pkg.repoType,"nexus") {
equals(pkg.linkMode, "shared") {
!contains(ignoredeps, $${pkg.name}) {
# custom built package handling
deployFolder=$${REMAKENDEPSFOLDER}/$${BCOM_TARGET_PLATFORM}/$${pkg.name}/$${pkg.version}
!equals(pkg.identifier,$${pkg.repoType}) {
deployFolder=$${REMAKENDEPSFOLDER}/$${BCOM_TARGET_PLATFORM}/$${pkg.identifier}/$${pkg.name}/$${pkg.version}
!exists($${deployFolder}) { #try old structure for backward compatibility
deployFolder=$${REMAKENDEPSFOLDER}/$${pkg.identifier}/$${BCOM_TARGET_PLATFORM}/$${pkg.name}/$${pkg.version}
}
}
!exists($${deployFolder}) {
warning("Dependencies source folder should include the target platform information " $${BCOM_TARGET_PLATFORM})
deployFolder=$${REMAKENDEPSFOLDER}/$${pkg.name}/$${pkg.version}
!equals(pkg.identifier,$${pkg.repoType}) {
deployFolder=$${REMAKENDEPSFOLDER}/$${pkg.identifier}/$${pkg.name}/$${pkg.version}
}
warning("Defaulting search folder to " $${deployFolder})
}
depOutputDir=$${deployFolder}/lib/$$BCOM_TARGET_ARCH/$${pkg.linkMode}/$$OUTPUTDIR
!exists($${depOutputDir}/) {
message(" --> [INFO] package without binaries : $${libName}")
} else {
sharedLibFiles += $$files($${depOutputDir}/*.$${DYNLIBEXT}*)
message(" --> [INFO] install $${pkg.repoType} dependency : $${pkg.name} (from $${depOutputDir})")
}
} else {
message(" --> [INFO] Ignore install for $${pkg.repoType} dependency : $${pkg.name}")
}
}
}
equals(pkg.repoType,"conan") {# conan system package handling
contains(ignoredeps, $${pkg.name}) {
# list of ignored conan dependencies - used for install_recurse
REMAKEN_IGNORE_CONAN_BINDIRS += $${REMAKEN_CONAN_BINDIRS_BASENAME}_$$upper($${pkg.name})
message(" --> [INFO] Ignore install for $${pkg.repoType} dependency : $${pkg.name}")
} else {
# list of conan dependencies to install - used for install (not recurse)
REMAKEN_CONAN_BINDIRS += $$eval($${REMAKEN_CONAN_BINDIRS_BASENAME}_$$upper($${pkg.name}))
message(" --> [INFO] install $${pkg.repoType} dependency : $${pkg.name} (from $$eval($${REMAKEN_CONAN_BINDIRS_BASENAME}_$$upper($${pkg.name})))")
}
}
} # for(var, dependencies)
} #!exists($${depfile})
} # for(depfile, packagedepsfiles)
contains(DEPENDENCIESCONFIG,install_recurse) {
# work on complete list and remove ignored deps in order to have subdepends and inherited deps (for instance bzip2 for boost)
# allow to use recurse for depends and install only on 1st level deps
REMAKEN_CONAN_BINDIRS = $$eval($$REMAKEN_CONAN_BINDIRS_BASENAME)
for (conanBinDir, REMAKEN_IGNORE_CONAN_BINDIRS) {
REMAKEN_CONAN_BINDIRS -= $$eval($$conanBinDir)
}
}
exists($$_PRO_FILE_PWD_/build/$$OUTPUTDIR/conanbuildinfo.pri) {
conanBinDirList = $$split(REMAKEN_CONAN_BINDIRS, " ")
conanBinDirListSize = $$size(conanBinDirList)
greaterThan(conanBinDirListSize,0) {
for (conanBinDir, conanBinDirList) {
# remove '-L' on lib path
conanBinDir = $$replace(conanBinDir, "-L", "")
sharedLibFiles += $$files($${conanBinDir}/*.$${DYNLIBEXT}*)
}
}
}
for (sharedLibFile, sharedLibFiles) {
!isEmpty(INSTALL_DEPS_FILE) {
BAT_INSTALLDEPS_COMMAND = "$${REMAKEN_XCOPY} $$shell_quote($$shell_path($${sharedLibFile})) $$shell_quote($$shell_path($${TARGETDEPLOYDIR}/))"
write_file($${INSTALL_DEPS_FILE},BAT_INSTALLDEPS_COMMAND, append)
} else {
targetname = copy_$$ReplaceSpecialCharacter($${sharedLibFile})
!contains(install_deps.depends, install) {
# add install target before for folder creation
install_deps.depends += install
}
!contains(QMAKE_EXTRA_TARGETS, $${targetname}) {
$${targetname}.commands = $$REMAKEN_DEPS_COPY $$shell_quote($$shell_path($${sharedLibFile})) $$shell_quote($$shell_path($${TARGETDEPLOYDIR}/))
QMAKE_EXTRA_TARGETS += $${targetname}
install_deps.depends += $${targetname}
}
}
}
# only for QT VS tools
!isEmpty(INSTALL_DEPS_FILE) {
QMAKE_DISTCLEAN += $${INSTALL_DEPS_FILE}
exists($${INSTALL_DEPS_FILE}) {
!equals(QMAKE_POST_LINK,"") {
QMAKE_POST_LINK += &&
}
QMAKE_POST_LINK += call $${INSTALL_DEPS_FILE}
}
}
QMAKE_EXTRA_TARGETS += install_deps
message("----------------------------------------------------------------")