0028189: Result of Boolean operation is non-manifold wire
[occt.git] / adm / genconfdeps.tcl
CommitLineData
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 22set ARCH "64"
910970ab 23
24if { "$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"
30 } else {
31 set SYS_LIB_SUFFIX "so"
32 }
33 set VCVER "gcc"
34 set VCVARS ""
35} elseif { "$tcl_platform(platform)" == "windows" } {
36 set SYS_PATH_SPLITTER ";"
37 set SYS_LIB_PREFIX ""
38 set SYS_LIB_SUFFIX "lib"
39 set SYS_EXE_SUFFIX ".exe"
40 set VCVER "vc10"
41 set VCVARS ""
42}
43
5951a088 44set SHORTCUT_HEADERS "ShortCut"
910970ab 45
46set HAVE_FREEIMAGE "false"
47set HAVE_GL2PS "false"
48set HAVE_TBB "false"
a9b51f49 49set HAVE_D3D "false"
1ce0716b 50set HAVE_GLES2 "false"
910970ab 51set HAVE_OPENCL "false"
52set HAVE_VTK "false"
53set MACOSX_USE_GLX "false"
54set CHECK_QT4 "false"
55set CHECK_JDK "false"
56set PRODUCTS_PATH ""
57set CSF_OPT_INC [list]
58set CSF_OPT_LIB32 [list]
59set CSF_OPT_LIB64 [list]
60set CSF_OPT_BIN32 [list]
61set CSF_OPT_BIN64 [list]
62
c7d774c5 63if { "$tcl_platform(pointerSize)" == "4" } {
64 set ARCH "32"
65}
910970ab 66if { [info exists ::env(ARCH)] } {
67 set ARCH "$::env(ARCH)"
68}
69if { [info exists ::env(VCVER)] } {
70 set VCVER "$::env(VCVER)"
71}
72if { [info exists ::env(VCVARS)] } {
73 set VCVARS "$::env(VCVARS)"
74}
75if { [info exists ::env(SHORTCUT_HEADERS)] } {
76 set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
5951a088 77 if { $SHORTCUT_HEADERS == "true" } {
78 set SHORTCUT_HEADERS "ShortCut"
79 }
910970ab 80}
81if { [info exists ::env(HAVE_FREEIMAGE)] } {
82 set HAVE_FREEIMAGE "$::env(HAVE_FREEIMAGE)"
83}
84if { [info exists ::env(HAVE_GL2PS)] } {
85 set HAVE_GL2PS "$::env(HAVE_GL2PS)"
86}
87if { [info exists ::env(HAVE_TBB)] } {
88 set HAVE_TBB "$::env(HAVE_TBB)"
89}
a9b51f49 90if { [info exists ::env(HAVE_D3D)] } {
91 set HAVE_D3D "$::env(HAVE_D3D)"
92}
1ce0716b 93if { [info exists ::env(HAVE_GLES2)] } {
94 set HAVE_GLES2 "$::env(HAVE_GLES2)"
95}
910970ab 96if { [info exists ::env(HAVE_OPENCL)] } {
97 set HAVE_OPENCL "$::env(HAVE_OPENCL)"
98}
99if { [info exists ::env(HAVE_VTK)] } {
100 set HAVE_VTK "$::env(HAVE_VTK)"
101}
102if { [info exists ::env(MACOSX_USE_GLX)] } {
103 set MACOSX_USE_GLX "$::env(MACOSX_USE_GLX)"
104}
105if { [info exists ::env(CHECK_QT4)] } {
106 set CHECK_QT4 "$::env(CHECK_QT4)"
107}
108if { [info exists ::env(CHECK_JDK)] } {
109 set CHECK_JDK "$::env(CHECK_JDK)"
110}
111if { [info exists ::env(PRODUCTS_PATH)] } {
112 set PRODUCTS_PATH "$::env(PRODUCTS_PATH)"
113}
114if { [info exists ::env(CSF_OPT_INC)] } {
115 set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER]
116}
117if { [info exists ::env(CSF_OPT_LIB32)] } {
118 set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER]
119}
120if { [info exists ::env(CSF_OPT_LIB64)] } {
121 set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER]
122}
123if { [info exists ::env(CSF_OPT_BIN32)] } {
124 set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER]
125}
126if { [info exists ::env(CSF_OPT_BIN64)] } {
127 set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER]
128}
129
130# Search header file in $::CSF_OPT_INC and standard paths
131proc wokdep:SearchHeader {theHeader} {
132 # search in custom paths
133 foreach anIncPath $::CSF_OPT_INC {
134 set aPath "${anIncPath}/${theHeader}"
135 if { [file exists "$aPath"] } {
136 return "$aPath"
137 }
138 }
139
140 # search in system
141 set aPath "/usr/include/${theHeader}"
142 if { [file exists "$aPath"] } {
143 return "$aPath"
144 }
145 return ""
146}
147
148# Search library file in $::CSF_OPT_LIB* and standard paths
149proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} {
150 if { "$theSearchPath" != "" } {
151 set aPath "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
152 if { [file exists "$aPath"] } {
153 return "$aPath"
154 } else {
155 return ""
156 }
157 }
158
159 # search in custom paths
160 foreach aLibPath [set ::CSF_OPT_LIB$theBitness] {
161 set aPath "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
162 if { [file exists "$aPath"] } {
163 return "$aPath"
164 }
165 }
166
167 # search in system
168 if { "$::ARCH" == "$theBitness"} {
169 set aPath "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
170 if { [file exists "$aPath"] } {
171 return "$aPath"
172 }
173 }
174
c7d774c5 175
176 if { "$::tcl_platform(os)" == "Linux" } {
910970ab 177 if { "$theBitness" == "64" } {
178 set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so"
179 if { [file exists "$aPath"] } {
180 return "$aPath"
181 }
182 } else {
183 set aPath "/usr/lib/i386-linux-gnu/lib${theLib}.so"
184 if { [file exists "$aPath"] } {
185 return "$aPath"
186 }
187 }
188 }
189
190 return ""
191}
192
193# Search file in $::CSF_OPT_BIN* and standard paths
194proc wokdep:SearchBin {theBin theBitness {theSearchPath ""}} {
195 if { "$theSearchPath" != "" } {
196 set aPath "${theSearchPath}/${theBin}"
197 if { [file exists "$aPath"] } {
198 return "$aPath"
199 } else {
200 return ""
201 }
202 }
203
204 # search in custom paths
205 foreach aBinPath [set ::CSF_OPT_BIN$theBitness] {
206 set aPath "${aBinPath}/${theBin}"
207 if { [file exists "$aPath"] } {
208 return "$aPath"
209 }
210 }
211
212 # search in system
213 if { "$::ARCH" == "$theBitness"} {
214 set aPath "/usr/bin/${theBin}"
215 if { [file exists "$aPath"] } {
216 return "$aPath"
217 }
218 }
219
220 return ""
221}
222
223# Detect compiler C-runtime version 'vc*' and architecture '32'/'64'
224# to determine preferred path.
225proc wokdep:Preferred {theList theCmpl theArch} {
226 if { [llength $theList] == 0 } {
227 return ""
228 }
229
230 set aShortList {}
231 foreach aPath $theList {
232 if { [string first "$theCmpl" "$aPath"] != "-1" } {
233 lappend aShortList "$aPath"
234 }
235 }
236
237 if { [llength $aShortList] == 0 } {
238 #return [lindex $theList 0]
239 set aShortList $theList
240 }
241
242 set aVeryShortList {}
243 foreach aPath $aShortList {
244 if { [string first "$theArch" "$aPath"] != "-1" } {
245 lappend aVeryShortList "$aPath"
246 }
247 }
248 if { [llength $aVeryShortList] == 0 } {
249 return [lindex [lsort -decreasing $aShortList] 0]
250 }
251
252 return [lindex [lsort -decreasing $aVeryShortList] 0]
253}
254
255# Search Tcl/Tk libraries placement
256proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
257 upvar $theErrInc anErrInc
258 upvar $theErrLib32 anErrLib32
259 upvar $theErrLib64 anErrLib64
260 upvar $theErrBin32 anErrBin32
261 upvar $theErrBin64 anErrBin64
262
263 set tclver_maj 8
264 set tclver_min 6
265
266 set isFound "true"
267 set aTclHPath [wokdep:SearchHeader "tcl.h"]
268 set aTkHPath [wokdep:SearchHeader "tk.h"]
269 if { "$aTclHPath" == "" || "$aTkHPath" == "" } {
270 if { [file exists "/usr/include/tcl8.6/tcl.h"]
271 && [file exists "/usr/include/tcl8.6/tk.h" ] } {
272 lappend ::CSF_OPT_INC "/usr/include/tcl8.6"
273 set aTclHPath "/usr/include/tcl8.6/tcl.h"
274 } else {
275 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ]
276 if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } {
277 lappend ::CSF_OPT_INC "$aPath/include"
278 set aTclHPath "$aPath/include/tcl.h"
279 } else {
280 lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)"
281 set isFound "false"
282 }
283 }
284 }
285
286 # detect tcl version by parsing header file
287 if { $isFound } {
288 set fh [open $aTclHPath]
289 set tcl_h [read $fh]
290 close $fh
291 regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj
292 regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min
293 }
294
295 if { "$::tcl_platform(platform)" == "windows" } {
296 set aTclLibName "tcl${tclver_maj}${tclver_min}"
297 set aTkLibName "tk${tclver_maj}${tclver_min}"
298 } else {
299 set aTclLibName "tcl${tclver_maj}.${tclver_min}"
300 set aTkLibName "tk${tclver_maj}.${tclver_min}"
301 }
302
303 foreach anArchIter {64 32} {
304 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter"]
305 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter"]
306 if { "$aTclLibPath" == "" || "$aTkLibPath" == "" } {
307 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
308 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter" "$aPath/lib"]
309 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter" "$aPath/lib"]
310 if { "$aTclLibPath" != "" && "$aTkLibPath" != "" } {
311 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
312 } else {
313 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aTclLibName}.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}${aTkLibName}.${::SYS_LIB_SUFFIX}' not found (Tcl/Tk)"
314 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
315 }
316 }
317
318 if { "$::tcl_platform(platform)" == "windows" } {
319 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter"]
320 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter"]
321 if { "$aTclDllPath" == "" || "$aTkDllPath" == "" } {
322 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
323 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter" "$aPath/bin"]
324 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter" "$aPath/bin"]
325 if { "$aTclDllPath" != "" && "$aTkDllPath" != "" } {
326 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
327 } else {
328 lappend anErrBin$anArchIter "Error: '${aTclLibName}.dll' or '${aTkLibName}.dll' not found (Tcl/Tk)"
329 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
330 }
331 }
332 }
333 }
334
335 return "$isFound"
336}
337
338# Search FreeType library placement
339proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
340 upvar $theErrInc anErrInc
341 upvar $theErrLib32 anErrLib32
342 upvar $theErrLib64 anErrLib64
343 upvar $theErrBin32 anErrBin32
344 upvar $theErrBin64 anErrBin64
345
346 set isFound "true"
347 set aFtBuildPath [wokdep:SearchHeader "ft2build.h"]
348
910970ab 349 if { "$aFtBuildPath" == "" } {
350 # TODO - use `freetype-config --cflags` instead
351 set aSysFreeType "/usr/include/freetype2"
c7d774c5 352 if { [file exists "$aSysFreeType/ft2build.h"] } {
910970ab 353 lappend ::CSF_OPT_INC "$aSysFreeType"
354 } elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } {
355 lappend ::CSF_OPT_INC "$aSysFreeType/freetype2"
356 } else {
357 set aSysFreeType "/usr/X11/include/freetype2"
358 if { [file exists "$aSysFreeType/ft2build.h"] } {
359 lappend ::CSF_OPT_INC "/usr/X11/include"
360 lappend ::CSF_OPT_INC "$aSysFreeType"
361 } else {
362 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$::ARCH" ]
363 if {"$aPath" != ""} {
364 if {[file exists "$aPath/include/ft2build.h"]} {
365 lappend ::CSF_OPT_INC "$aPath/include"
366 } elseif {[file exists "$aPath/include/freetype2/ft2build.h"]} {
367 lappend ::CSF_OPT_INC "$aPath/include/freetype2"
368 }
369 } else {
370 lappend anErrInc "Error: 'freetype.h' not found (FreeType2)"
371 set isFound "false"
372 }
373 }
374 }
375 }
376
377 # parse 'freetype-config --libs'
378 set aConfLibPath ""
379 if { [catch { set aConfLibs [exec freetype-config --libs] } ] == 0 } {
380 foreach aPath [split $aConfLibs " "] {
381 if { [string first "-L" "$aPath"] == 0 } {
382 set aConfLibPath [string range "$aPath" 2 [string length "$aPath"]]
383 }
384 }
385 }
386
387 foreach anArchIter {64 32} {
388 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter"]
389 if { "$aFtLibPath" == "" } {
390 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
391 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aPath/lib"]
392 if { "$aFtLibPath" != "" } {
393 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
394 } else {
395 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aConfLibPath"]
396 if { "$aFtLibPath" != "" } {
397 lappend ::CSF_OPT_LIB$anArchIter "$aConfLibPath"
398 } else {
399 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freetype.${::SYS_LIB_SUFFIX}' not found (FreeType2)"
400 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
401 }
402 }
403 }
404 if { "$::tcl_platform(platform)" == "windows" } {
405 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter"]
406 if { "$aFtDllPath" == "" } {
407 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
408 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/bin"]
409 if { "$aFtDllPath" != "" } {
410 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
411 } else {
412 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/lib"]
413 if { "$aFtDllPath" != "" } {
414 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
415 } else {
416 lappend anErrBin$anArchIter "Error: 'freetype.dll' not found (FreeType2)"
417 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
418 }
419 }
420 }
421 }
422 }
423
424 return "$isFound"
425}
426
427# Search FreeImage library placement
428proc wokdep:SearchFreeImage {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
429 upvar $theErrInc anErrInc
430 upvar $theErrLib32 anErrLib32
431 upvar $theErrLib64 anErrLib64
432 upvar $theErrBin32 anErrBin32
433 upvar $theErrBin64 anErrBin64
434
435 # binary distribution has another layout
436 set aFImageDist "Dist"
910970ab 437
438 set isFound "true"
f0d3b7af 439 set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
440 if { "$aFImageHPath" == "" } {
910970ab 441 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ]
f0d3b7af 442 if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] } {
910970ab 443 lappend ::CSF_OPT_INC "$aPath/include"
f0d3b7af 444 } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] } {
910970ab 445 lappend ::CSF_OPT_INC "$aPath/$aFImageDist"
910970ab 446 } else {
f0d3b7af 447 lappend anErrInc "Error: 'FreeImage.h' not found (FreeImage)"
910970ab 448 set isFound "false"
449 }
450 }
451
452 foreach anArchIter {64 32} {
f0d3b7af 453 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
454 if { "$aFImageLibPath" == "" } {
910970ab 455 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
f0d3b7af 456 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
457 if { "$aFImageLibPath" != "" } {
910970ab 458 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
459 } else {
f0d3b7af 460 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
461 if { "$aFImageLibPath" != "" } {
910970ab 462 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist"
910970ab 463 } else {
f0d3b7af 464 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
910970ab 465 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
466 }
467 }
468 }
469 if { "$::tcl_platform(platform)" == "windows" } {
60273f77 470 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"]
471 if { "$aFImageDllPath" == "" } {
910970ab 472 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
60273f77 473 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"]
474 if { "$aFImageDllPath" != "" } {
910970ab 475 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
476 } else {
60273f77 477 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"]
478 if { "$aFImageDllPath" != "" } {
910970ab 479 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist"
910970ab 480 } else {
60273f77 481 lappend anErrBin$anArchIter "Error: 'freeimage.dll' is not found (FreeImage)"
910970ab 482 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
483 }
484 }
485 }
486 }
487 }
488
489 return "$isFound"
490}
491
492# Search GL2PS library placement
493proc wokdep:SearchGL2PS {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
494 upvar $theErrInc anErrInc
495 upvar $theErrLib32 anErrLib32
496 upvar $theErrLib64 anErrLib64
497 upvar $theErrBin32 anErrBin32
498 upvar $theErrBin64 anErrBin64
499
500 set isFound "true"
501 set aGl2psHPath [wokdep:SearchHeader "gl2ps.h"]
502 if { "$aGl2psHPath" == "" } {
503 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$::ARCH" ]
504 if { "$aPath" != "" && [file exists "$aPath/include/gl2ps.h"] } {
505 lappend ::CSF_OPT_INC "$aPath/include"
506 } else {
507 lappend anErrInc "Error: 'gl2ps.h' not found (GL2PS)"
508 set isFound "false"
509 }
510 }
511
512 foreach anArchIter {64 32} {
513 set aGl2psLibPath [wokdep:SearchLib "gl2ps" "$anArchIter"]
514 if { "$aGl2psLibPath" == "" } {
515 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$anArchIter" ]
516 set aGl2psLibPath [wokdep:SearchLib "gl2ps" "$anArchIter" "$aPath/lib"]
517 if { "$aGl2psLibPath" != "" } {
518 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
519 } else {
520 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}gl2ps.${::SYS_LIB_SUFFIX}' not found (GL2PS)"
521 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
522 }
523 }
524 if { "$::tcl_platform(platform)" == "windows" } {
525 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter"]
526 if { "$aGl2psDllPath" == "" } {
527 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$anArchIter" ]
528 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter" "$aPath/bin"]
529 if { "$aGl2psDllPath" != "" } {
530 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
531 } else {
532 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter" "$aPath/lib"]
533 if { "$aGl2psDllPath" != "" } {
534 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
535 } else {
536 lappend anErrBin$anArchIter "Error: 'gl2ps.dll' not found (GL2PS)"
537 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
538 }
539 }
540 }
541 }
542 }
543
544 return "$isFound"
545}
546
547# Search TBB library placement
548proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
549 upvar $theErrInc anErrInc
550 upvar $theErrLib32 anErrLib32
551 upvar $theErrLib64 anErrLib64
552 upvar $theErrBin32 anErrBin32
553 upvar $theErrBin64 anErrBin64
554
555 set isFound "true"
556 set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"]
557 if { "$aTbbHPath" == "" } {
558 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ]
559 if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } {
560 lappend ::CSF_OPT_INC "$aPath/include"
561 } else {
562 lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)"
563 set isFound "false"
564 }
565 }
566
567 foreach anArchIter {64 32} {
568 set aSubDir "ia32"
569 if { "$anArchIter" == "64"} {
570 set aSubDir "intel64"
571 }
572
573 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"]
574 if { "$aTbbLibPath" == "" } {
575 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
576 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/${::VCVER}"]
577 if { "$aTbbLibPath" == "" } {
578 # Set the path to the TBB library for Linux
579 if { "$::tcl_platform(platform)" != "windows" } {
580 set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21"
581 }
582 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"]
583 if { "$aTbbLibPath" != "" } {
584 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir"
585 }
586 } else {
587 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/${::VCVER}"
588 }
589 if { "$aTbbLibPath" == "" } {
590 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
591 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
592 }
593 }
594 if { "$::tcl_platform(platform)" == "windows" } {
595 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
596 if { "$aTbbDllPath" == "" } {
597 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
598 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/${::VCVER}"]
599 if { "$aTbbDllPath" != "" } {
600 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/${::VCVER}"
601 } else {
602 lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
603 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
604 }
605 }
606 }
607 }
608
609 return "$isFound"
610}
611
612# Search OpenCL library placement
613proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
614 upvar $theErrInc anErrInc
615 upvar $theErrLib32 anErrLib32
616 upvar $theErrLib64 anErrLib64
617 upvar $theErrBin32 anErrBin32
618 upvar $theErrBin64 anErrBin64
619
620 set isFound "true"
621 if { "$::tcl_platform(os)" == "Darwin" } {
622 # OpenCL framework available since Mac OS X 16
623 return "$isFound"
624 }
625
626 set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"]
627 if { "$aCLHPath" == "" } {
628 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ]
629 if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } {
630 lappend ::CSF_OPT_INC "$aPath/include"
631 } else {
632 lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)"
633 set isFound "false"
634 }
635 }
636
637 foreach anArchIter {64 32} {
638 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"]
639 if { "$aCLLibPath" == "" } {
640 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ]
641 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"]
642 if { "$aCLLibPath" != "" } {
643 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
644 } else {
645 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)"
646 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
647 }
648 }
649 }
650
651 return "$isFound"
652}
653
1ce0716b 654# Search EGL library placement
655proc wokdep:SearchEGL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
656 upvar $theErrInc anErrInc
657 upvar $theErrLib32 anErrLib32
658 upvar $theErrLib64 anErrLib64
659 upvar $theErrBin32 anErrBin32
660 upvar $theErrBin64 anErrBin64
661
662 set isFound "true"
663 set aHeaderPath [wokdep:SearchHeader "EGL/egl.h"]
664 if { "$aHeaderPath" == "" } {
665 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$::ARCH" ]
666 if { "$aPath" == "" || ![file exists "$aPath/include/EGL/egl.h"] } {
667 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
668 }
669
670 if { "$aPath" != "" && [file exists "$aPath/include/EGL/egl.h"] } {
671 lappend ::CSF_OPT_INC "$aPath/include"
672 } else {
673 lappend anErrInc "Error: 'EGL/egl.h' not found (EGL)"
674 set isFound "false"
675 }
676 }
677
678 set aLibName "EGL"
679 if { "$::tcl_platform(platform)" == "windows" } {
680 # awkward exception
681 set aLibName "libEGL"
682 }
683
684 foreach anArchIter {64 32} {
685 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
686 if { "$aLibPath" == "" } {
687 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
688 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
689 if { "$aLibPath" == "" } {
690 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
691 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
692 }
693
694 if { "$aLibPath" != "" } {
695 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
696 } else {
697 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (EGL)"
698 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
699 }
700 }
701
702 if { "$::tcl_platform(platform)" == "windows" } {
703 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter"]
704 if { "$aDllPath" == "" } {
705 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
706 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
707 if { "$aDllPath" == "" } {
708 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
709 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
710 }
711
712 if { "$aDllPath" != "" } {
713 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
714 } else {
715 lappend anErrBin$anArchIter "Error: 'libEGL.dll' not found (EGL)"
716 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
717 }
718 }
719 }
720 }
721
722 return "$isFound"
723}
724
725# Search OpenGL ES 2.0 library placement
726proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
727 upvar $theErrInc anErrInc
728 upvar $theErrLib32 anErrLib32
729 upvar $theErrLib64 anErrLib64
730 upvar $theErrBin32 anErrBin32
731 upvar $theErrBin64 anErrBin64
732
733 set isFound "true"
734 set aHeaderPath [wokdep:SearchHeader "GLES2/gl2.h"]
735 if { "$aHeaderPath" == "" } {
736 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$::ARCH" ]
737 if { "$aPath" == "" || ![file exists "$aPath/include/GLES2/gl2.h"] } {
738 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
739 }
740
741 if { "$aPath" != "" && [file exists "$aPath/include/GLES2/gl2.h"] } {
742 lappend ::CSF_OPT_INC "$aPath/include"
743 } else {
744 lappend anErrInc "Error: 'GLES2/gl2.h' not found (OpenGL ES 2.0)"
745 set isFound "false"
746 }
747 }
748
749 set aLibName "GLESv2"
750 if { "$::tcl_platform(platform)" == "windows" } {
751 # awkward exception
752 set aLibName "libGLESv2"
753 }
754
755 foreach anArchIter {64 32} {
756 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
757 if { "$aLibPath" == "" } {
758 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$anArchIter" ]
759 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
760 if { "$aLibPath" == "" } {
761 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
762 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
763 }
764
765 if { "$aLibPath" != "" } {
766 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
767 } else {
768 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (OpenGL ES 2.0)"
769 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
770 }
771 }
772
773 if { "$::tcl_platform(platform)" == "windows" } {
774 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter"]
775 if { "$aDllPath" == "" } {
776 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
777 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
778 if { "$aDllPath" == "" } {
779 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
780 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
781 }
782
783 if { "$aDllPath" != "" } {
784 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
785 } else {
786 lappend anErrBin$anArchIter "Error: 'libGLESv2.dll' not found (OpenGL ES 2.0)"
787 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
788 }
789 }
790 }
791 }
792
793 return "$isFound"
794}
795
910970ab 796# Auxiliary function, gets VTK version to set default search directory
797proc wokdep:VtkVersion { thePath } {
798 set aResult "6.1"
799
800 set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0]
801 if { "$aVtkRoot" != "" } {
802 set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot]
803 if { "$aVtkRoot" != "" } {
804 set aResult $aVtkRoot
805 }
806 }
807
808 return $aResult
809}
810
811# Search VTK library placement
812proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
813 upvar $theErrInc anErrInc
814 upvar $theErrLib32 anErrLib32
815 upvar $theErrLib64 anErrLib64
816 upvar $theErrBin32 anErrBin32
817 upvar $theErrBin64 anErrBin64
818
819 set isFound "true"
820
821 set aVtkPath ""
822 set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"]
823 set aVtkVer [wokdep:VtkVersion $aVtkIncPath]
824 if { "$aVtkIncPath" == ""} {
825 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
826 set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ]
827 if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} {
828 set aVtkVer [wokdep:VtkVersion $aVtkPath]
829 lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]"
830 } else { # try to search in all found paths
831 set isFound "false"
832 foreach anIt $aPathList {
833 if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } {
834 set aVtkPath $anIt
835 set aVtkVer [wokdep:VtkVersion $aVtkPath]
836 lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]"
837 set isFound "true"
838 break
839 }
840 }
841
842 # Bad case: we do not found vtkConfigure.h in all paths.
843 if { "$isFound" == "false"} {
844 lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)"
845 set isFound "false"
846 }
847 }
848 }
849
850 set aVtkLibPath ""
851 foreach anArchIter {64 32} {
852 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"]
853 if { "$aVtkLibPath" == "" } {
854 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
855 set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ]
856 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"]
857 if { "$aVtkLibPath" != "" } {
858 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
859 } else {
860 set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"]
861 if { "$aPath" != "" } {
862 set aLibPath $aVtkIncPath
863 lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib"
864 } else {
865 # The last chance: search /lib directory in all found paths
866 foreach anIt $aPathList {
867 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"]
868 if { "$aVtkLibPath" != ""} {
869 lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib"
870 break
871 }
872 }
873 if { "$aVtkLibPath" == "" } {
874 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)"
875 if { "$::ARCH" == "$anArchIter" } {
876 set isFound "false"
877 }
878 }
879 }
880 }
881 }
882 }
883
884 # Search binary path
885 if { "$::tcl_platform(platform)" == "windows" } {
886 foreach anArchIter {64 32} {
887 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
888 if { "$aVtkBinPath" == "" } {
889 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
890 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
891 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
892 } else {
893 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
894 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
895 }
896 }
897 }
898
899 # We didn't find preferred binary path => search through inc path or among all available VTK directories
900 if { "$aVtkBinPath" == "" } {
901 # Try to find in lib path
e31a8e52 902 set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/bin"]
903 if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/bin"
904 } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/lib"] != "" } {
905 lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/lib"
910970ab 906 } else {
907 lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
908 set isFound "false"
909 }
910 }
911 }
912
913 return "$isFound"
914}
915
916# Search Qt4 libraries placement
917proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
918 upvar $theErrInc anErrInc
919 upvar $theErrLib32 anErrLib32
920 upvar $theErrLib64 anErrLib64
921 upvar $theErrBin32 anErrBin32
922 upvar $theErrBin64 anErrBin64
923
924 set isFound "true"
925 set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
926 if { "$aQMsgBoxHPath" == "" } {
927 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
928 if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
929 lappend ::CSF_OPT_INC "$aPath/include"
930 lappend ::CSF_OPT_INC "$aPath/include/Qt"
931 lappend ::CSF_OPT_INC "$aPath/include/QtGui"
932 lappend ::CSF_OPT_INC "$aPath/include/QtCore"
933 } else {
934 if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
935 lappend ::CSF_OPT_INC "/usr/include/qt4"
936 lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
937 lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
938 lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
939 } else {
940 lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
941 set isFound "false"
942 }
943 }
944 }
945
946 set aQtGuiLibName "QtGui"
947 if { "$::tcl_platform(platform)" == "windows" } {
948 set aQtGuiLibName "QtGui4"
949 }
950
951 foreach anArchIter {64 32} {
952 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
953 if { "$aQMsgBoxLibPath" == "" } {
954 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
955 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
956 if { "$aQMsgBoxLibPath" != "" } {
957 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
958 } else {
959 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
960 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
961 }
962 }
963 if { "$::tcl_platform(platform)" == "windows" } {
964 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
965 if { "$aQMsgBoxDllPath" == "" } {
966 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
967 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
968 if { "$aQMsgBoxDllPath" != "" } {
969 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
970 } else {
971 lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
972 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
973 }
974 }
975 }
976 }
977
978 return "$isFound"
979}
980
981# Search JDK placement
982proc wokdep:SearchJDK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
983 upvar $theErrInc anErrInc
984 upvar $theErrLib32 anErrLib32
985 upvar $theErrLib64 anErrLib64
986 upvar $theErrBin32 anErrBin32
987 upvar $theErrBin64 anErrBin64
988
989 set isFound "true"
990 set aJniHPath [wokdep:SearchHeader "jni.h"]
991 set aJniMdHPath [wokdep:SearchHeader "jni_md.h"]
992 if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } {
993 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ]
994 if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } {
995 lappend ::CSF_OPT_INC "$aPath/include"
996 if { "$::tcl_platform(platform)" == "windows" } {
997 lappend ::CSF_OPT_INC "$aPath/include/win32"
998 } elseif { [file exists "$aPath/include/linux"] } {
999 lappend ::CSF_OPT_INC "$aPath/include/linux"
1000 }
1001 } else {
1002 if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } {
1003 lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include"
1004 } else {
1005 lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)"
1006 set isFound "false"
1007 }
1008 }
1009 }
1010
1011 foreach anArchIter {64 32} {
1012 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"]
1013 if { "$aJavacPath" == "" } {
1014 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ]
1015 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"]
1016 if { "$aJavacPath" != "" } {
1017 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1018 } else {
1019 if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } {
1020 lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin"
1021 } else {
1022 lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)"
1023 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1024 }
1025 }
1026 }
1027 }
1028
1029 return "$isFound"
1030}
1031
1032# Search X11 libraries placement
1033proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1034 upvar $theErrInc anErrInc
1035 upvar $theErrLib32 anErrLib32
1036 upvar $theErrLib64 anErrLib64
1037 upvar $theErrBin32 anErrBin32
1038 upvar $theErrBin64 anErrBin64
1039
1040 set isFound "true"
1041 if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
1042 return "$isFound"
1043 }
1044
1045 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
1046 if { "$aXmuLibPath" == "" } {
1047 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
1048 if { "$aXmuLibPath" != "" } {
1049 #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
1050 } else {
1051 lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
1052 set isFound "false"
1053 }
1054 }
1055
1056 return "$isFound"
1057}
1058
1059# Generate (override) custom environment file
1060proc wokdep:SaveCustom {} {
1061 if { "$::tcl_platform(platform)" == "windows" } {
1062 set aCustomFilePath "./custom.bat"
1063 set aFile [open $aCustomFilePath "w"]
1064 puts $aFile "@echo off"
1065 puts $aFile "rem This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1066
1067 puts $aFile ""
1068 puts $aFile "set VCVER=$::VCVER"
1069 puts $aFile "set ARCH=$::ARCH"
1070 puts $aFile "set VCVARS=$::VCVARS"
1071 puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1072
1073 puts $aFile ""
1074 puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\""
1075
1076 puts $aFile ""
1077 puts $aFile "rem Optional 3rd-parties switches"
1078 puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
1079 puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS"
1080 puts $aFile "set HAVE_TBB=$::HAVE_TBB"
1ce0716b 1081 puts $aFile "set HAVE_GLES2=$::HAVE_GLES2"
a9b51f49 1082 puts $aFile "set HAVE_D3D=$::HAVE_D3D"
910970ab 1083 puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL"
1084 puts $aFile "set HAVE_VTK=$::HAVE_VTK"
1085 puts $aFile "set CHECK_QT4=$::CHECK_QT4"
1086 puts $aFile "set CHECK_JDK=$::CHECK_JDK"
1087
1088 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1089 puts $aFile ""
1090 puts $aFile "rem Additional headers search paths"
1091 puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
1092
1093 set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
1094 puts $aFile ""
1095 puts $aFile "rem Additional libraries (32-bit) search paths"
1096 puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
1097
1098 set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
1099 puts $aFile ""
1100 puts $aFile "rem Additional libraries (64-bit) search paths"
1101 puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
1102
1103 set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
1104 puts $aFile ""
1105 puts $aFile "rem Additional (32-bit) search paths"
1106 puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
1107
1108 set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
1109 puts $aFile ""
1110 puts $aFile "rem Additional (64-bit) search paths"
1111 puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
1112
1113 close $aFile
1114 } else {
1115 set aCustomFilePath "./custom.sh"
1116 set aFile [open $aCustomFilePath "w"]
1117 puts $aFile "#!/bin/bash"
1118 puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1119
c7d774c5 1120 puts $aFile ""
1121 puts $aFile "export ARCH=$::ARCH"
1122 puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
910970ab 1123
1124 puts $aFile ""
1125 puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1126
1127 puts $aFile ""
1128 puts $aFile "# Optional 3rd-parties switches"
1129 puts $aFile "export HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
1130 puts $aFile "export HAVE_GL2PS=$::HAVE_GL2PS"
1131 puts $aFile "export HAVE_TBB=$::HAVE_TBB"
1ce0716b 1132 puts $aFile "export HAVE_GLES2=$::HAVE_GLES2"
910970ab 1133 puts $aFile "export HAVE_OPENCL=$::HAVE_OPENCL"
1134 puts $aFile "export HAVE_VTK=$::HAVE_VTK"
1135 if { "$::tcl_platform(os)" == "Darwin" } {
1136 puts $aFile "export MACOSX_USE_GLX=$::MACOSX_USE_GLX"
1137 }
1138 puts $aFile "export CHECK_QT4=$::CHECK_QT4"
1139 puts $aFile "export CHECK_JDK=$::CHECK_JDK"
1140
1141 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1142 puts $aFile ""
1143 puts $aFile "# Additional headers search paths"
1144 puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
1145
1146 set aStringLib$::ARCH [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
1147 puts $aFile ""
1148 puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
1149 puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib$::ARCH]\""
1150
1151 set aStringBin$::ARCH [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
1152 puts $aFile ""
1153 puts $aFile "# Additional ($::ARCH-bit) search paths"
1154 puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin$::ARCH]\""
1155
1156 close $aFile
1157 }
1158
1159 puts "Configuration saved to file '$aCustomFilePath'"
1160}