d1a67b9d |
1 | # ======================================================================= |
2 | # Created on: 2012-01-26 |
3 | # Created by: Kirill GAVRILOV |
4 | # Copyright (c) 2012 OPEN CASCADE SAS |
5 | # |
6 | # This file is part of Open CASCADE Technology software library. |
7 | # |
8 | # This library is free software; you can redistribute it and/or modify it under |
9 | # the terms of the GNU Lesser General Public License version 2.1 as published |
10 | # by the Free Software Foundation, with special exception defined in the file |
11 | # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | # distribution for complete text of the license and disclaimer of any warranty. |
13 | # |
14 | # Alternatively, this file may be used under the terms of Open CASCADE |
15 | # commercial license or contractual agreement. |
16 | |
17 | # ======================================================================= |
18 | # Tools for search of third-party libraries and generation on environment |
19 | # customization script |
20 | # ======================================================================= |
910970ab |
21 | |
c7d774c5 |
22 | set ARCH "64" |
910970ab |
23 | |
24 | if { "$tcl_platform(platform)" == "unix" } { |
25 | set SYS_PATH_SPLITTER ":" |
26 | set SYS_LIB_PREFIX "lib" |
27 | set SYS_EXE_SUFFIX "" |
28 | if { "$tcl_platform(os)" == "Darwin" } { |
29 | set SYS_LIB_SUFFIX "dylib" |
aafe169f |
30 | set PRJFMT "xcd" |
910970ab |
31 | } else { |
32 | set SYS_LIB_SUFFIX "so" |
aafe169f |
33 | set PRJFMT "cbp" |
910970ab |
34 | } |
35 | set VCVER "gcc" |
36 | set VCVARS "" |
37 | } elseif { "$tcl_platform(platform)" == "windows" } { |
38 | set SYS_PATH_SPLITTER ";" |
39 | set SYS_LIB_PREFIX "" |
40 | set SYS_LIB_SUFFIX "lib" |
41 | set SYS_EXE_SUFFIX ".exe" |
42 | set VCVER "vc10" |
43 | set VCVARS "" |
aafe169f |
44 | set PRJFMT "vcxproj" |
910970ab |
45 | } |
46 | |
5951a088 |
47 | set SHORTCUT_HEADERS "ShortCut" |
910970ab |
48 | |
910970ab |
49 | set PRODUCTS_PATH "" |
50 | set CSF_OPT_INC [list] |
51 | set CSF_OPT_LIB32 [list] |
52 | set CSF_OPT_LIB64 [list] |
53 | set CSF_OPT_BIN32 [list] |
54 | set CSF_OPT_BIN64 [list] |
ea99d048 |
55 | set CSF_OPT_LIB32D [list] |
56 | set CSF_OPT_LIB64D [list] |
57 | set CSF_OPT_BIN32D [list] |
58 | set CSF_OPT_BIN64D [list] |
910970ab |
59 | |
c7d774c5 |
60 | if { "$tcl_platform(pointerSize)" == "4" } { |
61 | set ARCH "32" |
62 | } |
910970ab |
63 | if { [info exists ::env(ARCH)] } { |
64 | set ARCH "$::env(ARCH)" |
65 | } |
e22105a9 |
66 | |
910970ab |
67 | if { [info exists ::env(SHORTCUT_HEADERS)] } { |
68 | set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)" |
5951a088 |
69 | if { $SHORTCUT_HEADERS == "true" } { |
70 | set SHORTCUT_HEADERS "ShortCut" |
71 | } |
910970ab |
72 | } |
e22105a9 |
73 | |
74 | # fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name |
d9d75a84 |
75 | set THE_ENV_VARIABLES { HAVE_TK HAVE_FREETYPE HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK \ |
76 | HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_DRACO HAVE_OPENVR HAVE_OPENCL \ |
77 | CHECK_QT4 CHECK_JDK HAVE_XLIB \ |
78 | HAVE_RelWithDebInfo BUILD_Inspector } |
5c9493b3 |
79 | foreach anEnvIter $THE_ENV_VARIABLES { set ${anEnvIter} "false" } |
87b68a0f |
80 | set HAVE_TK "true" |
5c9493b3 |
81 | set HAVE_FREETYPE "true" |
b69e576a |
82 | if { "$tcl_platform(os)" != "Darwin" } { set HAVE_XLIB "true" } |
e22105a9 |
83 | foreach anEnvIter $THE_ENV_VARIABLES { |
e22105a9 |
84 | if { [info exists ::env(${anEnvIter})] } { |
85 | set ${anEnvIter} "$::env(${anEnvIter})" |
86 | } |
910970ab |
87 | } |
e22105a9 |
88 | # do not export platform-specific variables |
89 | if { "$::tcl_platform(os)" == "Darwin" } { |
90 | set HAVE_GLES2 "" |
26cfd29c |
91 | } |
92 | if { "$tcl_platform(platform)" != "windows" } { |
93 | set HAVE_D3D "" |
94 | set HAVE_RelWithDebInfo "" |
b69e576a |
95 | } else { |
96 | set HAVE_XLIB "" |
910970ab |
97 | } |
f4b0c772 |
98 | foreach anEnvIter {ARCH VCVER VCVARS PRJFMT } { |
e22105a9 |
99 | if { [info exists ::env(${anEnvIter})] } { |
100 | set ${anEnvIter} "$::env(${anEnvIter})" |
101 | } |
910970ab |
102 | } |
f4b0c772 |
103 | if { [info exists ::env(PRODUCTS_PATH)] } { |
104 | set PRODUCTS_PATH [file normalize "$::env(PRODUCTS_PATH)"] |
105 | } |
e22105a9 |
106 | |
910970ab |
107 | if { [info exists ::env(CSF_OPT_INC)] } { |
108 | set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER] |
109 | } |
110 | if { [info exists ::env(CSF_OPT_LIB32)] } { |
111 | set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER] |
112 | } |
113 | if { [info exists ::env(CSF_OPT_LIB64)] } { |
114 | set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER] |
115 | } |
116 | if { [info exists ::env(CSF_OPT_BIN32)] } { |
117 | set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER] |
118 | } |
119 | if { [info exists ::env(CSF_OPT_BIN64)] } { |
120 | set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER] |
121 | } |
122 | |
ea99d048 |
123 | if { [info exists ::env(CSF_OPT_LIB32D)] } { |
124 | set CSF_OPT_LIB32D [split "$::env(CSF_OPT_LIB32D)" $::SYS_PATH_SPLITTER] |
125 | foreach aLibIter $::CSF_OPT_LIB32 { |
126 | set aPos [lsearch -exact $::CSF_OPT_LIB32D $aLibIter] |
127 | set ::CSF_OPT_LIB32D [lreplace $::CSF_OPT_LIB32D $aPos $aPos] |
128 | } |
129 | } |
130 | if { [info exists ::env(CSF_OPT_LIB64D)] } { |
131 | set CSF_OPT_LIB64D [split "$::env(CSF_OPT_LIB64D)" $::SYS_PATH_SPLITTER] |
132 | foreach aLibIter $::CSF_OPT_LIB64 { |
133 | set aPos [lsearch -exact $::CSF_OPT_LIB64D $aLibIter] |
134 | set ::CSF_OPT_LIB64D [lreplace $::CSF_OPT_LIB64D $aPos $aPos] |
135 | } |
136 | } |
137 | if { [info exists ::env(CSF_OPT_BIN32D)] } { |
138 | set CSF_OPT_BIN32D [split "$::env(CSF_OPT_BIN32D)" $::SYS_PATH_SPLITTER] |
139 | foreach aLibIter $::CSF_OPT_BIN32 { |
140 | set aPos [lsearch -exact $::CSF_OPT_BIN32D $aLibIter] |
141 | set ::CSF_OPT_BIN32D [lreplace $::CSF_OPT_BIN32D $aPos $aPos] |
142 | } |
143 | } |
144 | if { [info exists ::env(CSF_OPT_BIN64D)] } { |
145 | set CSF_OPT_BIN64D [split "$::env(CSF_OPT_BIN64D)" $::SYS_PATH_SPLITTER] |
146 | foreach aLibIter $::CSF_OPT_BIN64 { |
147 | set aPos [lsearch -exact $::CSF_OPT_BIN64D $aLibIter] |
148 | set ::CSF_OPT_BIN64D [lreplace $::CSF_OPT_BIN64D $aPos $aPos] |
149 | } |
150 | } |
151 | |
910970ab |
152 | # Search header file in $::CSF_OPT_INC and standard paths |
153 | proc wokdep:SearchHeader {theHeader} { |
154 | # search in custom paths |
155 | foreach anIncPath $::CSF_OPT_INC { |
156 | set aPath "${anIncPath}/${theHeader}" |
157 | if { [file exists "$aPath"] } { |
158 | return "$aPath" |
159 | } |
160 | } |
161 | |
162 | # search in system |
163 | set aPath "/usr/include/${theHeader}" |
164 | if { [file exists "$aPath"] } { |
165 | return "$aPath" |
166 | } |
08f8a185 |
167 | |
168 | if { "$::tcl_platform(os)" == "Linux" } { |
169 | if { "$::ARCH" == "64" } { |
170 | set aPath "/usr/include/x86_64-linux-gnu/${theHeader}" |
171 | if { [file exists "$aPath"] } { |
172 | return "$aPath" |
173 | } |
174 | } else { |
175 | set aPath "/usr/include/i386-linux-gnu/${theHeader}" |
176 | if { [file exists "$aPath"] } { |
177 | return "$aPath" |
178 | } |
179 | } |
180 | } |
181 | |
910970ab |
182 | return "" |
183 | } |
184 | |
185 | # Search library file in $::CSF_OPT_LIB* and standard paths |
186 | proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} { |
187 | if { "$theSearchPath" != "" } { |
27bd52b5 |
188 | set aPath "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}" |
189 | set aPath2 "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.a" |
910970ab |
190 | if { [file exists "$aPath"] } { |
191 | return "$aPath" |
27bd52b5 |
192 | } elseif { "$::tcl_platform(platform)" != "windows" && [file exists "$aPath2"] } { |
193 | return "$aPath2" |
910970ab |
194 | } else { |
195 | return "" |
196 | } |
197 | } |
198 | |
199 | # search in custom paths |
200 | foreach aLibPath [set ::CSF_OPT_LIB$theBitness] { |
27bd52b5 |
201 | set aPath "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}" |
202 | set aPath2 "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.a" |
910970ab |
203 | if { [file exists "$aPath"] } { |
204 | return "$aPath" |
27bd52b5 |
205 | } elseif { "$::tcl_platform(platform)" != "windows" && [file exists "$aPath2"] } { |
206 | return "$aPath2" |
910970ab |
207 | } |
208 | } |
209 | |
210 | # search in system |
211 | if { "$::ARCH" == "$theBitness"} { |
27bd52b5 |
212 | set aPath "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}" |
213 | set aPath2 "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.a" |
910970ab |
214 | if { [file exists "$aPath"] } { |
215 | return "$aPath" |
27bd52b5 |
216 | } elseif { [file exists "$aPath2"] } { |
217 | return "$aPath2" |
910970ab |
218 | } |
219 | } |
220 | |
c7d774c5 |
221 | if { "$::tcl_platform(os)" == "Linux" } { |
910970ab |
222 | if { "$theBitness" == "64" } { |
27bd52b5 |
223 | set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so" |
224 | set aPath2 "/usr/lib/x86_64-linux-gnu/lib${theLib}.a" |
910970ab |
225 | if { [file exists "$aPath"] } { |
226 | return "$aPath" |
27bd52b5 |
227 | } elseif { [file exists "$aPath2"] } { |
228 | return "$aPath2" |
910970ab |
229 | } |
230 | } else { |
27bd52b5 |
231 | set aPath "/usr/lib/i386-linux-gnu/lib${theLib}.so" |
232 | set aPath2 "/usr/lib/i386-linux-gnu/lib${theLib}.a" |
910970ab |
233 | if { [file exists "$aPath"] } { |
234 | return "$aPath" |
27bd52b5 |
235 | } elseif { [file exists "$aPath2"] } { |
236 | return "$aPath2" |
910970ab |
237 | } |
238 | } |
239 | } |
240 | |
241 | return "" |
242 | } |
243 | |
244 | # Search file in $::CSF_OPT_BIN* and standard paths |
245 | proc wokdep:SearchBin {theBin theBitness {theSearchPath ""}} { |
246 | if { "$theSearchPath" != "" } { |
247 | set aPath "${theSearchPath}/${theBin}" |
248 | if { [file exists "$aPath"] } { |
249 | return "$aPath" |
250 | } else { |
251 | return "" |
252 | } |
253 | } |
254 | |
255 | # search in custom paths |
256 | foreach aBinPath [set ::CSF_OPT_BIN$theBitness] { |
257 | set aPath "${aBinPath}/${theBin}" |
258 | if { [file exists "$aPath"] } { |
259 | return "$aPath" |
260 | } |
261 | } |
262 | |
263 | # search in system |
264 | if { "$::ARCH" == "$theBitness"} { |
265 | set aPath "/usr/bin/${theBin}" |
266 | if { [file exists "$aPath"] } { |
267 | return "$aPath" |
268 | } |
269 | } |
270 | |
271 | return "" |
272 | } |
273 | |
274 | # Detect compiler C-runtime version 'vc*' and architecture '32'/'64' |
275 | # to determine preferred path. |
276 | proc wokdep:Preferred {theList theCmpl theArch} { |
277 | if { [llength $theList] == 0 } { |
278 | return "" |
279 | } |
280 | |
d6cda17a |
281 | # keep only two first digits in "vc141" |
282 | if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } { |
1bd04b5a |
283 | if { [regexp {^vclang} $theCmpl] } { |
284 | set aCmpl vc14 |
285 | } else { |
286 | set aCmpl $theCmpl |
287 | } |
d6cda17a |
288 | } |
289 | |
910970ab |
290 | set aShortList {} |
291 | foreach aPath $theList { |
d6cda17a |
292 | if { [string first "$aCmpl" "$aPath"] != "-1" } { |
910970ab |
293 | lappend aShortList "$aPath" |
294 | } |
295 | } |
296 | |
297 | if { [llength $aShortList] == 0 } { |
298 | #return [lindex $theList 0] |
299 | set aShortList $theList |
300 | } |
301 | |
302 | set aVeryShortList {} |
303 | foreach aPath $aShortList { |
304 | if { [string first "$theArch" "$aPath"] != "-1" } { |
305 | lappend aVeryShortList "$aPath" |
306 | } |
307 | } |
308 | if { [llength $aVeryShortList] == 0 } { |
309 | return [lindex [lsort -decreasing $aShortList] 0] |
310 | } |
311 | |
312 | return [lindex [lsort -decreasing $aVeryShortList] 0] |
313 | } |
314 | |
e22105a9 |
315 | # Search library placement |
316 | proc wokdep:SearchStandardLibrary {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64 theName theCheckHeader theCheckLib theCheckFolders} { |
317 | upvar $theErrInc anErrInc |
318 | upvar $theErrLib32 anErrLib32 |
319 | upvar $theErrLib64 anErrLib64 |
320 | upvar $theErrBin32 anErrBin32 |
321 | upvar $theErrBin64 anErrBin64 |
322 | |
323 | set isFound "true" |
324 | set aHeaderPath [wokdep:SearchHeader "$theCheckHeader"] |
325 | if { "$aHeaderPath" == "" } { |
326 | set hasHeader false |
327 | foreach aFolderIter $theCheckFolders { |
328 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$::ARCH" ] |
329 | if { "$aPath" != "" && [file exists "$aPath/include/$theCheckHeader"] } { |
330 | lappend ::CSF_OPT_INC "$aPath/include" |
331 | set hasHeader true |
332 | break |
333 | } |
334 | } |
335 | if { !$hasHeader } { |
336 | lappend anErrInc "Error: '$theCheckHeader' not found ($theName)" |
337 | set isFound "false" |
338 | } |
339 | } |
340 | |
341 | foreach anArchIter {64 32} { |
342 | set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter"] |
343 | if { "$aLibPath" == "" } { |
344 | set hasLib false |
345 | foreach aFolderIter $theCheckFolders { |
346 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ] |
347 | set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter" "$aPath/lib"] |
348 | if { "$aLibPath" != "" } { |
349 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
350 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
351 | set hasLib true |
ea99d048 |
352 | |
353 | set aLibDPath [wokdep:SearchLib "$theCheckLib" "$anArchIter" "$aPath/libd"] |
354 | if { "$aLibDPath" != "" } { |
355 | lappend ::CSF_OPT_LIB${anArchIter}D "$aPath/libd" |
356 | lappend ::CSF_OPT_BIN${anArchIter}D "$aPath/bind" |
357 | } |
e22105a9 |
358 | break |
359 | } |
360 | } |
361 | if { !$hasLib } { |
362 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}$theCheckLib.${::SYS_LIB_SUFFIX}' not found ($theName)" |
363 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
364 | } |
365 | } |
366 | |
367 | if { "$::tcl_platform(platform)" == "windows" } { |
368 | set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter"] |
369 | if { "$aDllPath" == "" } { |
370 | set hasDll false |
371 | foreach aFolderIter $theCheckFolders { |
372 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ] |
373 | set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/bin"] |
374 | if { "$aDllPath" != "" } { |
375 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
376 | set hasDll true |
377 | break |
378 | } else { |
379 | set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/lib"] |
380 | if { "$aDllPath" != "" } { |
381 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" |
382 | set hasDll true |
383 | break |
384 | } |
385 | } |
386 | } |
387 | if { !$hasDll } { |
388 | lappend anErrBin$anArchIter "Error: '$theCheckLib.dll' not found ($theName)" |
389 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
390 | } |
391 | } |
392 | } |
393 | } |
394 | |
395 | return "$isFound" |
396 | } |
397 | |
910970ab |
398 | # Search Tcl/Tk libraries placement |
399 | proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
400 | upvar $theErrInc anErrInc |
401 | upvar $theErrLib32 anErrLib32 |
402 | upvar $theErrLib64 anErrLib64 |
403 | upvar $theErrBin32 anErrBin32 |
404 | upvar $theErrBin64 anErrBin64 |
405 | |
406 | set tclver_maj 8 |
407 | set tclver_min 6 |
408 | |
409 | set isFound "true" |
410 | set aTclHPath [wokdep:SearchHeader "tcl.h"] |
411 | set aTkHPath [wokdep:SearchHeader "tk.h"] |
412 | if { "$aTclHPath" == "" || "$aTkHPath" == "" } { |
413 | if { [file exists "/usr/include/tcl8.6/tcl.h"] |
414 | && [file exists "/usr/include/tcl8.6/tk.h" ] } { |
415 | lappend ::CSF_OPT_INC "/usr/include/tcl8.6" |
416 | set aTclHPath "/usr/include/tcl8.6/tcl.h" |
417 | } else { |
418 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ] |
419 | if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } { |
420 | lappend ::CSF_OPT_INC "$aPath/include" |
421 | set aTclHPath "$aPath/include/tcl.h" |
422 | } else { |
423 | lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)" |
424 | set isFound "false" |
425 | } |
426 | } |
427 | } |
428 | |
429 | # detect tcl version by parsing header file |
430 | if { $isFound } { |
431 | set fh [open $aTclHPath] |
432 | set tcl_h [read $fh] |
433 | close $fh |
434 | regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj |
435 | regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min |
436 | } |
437 | |
438 | if { "$::tcl_platform(platform)" == "windows" } { |
439 | set aTclLibName "tcl${tclver_maj}${tclver_min}" |
440 | set aTkLibName "tk${tclver_maj}${tclver_min}" |
441 | } else { |
442 | set aTclLibName "tcl${tclver_maj}.${tclver_min}" |
443 | set aTkLibName "tk${tclver_maj}.${tclver_min}" |
444 | } |
445 | |
446 | foreach anArchIter {64 32} { |
447 | set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter"] |
448 | set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter"] |
449 | if { "$aTclLibPath" == "" || "$aTkLibPath" == "" } { |
450 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ] |
451 | set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter" "$aPath/lib"] |
452 | set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter" "$aPath/lib"] |
453 | if { "$aTclLibPath" != "" && "$aTkLibPath" != "" } { |
454 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
455 | } else { |
456 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aTclLibName}.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}${aTkLibName}.${::SYS_LIB_SUFFIX}' not found (Tcl/Tk)" |
457 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
458 | } |
459 | } |
460 | |
461 | if { "$::tcl_platform(platform)" == "windows" } { |
462 | set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter"] |
463 | set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter"] |
464 | if { "$aTclDllPath" == "" || "$aTkDllPath" == "" } { |
465 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ] |
466 | set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter" "$aPath/bin"] |
467 | set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter" "$aPath/bin"] |
468 | if { "$aTclDllPath" != "" && "$aTkDllPath" != "" } { |
469 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
470 | } else { |
471 | lappend anErrBin$anArchIter "Error: '${aTclLibName}.dll' or '${aTkLibName}.dll' not found (Tcl/Tk)" |
472 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
473 | } |
474 | } |
475 | } |
476 | } |
477 | |
478 | return "$isFound" |
479 | } |
480 | |
481 | # Search FreeType library placement |
482 | proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
483 | upvar $theErrInc anErrInc |
484 | upvar $theErrLib32 anErrLib32 |
485 | upvar $theErrLib64 anErrLib64 |
486 | upvar $theErrBin32 anErrBin32 |
487 | upvar $theErrBin64 anErrBin64 |
488 | |
489 | set isFound "true" |
490 | set aFtBuildPath [wokdep:SearchHeader "ft2build.h"] |
491 | |
910970ab |
492 | if { "$aFtBuildPath" == "" } { |
493 | # TODO - use `freetype-config --cflags` instead |
494 | set aSysFreeType "/usr/include/freetype2" |
c7d774c5 |
495 | if { [file exists "$aSysFreeType/ft2build.h"] } { |
910970ab |
496 | lappend ::CSF_OPT_INC "$aSysFreeType" |
497 | } elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } { |
498 | lappend ::CSF_OPT_INC "$aSysFreeType/freetype2" |
499 | } else { |
500 | set aSysFreeType "/usr/X11/include/freetype2" |
501 | if { [file exists "$aSysFreeType/ft2build.h"] } { |
502 | lappend ::CSF_OPT_INC "/usr/X11/include" |
503 | lappend ::CSF_OPT_INC "$aSysFreeType" |
504 | } else { |
505 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$::ARCH" ] |
506 | if {"$aPath" != ""} { |
507 | if {[file exists "$aPath/include/ft2build.h"]} { |
508 | lappend ::CSF_OPT_INC "$aPath/include" |
509 | } elseif {[file exists "$aPath/include/freetype2/ft2build.h"]} { |
510 | lappend ::CSF_OPT_INC "$aPath/include/freetype2" |
511 | } |
512 | } else { |
513 | lappend anErrInc "Error: 'freetype.h' not found (FreeType2)" |
514 | set isFound "false" |
515 | } |
516 | } |
517 | } |
518 | } |
519 | |
520 | # parse 'freetype-config --libs' |
521 | set aConfLibPath "" |
522 | if { [catch { set aConfLibs [exec freetype-config --libs] } ] == 0 } { |
523 | foreach aPath [split $aConfLibs " "] { |
524 | if { [string first "-L" "$aPath"] == 0 } { |
525 | set aConfLibPath [string range "$aPath" 2 [string length "$aPath"]] |
526 | } |
527 | } |
528 | } |
529 | |
530 | foreach anArchIter {64 32} { |
531 | set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter"] |
532 | if { "$aFtLibPath" == "" } { |
533 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ] |
534 | set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aPath/lib"] |
535 | if { "$aFtLibPath" != "" } { |
536 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
537 | } else { |
538 | set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aConfLibPath"] |
539 | if { "$aFtLibPath" != "" } { |
540 | lappend ::CSF_OPT_LIB$anArchIter "$aConfLibPath" |
541 | } else { |
542 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freetype.${::SYS_LIB_SUFFIX}' not found (FreeType2)" |
543 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
544 | } |
545 | } |
546 | } |
547 | if { "$::tcl_platform(platform)" == "windows" } { |
548 | set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter"] |
549 | if { "$aFtDllPath" == "" } { |
550 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ] |
551 | set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/bin"] |
552 | if { "$aFtDllPath" != "" } { |
553 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
554 | } else { |
555 | set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/lib"] |
556 | if { "$aFtDllPath" != "" } { |
557 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" |
558 | } else { |
559 | lappend anErrBin$anArchIter "Error: 'freetype.dll' not found (FreeType2)" |
560 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
561 | } |
562 | } |
563 | } |
564 | } |
565 | } |
566 | |
567 | return "$isFound" |
568 | } |
569 | |
570 | # Search FreeImage library placement |
571 | proc wokdep:SearchFreeImage {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
572 | upvar $theErrInc anErrInc |
573 | upvar $theErrLib32 anErrLib32 |
574 | upvar $theErrLib64 anErrLib64 |
575 | upvar $theErrBin32 anErrBin32 |
576 | upvar $theErrBin64 anErrBin64 |
577 | |
578 | # binary distribution has another layout |
579 | set aFImageDist "Dist" |
910970ab |
580 | |
581 | set isFound "true" |
f0d3b7af |
582 | set aFImageHPath [wokdep:SearchHeader "FreeImage.h"] |
583 | if { "$aFImageHPath" == "" } { |
910970ab |
584 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ] |
f0d3b7af |
585 | if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] } { |
910970ab |
586 | lappend ::CSF_OPT_INC "$aPath/include" |
f0d3b7af |
587 | } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] } { |
910970ab |
588 | lappend ::CSF_OPT_INC "$aPath/$aFImageDist" |
910970ab |
589 | } else { |
f0d3b7af |
590 | lappend anErrInc "Error: 'FreeImage.h' not found (FreeImage)" |
910970ab |
591 | set isFound "false" |
592 | } |
593 | } |
594 | |
595 | foreach anArchIter {64 32} { |
f0d3b7af |
596 | set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"] |
597 | if { "$aFImageLibPath" == "" } { |
910970ab |
598 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ] |
f0d3b7af |
599 | set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"] |
600 | if { "$aFImageLibPath" != "" } { |
910970ab |
601 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
602 | } else { |
f0d3b7af |
603 | set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"] |
604 | if { "$aFImageLibPath" != "" } { |
910970ab |
605 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist" |
910970ab |
606 | } else { |
f0d3b7af |
607 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' not found (FreeImage)" |
910970ab |
608 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
609 | } |
610 | } |
611 | } |
612 | if { "$::tcl_platform(platform)" == "windows" } { |
60273f77 |
613 | set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"] |
614 | if { "$aFImageDllPath" == "" } { |
910970ab |
615 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ] |
60273f77 |
616 | set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"] |
617 | if { "$aFImageDllPath" != "" } { |
910970ab |
618 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
619 | } else { |
60273f77 |
620 | set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"] |
621 | if { "$aFImageDllPath" != "" } { |
910970ab |
622 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist" |
910970ab |
623 | } else { |
60273f77 |
624 | lappend anErrBin$anArchIter "Error: 'freeimage.dll' is not found (FreeImage)" |
910970ab |
625 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
626 | } |
627 | } |
628 | } |
629 | } |
630 | } |
631 | |
632 | return "$isFound" |
633 | } |
634 | |
e22105a9 |
635 | # Search FFmpeg framework placement |
636 | proc wokdep:SearchFFmpeg {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
910970ab |
637 | upvar $theErrInc anErrInc |
638 | upvar $theErrLib32 anErrLib32 |
639 | upvar $theErrLib64 anErrLib64 |
640 | upvar $theErrBin32 anErrBin32 |
641 | upvar $theErrBin64 anErrBin64 |
642 | |
643 | set isFound "true" |
e22105a9 |
644 | set aFFmpegHPath [wokdep:SearchHeader "libavutil/avutil.h"] |
645 | if { "$aFFmpegHPath" == "" } { |
646 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$::ARCH" ] |
647 | if { "$aPath" != "" && [file exists "$aPath/include/libavutil/avutil.h"] } { |
910970ab |
648 | lappend ::CSF_OPT_INC "$aPath/include" |
649 | } else { |
e22105a9 |
650 | lappend anErrInc "Error: 'libavutil/avutil.h' not found (FFmpeg)" |
910970ab |
651 | set isFound "false" |
652 | } |
653 | } |
654 | |
655 | foreach anArchIter {64 32} { |
e22105a9 |
656 | set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter"] |
657 | if { "$aFFmpegLibPath" == "" } { |
658 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$anArchIter" ] |
659 | set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter" "$aPath/lib"] |
660 | if { "$aFFmpegLibPath" != "" } { |
910970ab |
661 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
e22105a9 |
662 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
910970ab |
663 | } else { |
e22105a9 |
664 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}avutil.${::SYS_LIB_SUFFIX}' not found (FFmpeg)" |
910970ab |
665 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
666 | } |
667 | } |
910970ab |
668 | } |
669 | |
670 | return "$isFound" |
671 | } |
672 | |
b40cdc2b |
673 | # Search OpenVR SDK placement |
674 | proc wokdep:SearchOpenVR {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
675 | upvar $theErrInc anErrInc |
676 | upvar $theErrLib32 anErrLib32 |
677 | upvar $theErrLib64 anErrLib64 |
678 | upvar $theErrBin32 anErrBin32 |
679 | upvar $theErrBin64 anErrBin64 |
680 | |
681 | set isFound "true" |
682 | set anOpenVrHPath [wokdep:SearchHeader "openvr.h"] |
683 | if { "$anOpenVrHPath" == "" } { |
684 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{openvr}*] "$::VCVER" "$::ARCH" ] |
685 | if { "$aPath" != "" && [file exists "$aPath/include/openvr.h"] } { |
686 | lappend ::CSF_OPT_INC "$aPath/include" |
687 | } elseif { "$aPath" != "" && [file exists "$aPath/headers/openvr.h"] } { |
688 | lappend ::CSF_OPT_INC "$aPath/headers" |
689 | } else { |
690 | lappend anErrInc "Error: 'openvr.h' not found (OpenVR)" |
691 | set isFound "false" |
692 | } |
693 | } |
694 | |
695 | set aPlatform "unknown" |
696 | if { "$::tcl_platform(platform)" == "windows" } { |
697 | set aPlatform "win" |
698 | } elseif { "$::tcl_platform(os)" == "Darwin" } { |
699 | set aPlatform "osx" |
700 | } elseif { "$::tcl_platform(os)" == "Linux" } { |
701 | set aPlatform "linux" |
702 | } |
703 | |
704 | foreach anArchIter {64 32} { |
705 | set anOpenVrLibPath [wokdep:SearchLib "openvr_api" "$anArchIter"] |
706 | if { "$anOpenVrLibPath" == "" } { |
707 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{openvr}*] "$::VCVER" "$anArchIter" ] |
708 | set anOpenVrLibPath [wokdep:SearchLib "openvr_api" "$anArchIter" "$aPath/lib/${aPlatform}${anArchIter}"] |
709 | set anOpenVrLibPath2 [wokdep:SearchLib "openvr_api" "$anArchIter" "$aPath/lib"] |
710 | if { "$anOpenVrLibPath" != "" } { |
711 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/${aPlatform}${anArchIter}" |
712 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/${aPlatform}${anArchIter}" |
713 | } elseif { "$anOpenVrLibPath2" != "" } { |
714 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
715 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
716 | } else { |
717 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}openvr_api.${::SYS_LIB_SUFFIX}' not found (OpenVR)" |
718 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
719 | } |
720 | } |
721 | } |
722 | |
723 | return "$isFound" |
724 | } |
725 | |
910970ab |
726 | # Search TBB library placement |
727 | proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
728 | upvar $theErrInc anErrInc |
729 | upvar $theErrLib32 anErrLib32 |
730 | upvar $theErrLib64 anErrLib64 |
731 | upvar $theErrBin32 anErrBin32 |
732 | upvar $theErrBin64 anErrBin64 |
733 | |
d6cda17a |
734 | # keep only two first digits in "vc141" |
735 | if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } { |
1bd04b5a |
736 | if { [regexp {^vclang} ${::VCVER}] } { |
737 | set aVcLib vc14 |
738 | } else { |
739 | set aVcLib ${::VCVER} |
740 | } |
d6cda17a |
741 | } |
742 | |
910970ab |
743 | set isFound "true" |
744 | set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"] |
745 | if { "$aTbbHPath" == "" } { |
746 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ] |
747 | if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } { |
748 | lappend ::CSF_OPT_INC "$aPath/include" |
749 | } else { |
750 | lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)" |
751 | set isFound "false" |
752 | } |
753 | } |
754 | |
755 | foreach anArchIter {64 32} { |
756 | set aSubDir "ia32" |
757 | if { "$anArchIter" == "64"} { |
758 | set aSubDir "intel64" |
759 | } |
760 | |
761 | set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"] |
762 | if { "$aTbbLibPath" == "" } { |
d6cda17a |
763 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ] |
764 | set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/$aVcLib"] |
910970ab |
765 | if { "$aTbbLibPath" == "" } { |
766 | # Set the path to the TBB library for Linux |
767 | if { "$::tcl_platform(platform)" != "windows" } { |
768 | set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21" |
769 | } |
770 | set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"] |
771 | if { "$aTbbLibPath" != "" } { |
772 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir" |
773 | } |
774 | } else { |
d6cda17a |
775 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/$aVcLib" |
910970ab |
776 | } |
777 | if { "$aTbbLibPath" == "" } { |
778 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)" |
779 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
780 | } |
781 | } |
782 | if { "$::tcl_platform(platform)" == "windows" } { |
783 | set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"] |
784 | if { "$aTbbDllPath" == "" } { |
d6cda17a |
785 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ] |
786 | set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"] |
910970ab |
787 | if { "$aTbbDllPath" != "" } { |
d6cda17a |
788 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib" |
910970ab |
789 | } else { |
790 | lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)" |
791 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
792 | } |
793 | } |
794 | } |
795 | } |
796 | |
797 | return "$isFound" |
798 | } |
799 | |
800 | # Search OpenCL library placement |
801 | proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
802 | upvar $theErrInc anErrInc |
803 | upvar $theErrLib32 anErrLib32 |
804 | upvar $theErrLib64 anErrLib64 |
805 | upvar $theErrBin32 anErrBin32 |
806 | upvar $theErrBin64 anErrBin64 |
807 | |
808 | set isFound "true" |
809 | if { "$::tcl_platform(os)" == "Darwin" } { |
810 | # OpenCL framework available since Mac OS X 16 |
811 | return "$isFound" |
812 | } |
813 | |
814 | set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"] |
815 | if { "$aCLHPath" == "" } { |
816 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ] |
817 | if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } { |
818 | lappend ::CSF_OPT_INC "$aPath/include" |
819 | } else { |
820 | lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)" |
821 | set isFound "false" |
822 | } |
823 | } |
824 | |
825 | foreach anArchIter {64 32} { |
826 | set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"] |
827 | if { "$aCLLibPath" == "" } { |
828 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ] |
829 | set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"] |
830 | if { "$aCLLibPath" != "" } { |
831 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
832 | } else { |
833 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)" |
834 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
835 | } |
836 | } |
837 | } |
838 | |
839 | return "$isFound" |
840 | } |
841 | |
1ce0716b |
842 | # Search EGL library placement |
843 | proc wokdep:SearchEGL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
844 | upvar $theErrInc anErrInc |
845 | upvar $theErrLib32 anErrLib32 |
846 | upvar $theErrLib64 anErrLib64 |
847 | upvar $theErrBin32 anErrBin32 |
848 | upvar $theErrBin64 anErrBin64 |
849 | |
850 | set isFound "true" |
851 | set aHeaderPath [wokdep:SearchHeader "EGL/egl.h"] |
852 | if { "$aHeaderPath" == "" } { |
853 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$::ARCH" ] |
854 | if { "$aPath" == "" || ![file exists "$aPath/include/EGL/egl.h"] } { |
855 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ] |
856 | } |
857 | |
858 | if { "$aPath" != "" && [file exists "$aPath/include/EGL/egl.h"] } { |
859 | lappend ::CSF_OPT_INC "$aPath/include" |
860 | } else { |
861 | lappend anErrInc "Error: 'EGL/egl.h' not found (EGL)" |
862 | set isFound "false" |
863 | } |
864 | } |
865 | |
866 | set aLibName "EGL" |
867 | if { "$::tcl_platform(platform)" == "windows" } { |
868 | # awkward exception |
869 | set aLibName "libEGL" |
870 | } |
871 | |
872 | foreach anArchIter {64 32} { |
873 | set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"] |
874 | if { "$aLibPath" == "" } { |
875 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ] |
876 | set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"] |
877 | if { "$aLibPath" == "" } { |
878 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ] |
879 | set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"] |
880 | } |
881 | |
882 | if { "$aLibPath" != "" } { |
883 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
884 | } else { |
885 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (EGL)" |
886 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
887 | } |
888 | } |
889 | |
890 | if { "$::tcl_platform(platform)" == "windows" } { |
891 | set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter"] |
892 | if { "$aDllPath" == "" } { |
893 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ] |
894 | set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"] |
895 | if { "$aDllPath" == "" } { |
896 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ] |
897 | set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"] |
898 | } |
899 | |
900 | if { "$aDllPath" != "" } { |
901 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
902 | } else { |
903 | lappend anErrBin$anArchIter "Error: 'libEGL.dll' not found (EGL)" |
904 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
905 | } |
906 | } |
907 | } |
908 | } |
909 | |
910 | return "$isFound" |
911 | } |
912 | |
913 | # Search OpenGL ES 2.0 library placement |
914 | proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
915 | upvar $theErrInc anErrInc |
916 | upvar $theErrLib32 anErrLib32 |
917 | upvar $theErrLib64 anErrLib64 |
918 | upvar $theErrBin32 anErrBin32 |
919 | upvar $theErrBin64 anErrBin64 |
920 | |
921 | set isFound "true" |
922 | set aHeaderPath [wokdep:SearchHeader "GLES2/gl2.h"] |
923 | if { "$aHeaderPath" == "" } { |
924 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$::ARCH" ] |
925 | if { "$aPath" == "" || ![file exists "$aPath/include/GLES2/gl2.h"] } { |
926 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ] |
927 | } |
928 | |
929 | if { "$aPath" != "" && [file exists "$aPath/include/GLES2/gl2.h"] } { |
930 | lappend ::CSF_OPT_INC "$aPath/include" |
931 | } else { |
932 | lappend anErrInc "Error: 'GLES2/gl2.h' not found (OpenGL ES 2.0)" |
933 | set isFound "false" |
934 | } |
935 | } |
936 | |
937 | set aLibName "GLESv2" |
938 | if { "$::tcl_platform(platform)" == "windows" } { |
939 | # awkward exception |
940 | set aLibName "libGLESv2" |
941 | } |
942 | |
943 | foreach anArchIter {64 32} { |
944 | set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"] |
945 | if { "$aLibPath" == "" } { |
946 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$anArchIter" ] |
947 | set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"] |
948 | if { "$aLibPath" == "" } { |
949 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ] |
950 | set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"] |
951 | } |
952 | |
953 | if { "$aLibPath" != "" } { |
954 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
955 | } else { |
956 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (OpenGL ES 2.0)" |
957 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
958 | } |
959 | } |
960 | |
961 | if { "$::tcl_platform(platform)" == "windows" } { |
962 | set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter"] |
963 | if { "$aDllPath" == "" } { |
964 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ] |
965 | set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"] |
966 | if { "$aDllPath" == "" } { |
967 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ] |
968 | set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"] |
969 | } |
970 | |
971 | if { "$aDllPath" != "" } { |
972 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
973 | } else { |
974 | lappend anErrBin$anArchIter "Error: 'libGLESv2.dll' not found (OpenGL ES 2.0)" |
975 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
976 | } |
977 | } |
978 | } |
979 | } |
980 | |
981 | return "$isFound" |
982 | } |
983 | |
0a419c51 |
984 | # Search RapidJSON headers |
985 | proc wokdep:SearchRapidJson {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
986 | upvar $theErrInc anErrInc |
987 | |
988 | set isFound "true" |
989 | set aRJHPath [wokdep:SearchHeader "rapidjson/rapidjson.h"] |
990 | if { "$aRJHPath" == "" } { |
991 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{rapidjson}*] "$::VCVER" "$::ARCH" ] |
992 | if { "$aPath" != "" && [file exists "$aPath/include/rapidjson/rapidjson.h"] } { |
993 | lappend ::CSF_OPT_INC "$aPath/include" |
994 | } else { |
995 | lappend anErrInc "Error: 'rapidjson/rapidjson.h' not found (RapidJSON)" |
996 | set isFound "false" |
997 | } |
998 | } |
999 | |
1000 | return "$isFound" |
1001 | } |
1002 | |
910970ab |
1003 | # Auxiliary function, gets VTK version to set default search directory |
1004 | proc wokdep:VtkVersion { thePath } { |
1005 | set aResult "6.1" |
1006 | |
1007 | set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0] |
1008 | if { "$aVtkRoot" != "" } { |
1009 | set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot] |
1010 | if { "$aVtkRoot" != "" } { |
1011 | set aResult $aVtkRoot |
1012 | } |
1013 | } |
1014 | |
1015 | return $aResult |
1016 | } |
1017 | |
1018 | # Search VTK library placement |
1019 | proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
1020 | upvar $theErrInc anErrInc |
1021 | upvar $theErrLib32 anErrLib32 |
1022 | upvar $theErrLib64 anErrLib64 |
1023 | upvar $theErrBin32 anErrBin32 |
1024 | upvar $theErrBin64 anErrBin64 |
1025 | |
1026 | set isFound "true" |
1027 | |
1028 | set aVtkPath "" |
1029 | set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"] |
1030 | set aVtkVer [wokdep:VtkVersion $aVtkIncPath] |
1031 | if { "$aVtkIncPath" == ""} { |
1032 | set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] |
1033 | set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ] |
1034 | if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} { |
1035 | set aVtkVer [wokdep:VtkVersion $aVtkPath] |
1036 | lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]" |
1037 | } else { # try to search in all found paths |
1038 | set isFound "false" |
1039 | foreach anIt $aPathList { |
1040 | if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } { |
1041 | set aVtkPath $anIt |
1042 | set aVtkVer [wokdep:VtkVersion $aVtkPath] |
1043 | lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]" |
1044 | set isFound "true" |
1045 | break |
1046 | } |
1047 | } |
1048 | |
1049 | # Bad case: we do not found vtkConfigure.h in all paths. |
1050 | if { "$isFound" == "false"} { |
1051 | lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)" |
1052 | set isFound "false" |
1053 | } |
1054 | } |
1055 | } |
1056 | |
1057 | set aVtkLibPath "" |
1058 | foreach anArchIter {64 32} { |
1059 | set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"] |
1060 | if { "$aVtkLibPath" == "" } { |
1061 | set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] |
1062 | set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ] |
1063 | set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"] |
1064 | if { "$aVtkLibPath" != "" } { |
1065 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
1066 | } else { |
1067 | set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"] |
1068 | if { "$aPath" != "" } { |
1069 | set aLibPath $aVtkIncPath |
1070 | lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib" |
1071 | } else { |
1072 | # The last chance: search /lib directory in all found paths |
1073 | foreach anIt $aPathList { |
1074 | set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"] |
1075 | if { "$aVtkLibPath" != ""} { |
1076 | lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib" |
1077 | break |
1078 | } |
1079 | } |
1080 | if { "$aVtkLibPath" == "" } { |
1081 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)" |
1082 | if { "$::ARCH" == "$anArchIter" } { |
1083 | set isFound "false" |
1084 | } |
1085 | } |
1086 | } |
1087 | } |
1088 | } |
910970ab |
1089 | |
1090 | # Search binary path |
1091 | if { "$::tcl_platform(platform)" == "windows" } { |
1e4f29c5 |
1092 | set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"] |
910970ab |
1093 | if { "$aVtkBinPath" == "" } { |
1e4f29c5 |
1094 | set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] |
1095 | set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ] |
1096 | set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"] |
1097 | if { "$aVtkBinPath" != "" } { |
1098 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
910970ab |
1099 | } else { |
1e4f29c5 |
1100 | # Try to find in lib path |
1101 | set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"] |
1102 | if { "$aVtkBinPath" != "" } { |
1103 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" |
1104 | } else { |
1105 | # We didn't find preferred binary path => search through all available VTK directories |
1106 | foreach anIt $aPathList { |
1107 | set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$anIt/bin"] |
1108 | if { "$aVtkBinPath" != "" } { |
1109 | lappend ::CSF_OPT_BIN$anArchIter "$anIt/bin" |
1110 | break |
1111 | } else { |
1112 | # Try to find in lib path |
1113 | set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$anIt/lib"] |
1114 | if { "$aVtkBinPath" != "" } { |
1115 | lappend ::CSF_OPT_BIN$anArchIter "$anIt/lib" |
1116 | } |
1117 | } |
1118 | } |
1119 | if { "$aVtkBinPath" == "" } { |
1120 | lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)" |
1121 | set isFound "false" |
1122 | } |
1123 | } |
910970ab |
1124 | } |
1125 | } |
1126 | } |
1e4f29c5 |
1127 | } |
910970ab |
1128 | |
1129 | return "$isFound" |
1130 | } |
1131 | |
f6d8ca74 |
1132 | # Search Qt libraries placement |
1133 | proc wokdep:SearchQt {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
910970ab |
1134 | upvar $theErrInc anErrInc |
1135 | upvar $theErrLib32 anErrLib32 |
1136 | upvar $theErrLib64 anErrLib64 |
1137 | upvar $theErrBin32 anErrBin32 |
1138 | upvar $theErrBin64 anErrBin64 |
1139 | |
1140 | set isFound "true" |
f6d8ca74 |
1141 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt}*] "$::VCVER" "$::ARCH" ] |
1142 | set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qguiapplication.h"] |
910970ab |
1143 | if { "$aQMsgBoxHPath" == "" } { |
f6d8ca74 |
1144 | if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qguiapplication.h"] } { |
910970ab |
1145 | lappend ::CSF_OPT_INC "$aPath/include" |
1146 | lappend ::CSF_OPT_INC "$aPath/include/Qt" |
1147 | lappend ::CSF_OPT_INC "$aPath/include/QtGui" |
1148 | lappend ::CSF_OPT_INC "$aPath/include/QtCore" |
f6d8ca74 |
1149 | lappend ::CSF_OPT_INC "$aPath/include/QtWidgets" |
1150 | lappend ::CSF_OPT_INC "$aPath/include/QtXml" |
910970ab |
1151 | } else { |
f6d8ca74 |
1152 | lappend anErrInc "Error: 'QtGui/qguiapplication.h' not found" |
910970ab |
1153 | set isFound "false" |
910970ab |
1154 | } |
1155 | } |
1156 | |
1157 | set aQtGuiLibName "QtGui" |
1158 | if { "$::tcl_platform(platform)" == "windows" } { |
f6d8ca74 |
1159 | set aQtGuiLibName "Qt5Gui" |
910970ab |
1160 | } |
1161 | |
1162 | foreach anArchIter {64 32} { |
1163 | set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"] |
1164 | if { "$aQMsgBoxLibPath" == "" } { |
910970ab |
1165 | set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"] |
1166 | if { "$aQMsgBoxLibPath" != "" } { |
1167 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
1168 | } else { |
f6d8ca74 |
1169 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt)" |
910970ab |
1170 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
1171 | } |
1172 | } |
1173 | if { "$::tcl_platform(platform)" == "windows" } { |
f6d8ca74 |
1174 | set aQMsgBoxDllPath [wokdep:SearchBin "${aQtGuiLibName}.dll" "$anArchIter"] |
910970ab |
1175 | if { "$aQMsgBoxDllPath" == "" } { |
f6d8ca74 |
1176 | set aQMsgBoxDllPath [wokdep:SearchBin "${aQtGuiLibName}.dll" "$anArchIter" "$aPath/bin"] |
910970ab |
1177 | if { "$aQMsgBoxDllPath" != "" } { |
1178 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
1179 | } else { |
f6d8ca74 |
1180 | lappend anErrBin$anArchIter "Error: '${aQtGuiLibName}.dll' not found (Qt)" |
910970ab |
1181 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
1182 | } |
1183 | } |
1184 | } |
1185 | } |
1186 | |
1187 | return "$isFound" |
1188 | } |
1189 | |
1190 | # Search JDK placement |
1191 | proc wokdep:SearchJDK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
1192 | upvar $theErrInc anErrInc |
1193 | upvar $theErrLib32 anErrLib32 |
1194 | upvar $theErrLib64 anErrLib64 |
1195 | upvar $theErrBin32 anErrBin32 |
1196 | upvar $theErrBin64 anErrBin64 |
1197 | |
1198 | set isFound "true" |
1199 | set aJniHPath [wokdep:SearchHeader "jni.h"] |
1200 | set aJniMdHPath [wokdep:SearchHeader "jni_md.h"] |
1201 | if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } { |
1202 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ] |
1203 | if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } { |
1204 | lappend ::CSF_OPT_INC "$aPath/include" |
1205 | if { "$::tcl_platform(platform)" == "windows" } { |
1206 | lappend ::CSF_OPT_INC "$aPath/include/win32" |
1207 | } elseif { [file exists "$aPath/include/linux"] } { |
1208 | lappend ::CSF_OPT_INC "$aPath/include/linux" |
1209 | } |
1210 | } else { |
1211 | if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } { |
1212 | lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include" |
1213 | } else { |
1214 | lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)" |
1215 | set isFound "false" |
1216 | } |
1217 | } |
1218 | } |
1219 | |
1220 | foreach anArchIter {64 32} { |
1221 | set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"] |
1222 | if { "$aJavacPath" == "" } { |
1223 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ] |
1224 | set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"] |
1225 | if { "$aJavacPath" != "" } { |
1226 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
1227 | } else { |
1228 | if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } { |
1229 | lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin" |
1230 | } else { |
1231 | lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)" |
1232 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
1233 | } |
1234 | } |
1235 | } |
1236 | } |
1237 | |
1238 | return "$isFound" |
1239 | } |
1240 | |
1241 | # Search X11 libraries placement |
1242 | proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
1243 | upvar $theErrInc anErrInc |
1244 | upvar $theErrLib32 anErrLib32 |
1245 | upvar $theErrLib64 anErrLib64 |
1246 | upvar $theErrBin32 anErrBin32 |
1247 | upvar $theErrBin64 anErrBin64 |
1248 | |
1249 | set isFound "true" |
b69e576a |
1250 | if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::HAVE_XLIB" != "true" ) } { |
910970ab |
1251 | return "$isFound" |
1252 | } |
1253 | |
1254 | set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"] |
1255 | if { "$aXmuLibPath" == "" } { |
1256 | set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"] |
1257 | if { "$aXmuLibPath" != "" } { |
1258 | #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib" |
1259 | } else { |
1260 | lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)" |
1261 | set isFound "false" |
1262 | } |
1263 | } |
1264 | |
1265 | return "$isFound" |
1266 | } |
1267 | |
aafe169f |
1268 | # Returns OCCT version string from file Standard_Version.hxx (if available) |
1269 | proc wokdep:DetectCasVersion {} { |
1270 | set occt_ver 7.0.0 |
1271 | set aCasRoot [file normalize [file dirname [info script]]] |
1272 | set filename "${aCasRoot}/src/Standard/Standard_Version.hxx" |
1273 | if { [file exists $filename] } { |
1274 | set fh [open $filename "r"] |
1275 | set fh_loaded [read $fh] |
1276 | close $fh |
1277 | regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver |
1278 | } else { |
1279 | puts "Error: file '$filename' not found" |
1280 | } |
1281 | return $occt_ver |
1282 | } |
1283 | |
910970ab |
1284 | # Generate (override) custom environment file |
1285 | proc wokdep:SaveCustom {} { |
aafe169f |
1286 | set aGenInfo "This environment file was generated by genconf.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]" |
910970ab |
1287 | if { "$::tcl_platform(platform)" == "windows" } { |
1288 | set aCustomFilePath "./custom.bat" |
1289 | set aFile [open $aCustomFilePath "w"] |
1290 | puts $aFile "@echo off" |
aafe169f |
1291 | puts $aFile "rem $aGenInfo" |
910970ab |
1292 | |
1293 | puts $aFile "" |
aafe169f |
1294 | puts $aFile "set PRJFMT=$::PRJFMT" |
910970ab |
1295 | puts $aFile "set VCVER=$::VCVER" |
1296 | puts $aFile "set ARCH=$::ARCH" |
1297 | puts $aFile "set VCVARS=$::VCVARS" |
1298 | puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS" |
1299 | |
1300 | puts $aFile "" |
1301 | puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\"" |
1302 | |
1303 | puts $aFile "" |
1304 | puts $aFile "rem Optional 3rd-parties switches" |
e22105a9 |
1305 | foreach anEnvIter $::THE_ENV_VARIABLES { |
1306 | set aName ${anEnvIter} |
1307 | set aValue [set ::${anEnvIter}] |
1308 | if { "$aValue" != "" } { |
1309 | puts $aFile "set ${aName}=$aValue" |
1310 | } |
1311 | } |
910970ab |
1312 | |
1313 | set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER] |
2506cf29 |
1314 | if { "$::PRODUCTS_PATH" != "" } { |
1315 | set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "%PRODUCTS_PATH%"] |
1316 | } |
910970ab |
1317 | puts $aFile "" |
1318 | puts $aFile "rem Additional headers search paths" |
1319 | puts $aFile "set \"CSF_OPT_INC=$aStringInc\"" |
1320 | |
1321 | set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER] |
2506cf29 |
1322 | if { "$::PRODUCTS_PATH" != "" } { |
1323 | set aStringLib32 [regsub -all "$::PRODUCTS_PATH" $aStringLib32 "%PRODUCTS_PATH%"] |
1324 | } |
910970ab |
1325 | puts $aFile "" |
1326 | puts $aFile "rem Additional libraries (32-bit) search paths" |
1327 | puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\"" |
1328 | |
ea99d048 |
1329 | set aStringLib32d [join $::CSF_OPT_LIB32D $::SYS_PATH_SPLITTER] |
1330 | if { "$::PRODUCTS_PATH" != "" } { |
1331 | set aStringLib32d [regsub -all "$::PRODUCTS_PATH" $aStringLib32d "%PRODUCTS_PATH%"] |
1332 | } |
1333 | puts $aFile "" |
1334 | puts $aFile "rem Additional debug libraries (32-bit) search paths" |
1335 | if { "$aStringLib32d" != "" && "$aStringLib32" != "" } { |
1336 | puts $aFile "set \"CSF_OPT_LIB32D=$aStringLib32d;%CSF_OPT_LIB32%\"" |
1337 | } else { |
1338 | puts $aFile "set \"CSF_OPT_LIB32D=$aStringLib32d\"" |
1339 | } |
1340 | |
910970ab |
1341 | set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER] |
2506cf29 |
1342 | if { "$::PRODUCTS_PATH" != "" } { |
1343 | set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"] |
1344 | } |
910970ab |
1345 | puts $aFile "" |
1346 | puts $aFile "rem Additional libraries (64-bit) search paths" |
1347 | puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\"" |
1348 | |
ea99d048 |
1349 | set aStringLib64d [join $::CSF_OPT_LIB64D $::SYS_PATH_SPLITTER] |
1350 | if { "$::PRODUCTS_PATH" != "" } { |
1351 | set aStringLib64d [regsub -all "$::PRODUCTS_PATH" $aStringLib64d "%PRODUCTS_PATH%"] |
1352 | } |
1353 | puts $aFile "" |
1354 | puts $aFile "rem Additional debug libraries (64-bit) search paths" |
1355 | if { "$aStringLib64d" != "" && "$aStringLib64" != "" } { |
1356 | puts $aFile "set \"CSF_OPT_LIB64D=$aStringLib64d;%CSF_OPT_LIB64%\"" |
1357 | } else { |
1358 | puts $aFile "set \"CSF_OPT_LIB64D=$aStringLib64d\"" |
1359 | } |
1360 | |
910970ab |
1361 | set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER] |
2506cf29 |
1362 | if { "$::PRODUCTS_PATH" != "" } { |
1363 | set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"] |
1364 | } |
910970ab |
1365 | puts $aFile "" |
1366 | puts $aFile "rem Additional (32-bit) search paths" |
1367 | puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\"" |
1368 | |
ea99d048 |
1369 | set aStringBin32d [join $::CSF_OPT_BIN32D $::SYS_PATH_SPLITTER] |
1370 | if { "$::PRODUCTS_PATH" != "" } { |
1371 | set aStringBin32d [regsub -all "$::PRODUCTS_PATH" $aStringBin32d "%PRODUCTS_PATH%"] |
1372 | } |
1373 | puts $aFile "" |
1374 | puts $aFile "rem Additional debug (32-bit) search paths" |
1375 | if { "$aStringBin32d" != "" && "$aStringBin32" != "" } { |
1376 | puts $aFile "set \"CSF_OPT_BIN32D=$aStringBin32d;%CSF_OPT_BIN32%\"" |
1377 | } else { |
1378 | puts $aFile "set \"CSF_OPT_BIN32D=$aStringBin32d\"" |
1379 | } |
1380 | |
910970ab |
1381 | set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER] |
2506cf29 |
1382 | if { "$::PRODUCTS_PATH" != "" } { |
1383 | set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"] |
1384 | } |
910970ab |
1385 | puts $aFile "" |
1386 | puts $aFile "rem Additional (64-bit) search paths" |
1387 | puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\"" |
1388 | |
ea99d048 |
1389 | set aStringBin64d [join $::CSF_OPT_BIN64D $::SYS_PATH_SPLITTER] |
1390 | if { "$::PRODUCTS_PATH" != "" } { |
1391 | set aStringBin64d [regsub -all "$::PRODUCTS_PATH" $aStringBin64d "%PRODUCTS_PATH%"] |
1392 | } |
1393 | puts $aFile "" |
1394 | puts $aFile "rem Additional debug (64-bit) search paths" |
1395 | if { "$aStringBin64d" != "" && "$aStringBin64" != "" } { |
1396 | puts $aFile "set \"CSF_OPT_BIN64D=$aStringBin64d;%CSF_OPT_BIN64%\"" |
1397 | } else { |
1398 | puts $aFile "set \"CSF_OPT_BIN64D=$aStringBin64d\"" |
1399 | } |
1400 | |
910970ab |
1401 | close $aFile |
1402 | } else { |
1403 | set aCustomFilePath "./custom.sh" |
1404 | set aFile [open $aCustomFilePath "w"] |
1405 | puts $aFile "#!/bin/bash" |
aafe169f |
1406 | puts $aFile "# $aGenInfo" |
910970ab |
1407 | |
c7d774c5 |
1408 | puts $aFile "" |
aafe169f |
1409 | puts $aFile "export PRJFMT=$::PRJFMT" |
c7d774c5 |
1410 | puts $aFile "export ARCH=$::ARCH" |
1411 | puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS" |
910970ab |
1412 | |
1413 | puts $aFile "" |
1414 | puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\"" |
1415 | |
1416 | puts $aFile "" |
1417 | puts $aFile "# Optional 3rd-parties switches" |
e22105a9 |
1418 | foreach anEnvIter $::THE_ENV_VARIABLES { |
1419 | set aName ${anEnvIter} |
1420 | set aValue [set ::${anEnvIter}] |
1421 | if { "$aValue" != "" } { |
1422 | puts $aFile "export ${aName}=${aValue}" |
1423 | } |
910970ab |
1424 | } |
910970ab |
1425 | |
1426 | set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER] |
2506cf29 |
1427 | if { "$::PRODUCTS_PATH" != "" } { |
1428 | set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "\${PRODUCTS_PATH}"] |
1429 | } |
910970ab |
1430 | puts $aFile "" |
1431 | puts $aFile "# Additional headers search paths" |
1432 | puts $aFile "export CSF_OPT_INC=\"$aStringInc\"" |
1433 | |
2506cf29 |
1434 | set aStringLib [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER] |
1435 | if { "$::PRODUCTS_PATH" != "" } { |
1436 | set aStringLib [regsub -all "$::PRODUCTS_PATH" $aStringLib "\${PRODUCTS_PATH}"] |
1437 | } |
910970ab |
1438 | puts $aFile "" |
1439 | puts $aFile "# Additional libraries ($::ARCH-bit) search paths" |
2506cf29 |
1440 | puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\"" |
910970ab |
1441 | |
ea99d048 |
1442 | set aStringLibD [join [set ::CSF_OPT_LIB${::ARCH}D] $::SYS_PATH_SPLITTER] |
1443 | if { "$::PRODUCTS_PATH" != "" } { |
1444 | set aStringLibD [regsub -all "$::PRODUCTS_PATH" $aStringLibD "\${PRODUCTS_PATH}"] |
1445 | } |
1446 | puts $aFile "" |
1447 | puts $aFile "# Additional debug libraries ($::ARCH-bit) search paths" |
1448 | if { "$aStringLibD" != "" && "$aStringLib" != "" } { |
1449 | puts $aFile "export CSF_OPT_LIB${::ARCH}D=\"[set aStringLibD]:\$CSF_OPT_LIB${::ARCH}\"" |
1450 | } else { |
1451 | puts $aFile "export CSF_OPT_LIB${::ARCH}D=\"[set aStringLibD]\"" |
1452 | } |
1453 | |
2506cf29 |
1454 | set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER] |
1455 | if { "$::PRODUCTS_PATH" != "" } { |
1456 | set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"] |
1457 | } |
910970ab |
1458 | puts $aFile "" |
1459 | puts $aFile "# Additional ($::ARCH-bit) search paths" |
2506cf29 |
1460 | puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\"" |
910970ab |
1461 | |
ea99d048 |
1462 | set aStringBinD [join [set ::CSF_OPT_BIN${::ARCH}D] $::SYS_PATH_SPLITTER] |
1463 | if { "$::PRODUCTS_PATH" != "" } { |
1464 | set aStringBinD [regsub -all "$::PRODUCTS_PATH" $aStringBinD "\${PRODUCTS_PATH}"] |
1465 | } |
1466 | puts $aFile "" |
1467 | puts $aFile "# Additional debug ($::ARCH-bit) search paths" |
1468 | if { "$aStringBinD" != "" && "$aStringBin" != "" } { |
1469 | puts $aFile "export CSF_OPT_BIN${::ARCH}D=\"[set aStringBinD]:\$CSF_OPT_BIN${::ARCH}\"" |
1470 | } else { |
1471 | puts $aFile "export CSF_OPT_BIN${::ARCH}D=\"[set aStringBinD]\"" |
1472 | } |
1473 | |
910970ab |
1474 | close $aFile |
1475 | } |
910970ab |
1476 | puts "Configuration saved to file '$aCustomFilePath'" |
aafe169f |
1477 | |
2506cf29 |
1478 | # generate custom.auto.pri |
1479 | set toExportCustomPri 1 |
1480 | if { $toExportCustomPri == 1 } { |
aafe169f |
1481 | set aCasVer [wokdep:DetectCasVersion] |
1482 | set aCustomFilePath "./adm/qmake/custom.auto.pri" |
1483 | set aFile [open $aCustomFilePath "w"] |
1484 | puts $aFile "# $aGenInfo" |
1485 | |
1486 | puts $aFile "" |
1487 | puts $aFile "VERSION=$aCasVer" |
1488 | puts $aFile "PRODUCTS_PATH=\"$::PRODUCTS_PATH\"" |
1489 | |
1490 | puts $aFile "" |
1491 | puts $aFile "# Optional 3rd-parties switches" |
1492 | foreach anEnvIter $::THE_ENV_VARIABLES { |
1493 | set aName ${anEnvIter} |
1494 | set aValue [set ::${anEnvIter}] |
1495 | if { "$aValue" == "true" } { |
1496 | puts $aFile "CONFIG += ${aName}" |
1497 | } else { |
1498 | #puts $aFile "CONFIG -= ${aName}" |
1499 | } |
1500 | } |
1501 | |
1502 | puts $aFile "" |
1503 | puts $aFile "# Additional headers search paths" |
1504 | foreach anIncPath $::CSF_OPT_INC { |
2506cf29 |
1505 | if { "$::PRODUCTS_PATH" != "" } { |
1506 | set anIncPath [regsub -all "$::PRODUCTS_PATH" $anIncPath "\$\$\{PRODUCTS_PATH\}"] |
1507 | } |
aafe169f |
1508 | puts $aFile "INCLUDEPATH += \"${anIncPath}\"" |
1509 | } |
1510 | |
ea99d048 |
1511 | puts $aFile "" |
1512 | puts $aFile "CONFIG(debug, debug|release) {" |
1513 | puts $aFile " # Additional debug libraries search paths" |
1514 | foreach aLibPath [set ::CSF_OPT_LIB${::ARCH}D] { |
1515 | if { "$::PRODUCTS_PATH" != "" } { |
1516 | set aLibPath [regsub -all "$::PRODUCTS_PATH" $aLibPath "\$\$\{PRODUCTS_PATH\}"] |
1517 | } |
1518 | puts $aFile " LIBS += -L\"${aLibPath}\"" |
1519 | } |
1520 | if { "$::tcl_platform(platform)" == "windows" } { |
1521 | puts $aFile "" |
1522 | puts $aFile " # Additional debug DLLs search paths" |
1523 | foreach aDllPath [set ::CSF_OPT_BIN${::ARCH}D] { |
1524 | if { "$::PRODUCTS_PATH" != "" } { |
1525 | set aDllPath [regsub -all "$::PRODUCTS_PATH" $aDllPath "\$\$\{PRODUCTS_PATH\}"] |
1526 | } |
1527 | puts $aFile " LIBS += -L\"${aDllPath}\"" |
1528 | } |
1529 | } |
1530 | puts $aFile "}" |
1531 | |
aafe169f |
1532 | puts $aFile "" |
1533 | puts $aFile "# Additional libraries search paths" |
1534 | foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] { |
2506cf29 |
1535 | if { "$::PRODUCTS_PATH" != "" } { |
1536 | set aLibPath [regsub -all "$::PRODUCTS_PATH" $aLibPath "\$\$\{PRODUCTS_PATH\}"] |
1537 | } |
aafe169f |
1538 | puts $aFile "LIBS += -L\"${aLibPath}\"" |
1539 | } |
1540 | |
1541 | if { "$::tcl_platform(platform)" == "windows" } { |
1542 | puts $aFile "" |
1543 | puts $aFile "# Additional DLLs search paths" |
1544 | foreach aDllPath [set ::CSF_OPT_BIN$::ARCH] { |
2506cf29 |
1545 | if { "$::PRODUCTS_PATH" != "" } { |
1546 | set aDllPath [regsub -all "$::PRODUCTS_PATH" $aDllPath "\$\$\{PRODUCTS_PATH\}"] |
1547 | } |
aafe169f |
1548 | puts $aFile "LIBS += -L\"${aDllPath}\"" |
1549 | } |
1550 | } |
1551 | |
1552 | puts $aFile "" |
1553 | close $aFile |
1554 | puts "Configuration saved to file '$aCustomFilePath'" |
1555 | } |
910970ab |
1556 | } |