1 # =======================================================================
2 # Created on: 2012-01-26
3 # Created by: Kirill GAVRILOV
4 # Copyright (c) 2012 OPEN CASCADE SAS
6 # This file is part of Open CASCADE Technology software library.
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.
14 # Alternatively, this file may be used under the terms of Open CASCADE
15 # commercial license or contractual agreement.
17 # =======================================================================
18 # Tools for search of third-party libraries and generation on environment
19 # customization script
20 # =======================================================================
24 if { "$tcl_platform(platform)" == "unix" } {
25 set SYS_PATH_SPLITTER ":"
26 set SYS_LIB_PREFIX "lib"
28 if { "$tcl_platform(os)" == "Darwin" } {
29 set SYS_LIB_SUFFIX "dylib"
31 set SYS_LIB_SUFFIX "so"
35 } elseif { "$tcl_platform(platform)" == "windows" } {
36 set SYS_PATH_SPLITTER ";"
38 set SYS_LIB_SUFFIX "lib"
39 set SYS_EXE_SUFFIX ".exe"
44 set SHORTCUT_HEADERS "ShortCut"
47 set CSF_OPT_INC [list]
48 set CSF_OPT_LIB32 [list]
49 set CSF_OPT_LIB64 [list]
50 set CSF_OPT_BIN32 [list]
51 set CSF_OPT_BIN64 [list]
53 if { "$tcl_platform(pointerSize)" == "4" } {
56 if { [info exists ::env(ARCH)] } {
57 set ARCH "$::env(ARCH)"
60 if { [info exists ::env(SHORTCUT_HEADERS)] } {
61 set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
62 if { $SHORTCUT_HEADERS == "true" } {
63 set SHORTCUT_HEADERS "ShortCut"
67 # fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
68 set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_GL2PS HAVE_ZLIB HAVE_LIBLZMA HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
69 foreach anEnvIter $THE_ENV_VARIABLES {
70 set ${anEnvIter} "false"
71 if { [info exists ::env(${anEnvIter})] } {
72 set ${anEnvIter} "$::env(${anEnvIter})"
75 # do not export platform-specific variables
76 if { "$::tcl_platform(os)" == "Darwin" } {
81 if { "$tcl_platform(platform)" != "windows" } {
83 set HAVE_RelWithDebInfo ""
85 foreach anEnvIter {ARCH VCVER VCVARS PRODUCTS_PATH} {
86 if { [info exists ::env(${anEnvIter})] } {
87 set ${anEnvIter} "$::env(${anEnvIter})"
91 if { [info exists ::env(CSF_OPT_INC)] } {
92 set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER]
94 if { [info exists ::env(CSF_OPT_LIB32)] } {
95 set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER]
97 if { [info exists ::env(CSF_OPT_LIB64)] } {
98 set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER]
100 if { [info exists ::env(CSF_OPT_BIN32)] } {
101 set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER]
103 if { [info exists ::env(CSF_OPT_BIN64)] } {
104 set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER]
107 # Search header file in $::CSF_OPT_INC and standard paths
108 proc wokdep:SearchHeader {theHeader} {
109 # search in custom paths
110 foreach anIncPath $::CSF_OPT_INC {
111 set aPath "${anIncPath}/${theHeader}"
112 if { [file exists "$aPath"] } {
118 set aPath "/usr/include/${theHeader}"
119 if { [file exists "$aPath"] } {
125 # Search library file in $::CSF_OPT_LIB* and standard paths
126 proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} {
127 if { "$theSearchPath" != "" } {
128 set aPath "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
129 if { [file exists "$aPath"] } {
136 # search in custom paths
137 foreach aLibPath [set ::CSF_OPT_LIB$theBitness] {
138 set aPath "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
139 if { [file exists "$aPath"] } {
145 if { "$::ARCH" == "$theBitness"} {
146 set aPath "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
147 if { [file exists "$aPath"] } {
153 if { "$::tcl_platform(os)" == "Linux" } {
154 if { "$theBitness" == "64" } {
155 set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so"
156 if { [file exists "$aPath"] } {
160 set aPath "/usr/lib/i386-linux-gnu/lib${theLib}.so"
161 if { [file exists "$aPath"] } {
170 # Search file in $::CSF_OPT_BIN* and standard paths
171 proc wokdep:SearchBin {theBin theBitness {theSearchPath ""}} {
172 if { "$theSearchPath" != "" } {
173 set aPath "${theSearchPath}/${theBin}"
174 if { [file exists "$aPath"] } {
181 # search in custom paths
182 foreach aBinPath [set ::CSF_OPT_BIN$theBitness] {
183 set aPath "${aBinPath}/${theBin}"
184 if { [file exists "$aPath"] } {
190 if { "$::ARCH" == "$theBitness"} {
191 set aPath "/usr/bin/${theBin}"
192 if { [file exists "$aPath"] } {
200 # Detect compiler C-runtime version 'vc*' and architecture '32'/'64'
201 # to determine preferred path.
202 proc wokdep:Preferred {theList theCmpl theArch} {
203 if { [llength $theList] == 0 } {
208 foreach aPath $theList {
209 if { [string first "$theCmpl" "$aPath"] != "-1" } {
210 lappend aShortList "$aPath"
214 if { [llength $aShortList] == 0 } {
215 #return [lindex $theList 0]
216 set aShortList $theList
219 set aVeryShortList {}
220 foreach aPath $aShortList {
221 if { [string first "$theArch" "$aPath"] != "-1" } {
222 lappend aVeryShortList "$aPath"
225 if { [llength $aVeryShortList] == 0 } {
226 return [lindex [lsort -decreasing $aShortList] 0]
229 return [lindex [lsort -decreasing $aVeryShortList] 0]
232 # Search library placement
233 proc wokdep:SearchStandardLibrary {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64 theName theCheckHeader theCheckLib theCheckFolders} {
234 upvar $theErrInc anErrInc
235 upvar $theErrLib32 anErrLib32
236 upvar $theErrLib64 anErrLib64
237 upvar $theErrBin32 anErrBin32
238 upvar $theErrBin64 anErrBin64
241 set aHeaderPath [wokdep:SearchHeader "$theCheckHeader"]
242 if { "$aHeaderPath" == "" } {
244 foreach aFolderIter $theCheckFolders {
245 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$::ARCH" ]
246 if { "$aPath" != "" && [file exists "$aPath/include/$theCheckHeader"] } {
247 lappend ::CSF_OPT_INC "$aPath/include"
253 lappend anErrInc "Error: '$theCheckHeader' not found ($theName)"
258 foreach anArchIter {64 32} {
259 set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter"]
260 if { "$aLibPath" == "" } {
262 foreach aFolderIter $theCheckFolders {
263 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ]
264 set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter" "$aPath/lib"]
265 if { "$aLibPath" != "" } {
266 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
267 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
273 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}$theCheckLib.${::SYS_LIB_SUFFIX}' not found ($theName)"
274 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
278 if { "$::tcl_platform(platform)" == "windows" } {
279 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter"]
280 if { "$aDllPath" == "" } {
282 foreach aFolderIter $theCheckFolders {
283 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ]
284 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/bin"]
285 if { "$aDllPath" != "" } {
286 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
290 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/lib"]
291 if { "$aDllPath" != "" } {
292 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
299 lappend anErrBin$anArchIter "Error: '$theCheckLib.dll' not found ($theName)"
300 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
309 # Search Tcl/Tk libraries placement
310 proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
311 upvar $theErrInc anErrInc
312 upvar $theErrLib32 anErrLib32
313 upvar $theErrLib64 anErrLib64
314 upvar $theErrBin32 anErrBin32
315 upvar $theErrBin64 anErrBin64
321 set aTclHPath [wokdep:SearchHeader "tcl.h"]
322 set aTkHPath [wokdep:SearchHeader "tk.h"]
323 if { "$aTclHPath" == "" || "$aTkHPath" == "" } {
324 if { [file exists "/usr/include/tcl8.6/tcl.h"]
325 && [file exists "/usr/include/tcl8.6/tk.h" ] } {
326 lappend ::CSF_OPT_INC "/usr/include/tcl8.6"
327 set aTclHPath "/usr/include/tcl8.6/tcl.h"
329 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ]
330 if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } {
331 lappend ::CSF_OPT_INC "$aPath/include"
332 set aTclHPath "$aPath/include/tcl.h"
334 lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)"
340 # detect tcl version by parsing header file
342 set fh [open $aTclHPath]
345 regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj
346 regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min
349 if { "$::tcl_platform(platform)" == "windows" } {
350 set aTclLibName "tcl${tclver_maj}${tclver_min}"
351 set aTkLibName "tk${tclver_maj}${tclver_min}"
353 set aTclLibName "tcl${tclver_maj}.${tclver_min}"
354 set aTkLibName "tk${tclver_maj}.${tclver_min}"
357 foreach anArchIter {64 32} {
358 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter"]
359 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter"]
360 if { "$aTclLibPath" == "" || "$aTkLibPath" == "" } {
361 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
362 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter" "$aPath/lib"]
363 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter" "$aPath/lib"]
364 if { "$aTclLibPath" != "" && "$aTkLibPath" != "" } {
365 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
367 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aTclLibName}.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}${aTkLibName}.${::SYS_LIB_SUFFIX}' not found (Tcl/Tk)"
368 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
372 if { "$::tcl_platform(platform)" == "windows" } {
373 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter"]
374 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter"]
375 if { "$aTclDllPath" == "" || "$aTkDllPath" == "" } {
376 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
377 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter" "$aPath/bin"]
378 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter" "$aPath/bin"]
379 if { "$aTclDllPath" != "" && "$aTkDllPath" != "" } {
380 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
382 lappend anErrBin$anArchIter "Error: '${aTclLibName}.dll' or '${aTkLibName}.dll' not found (Tcl/Tk)"
383 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
392 # Search FreeType library placement
393 proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
394 upvar $theErrInc anErrInc
395 upvar $theErrLib32 anErrLib32
396 upvar $theErrLib64 anErrLib64
397 upvar $theErrBin32 anErrBin32
398 upvar $theErrBin64 anErrBin64
401 set aFtBuildPath [wokdep:SearchHeader "ft2build.h"]
403 if { "$aFtBuildPath" == "" } {
404 # TODO - use `freetype-config --cflags` instead
405 set aSysFreeType "/usr/include/freetype2"
406 if { [file exists "$aSysFreeType/ft2build.h"] } {
407 lappend ::CSF_OPT_INC "$aSysFreeType"
408 } elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } {
409 lappend ::CSF_OPT_INC "$aSysFreeType/freetype2"
411 set aSysFreeType "/usr/X11/include/freetype2"
412 if { [file exists "$aSysFreeType/ft2build.h"] } {
413 lappend ::CSF_OPT_INC "/usr/X11/include"
414 lappend ::CSF_OPT_INC "$aSysFreeType"
416 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$::ARCH" ]
417 if {"$aPath" != ""} {
418 if {[file exists "$aPath/include/ft2build.h"]} {
419 lappend ::CSF_OPT_INC "$aPath/include"
420 } elseif {[file exists "$aPath/include/freetype2/ft2build.h"]} {
421 lappend ::CSF_OPT_INC "$aPath/include/freetype2"
424 lappend anErrInc "Error: 'freetype.h' not found (FreeType2)"
431 # parse 'freetype-config --libs'
433 if { [catch { set aConfLibs [exec freetype-config --libs] } ] == 0 } {
434 foreach aPath [split $aConfLibs " "] {
435 if { [string first "-L" "$aPath"] == 0 } {
436 set aConfLibPath [string range "$aPath" 2 [string length "$aPath"]]
441 foreach anArchIter {64 32} {
442 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter"]
443 if { "$aFtLibPath" == "" } {
444 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
445 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aPath/lib"]
446 if { "$aFtLibPath" != "" } {
447 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
449 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aConfLibPath"]
450 if { "$aFtLibPath" != "" } {
451 lappend ::CSF_OPT_LIB$anArchIter "$aConfLibPath"
453 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freetype.${::SYS_LIB_SUFFIX}' not found (FreeType2)"
454 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
458 if { "$::tcl_platform(platform)" == "windows" } {
459 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter"]
460 if { "$aFtDllPath" == "" } {
461 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
462 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/bin"]
463 if { "$aFtDllPath" != "" } {
464 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
466 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/lib"]
467 if { "$aFtDllPath" != "" } {
468 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
470 lappend anErrBin$anArchIter "Error: 'freetype.dll' not found (FreeType2)"
471 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
481 # Search FreeImage library placement
482 proc wokdep:SearchFreeImage {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
489 # binary distribution has another layout
490 set aFImageDist "Dist"
493 set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
494 if { "$aFImageHPath" == "" } {
495 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ]
496 if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] } {
497 lappend ::CSF_OPT_INC "$aPath/include"
498 } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] } {
499 lappend ::CSF_OPT_INC "$aPath/$aFImageDist"
501 lappend anErrInc "Error: 'FreeImage.h' not found (FreeImage)"
506 foreach anArchIter {64 32} {
507 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
508 if { "$aFImageLibPath" == "" } {
509 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
510 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
511 if { "$aFImageLibPath" != "" } {
512 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
514 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
515 if { "$aFImageLibPath" != "" } {
516 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist"
518 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
519 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
523 if { "$::tcl_platform(platform)" == "windows" } {
524 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"]
525 if { "$aFImageDllPath" == "" } {
526 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
527 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"]
528 if { "$aFImageDllPath" != "" } {
529 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
531 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"]
532 if { "$aFImageDllPath" != "" } {
533 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist"
535 lappend anErrBin$anArchIter "Error: 'freeimage.dll' is not found (FreeImage)"
536 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
546 # Search FFmpeg framework placement
547 proc wokdep:SearchFFmpeg {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
548 upvar $theErrInc anErrInc
549 upvar $theErrLib32 anErrLib32
550 upvar $theErrLib64 anErrLib64
551 upvar $theErrBin32 anErrBin32
552 upvar $theErrBin64 anErrBin64
555 set aFFmpegHPath [wokdep:SearchHeader "libavutil/avutil.h"]
556 if { "$aFFmpegHPath" == "" } {
557 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$::ARCH" ]
558 if { "$aPath" != "" && [file exists "$aPath/include/libavutil/avutil.h"] } {
559 lappend ::CSF_OPT_INC "$aPath/include"
561 lappend anErrInc "Error: 'libavutil/avutil.h' not found (FFmpeg)"
566 foreach anArchIter {64 32} {
567 set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter"]
568 if { "$aFFmpegLibPath" == "" } {
569 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$anArchIter" ]
570 set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter" "$aPath/lib"]
571 if { "$aFFmpegLibPath" != "" } {
572 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
573 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
575 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}avutil.${::SYS_LIB_SUFFIX}' not found (FFmpeg)"
576 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
584 # Search TBB library placement
585 proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
586 upvar $theErrInc anErrInc
587 upvar $theErrLib32 anErrLib32
588 upvar $theErrLib64 anErrLib64
589 upvar $theErrBin32 anErrBin32
590 upvar $theErrBin64 anErrBin64
593 set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"]
594 if { "$aTbbHPath" == "" } {
595 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ]
596 if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } {
597 lappend ::CSF_OPT_INC "$aPath/include"
599 lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)"
604 foreach anArchIter {64 32} {
606 if { "$anArchIter" == "64"} {
607 set aSubDir "intel64"
610 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"]
611 if { "$aTbbLibPath" == "" } {
612 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
613 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/${::VCVER}"]
614 if { "$aTbbLibPath" == "" } {
615 # Set the path to the TBB library for Linux
616 if { "$::tcl_platform(platform)" != "windows" } {
617 set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21"
619 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"]
620 if { "$aTbbLibPath" != "" } {
621 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir"
624 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/${::VCVER}"
626 if { "$aTbbLibPath" == "" } {
627 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
628 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
631 if { "$::tcl_platform(platform)" == "windows" } {
632 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
633 if { "$aTbbDllPath" == "" } {
634 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
635 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/${::VCVER}"]
636 if { "$aTbbDllPath" != "" } {
637 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/${::VCVER}"
639 lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
640 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
649 # Search OpenCL library placement
650 proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
651 upvar $theErrInc anErrInc
652 upvar $theErrLib32 anErrLib32
653 upvar $theErrLib64 anErrLib64
654 upvar $theErrBin32 anErrBin32
655 upvar $theErrBin64 anErrBin64
658 if { "$::tcl_platform(os)" == "Darwin" } {
659 # OpenCL framework available since Mac OS X 16
663 set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"]
664 if { "$aCLHPath" == "" } {
665 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ]
666 if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } {
667 lappend ::CSF_OPT_INC "$aPath/include"
669 lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)"
674 foreach anArchIter {64 32} {
675 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"]
676 if { "$aCLLibPath" == "" } {
677 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ]
678 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"]
679 if { "$aCLLibPath" != "" } {
680 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
682 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)"
683 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
691 # Search EGL library placement
692 proc wokdep:SearchEGL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
693 upvar $theErrInc anErrInc
694 upvar $theErrLib32 anErrLib32
695 upvar $theErrLib64 anErrLib64
696 upvar $theErrBin32 anErrBin32
697 upvar $theErrBin64 anErrBin64
700 set aHeaderPath [wokdep:SearchHeader "EGL/egl.h"]
701 if { "$aHeaderPath" == "" } {
702 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$::ARCH" ]
703 if { "$aPath" == "" || ![file exists "$aPath/include/EGL/egl.h"] } {
704 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
707 if { "$aPath" != "" && [file exists "$aPath/include/EGL/egl.h"] } {
708 lappend ::CSF_OPT_INC "$aPath/include"
710 lappend anErrInc "Error: 'EGL/egl.h' not found (EGL)"
716 if { "$::tcl_platform(platform)" == "windows" } {
718 set aLibName "libEGL"
721 foreach anArchIter {64 32} {
722 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
723 if { "$aLibPath" == "" } {
724 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
725 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
726 if { "$aLibPath" == "" } {
727 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
728 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
731 if { "$aLibPath" != "" } {
732 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
734 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (EGL)"
735 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
739 if { "$::tcl_platform(platform)" == "windows" } {
740 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter"]
741 if { "$aDllPath" == "" } {
742 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
743 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
744 if { "$aDllPath" == "" } {
745 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
746 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
749 if { "$aDllPath" != "" } {
750 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
752 lappend anErrBin$anArchIter "Error: 'libEGL.dll' not found (EGL)"
753 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
762 # Search OpenGL ES 2.0 library placement
763 proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
764 upvar $theErrInc anErrInc
765 upvar $theErrLib32 anErrLib32
766 upvar $theErrLib64 anErrLib64
767 upvar $theErrBin32 anErrBin32
768 upvar $theErrBin64 anErrBin64
771 set aHeaderPath [wokdep:SearchHeader "GLES2/gl2.h"]
772 if { "$aHeaderPath" == "" } {
773 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$::ARCH" ]
774 if { "$aPath" == "" || ![file exists "$aPath/include/GLES2/gl2.h"] } {
775 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
778 if { "$aPath" != "" && [file exists "$aPath/include/GLES2/gl2.h"] } {
779 lappend ::CSF_OPT_INC "$aPath/include"
781 lappend anErrInc "Error: 'GLES2/gl2.h' not found (OpenGL ES 2.0)"
786 set aLibName "GLESv2"
787 if { "$::tcl_platform(platform)" == "windows" } {
789 set aLibName "libGLESv2"
792 foreach anArchIter {64 32} {
793 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
794 if { "$aLibPath" == "" } {
795 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$anArchIter" ]
796 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
797 if { "$aLibPath" == "" } {
798 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
799 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
802 if { "$aLibPath" != "" } {
803 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
805 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (OpenGL ES 2.0)"
806 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
810 if { "$::tcl_platform(platform)" == "windows" } {
811 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter"]
812 if { "$aDllPath" == "" } {
813 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
814 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
815 if { "$aDllPath" == "" } {
816 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
817 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
820 if { "$aDllPath" != "" } {
821 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
823 lappend anErrBin$anArchIter "Error: 'libGLESv2.dll' not found (OpenGL ES 2.0)"
824 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
833 # Auxiliary function, gets VTK version to set default search directory
834 proc wokdep:VtkVersion { thePath } {
837 set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0]
838 if { "$aVtkRoot" != "" } {
839 set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot]
840 if { "$aVtkRoot" != "" } {
841 set aResult $aVtkRoot
848 # Search VTK library placement
849 proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
850 upvar $theErrInc anErrInc
851 upvar $theErrLib32 anErrLib32
852 upvar $theErrLib64 anErrLib64
853 upvar $theErrBin32 anErrBin32
854 upvar $theErrBin64 anErrBin64
859 set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"]
860 set aVtkVer [wokdep:VtkVersion $aVtkIncPath]
861 if { "$aVtkIncPath" == ""} {
862 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
863 set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ]
864 if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} {
865 set aVtkVer [wokdep:VtkVersion $aVtkPath]
866 lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]"
867 } else { # try to search in all found paths
869 foreach anIt $aPathList {
870 if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } {
872 set aVtkVer [wokdep:VtkVersion $aVtkPath]
873 lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]"
879 # Bad case: we do not found vtkConfigure.h in all paths.
880 if { "$isFound" == "false"} {
881 lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)"
888 foreach anArchIter {64 32} {
889 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"]
890 if { "$aVtkLibPath" == "" } {
891 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
892 set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ]
893 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"]
894 if { "$aVtkLibPath" != "" } {
895 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
897 set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"]
898 if { "$aPath" != "" } {
899 set aLibPath $aVtkIncPath
900 lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib"
902 # The last chance: search /lib directory in all found paths
903 foreach anIt $aPathList {
904 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"]
905 if { "$aVtkLibPath" != ""} {
906 lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib"
910 if { "$aVtkLibPath" == "" } {
911 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)"
912 if { "$::ARCH" == "$anArchIter" } {
922 if { "$::tcl_platform(platform)" == "windows" } {
923 foreach anArchIter {64 32} {
924 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
925 if { "$aVtkBinPath" == "" } {
926 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
927 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
928 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
930 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
931 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
936 # We didn't find preferred binary path => search through inc path or among all available VTK directories
937 if { "$aVtkBinPath" == "" } {
938 # Try to find in lib path
939 set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/bin"]
940 if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/bin"
941 } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/lib"] != "" } {
942 lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/lib"
944 lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
953 # Search Qt4 libraries placement
954 proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
955 upvar $theErrInc anErrInc
956 upvar $theErrLib32 anErrLib32
957 upvar $theErrLib64 anErrLib64
958 upvar $theErrBin32 anErrBin32
959 upvar $theErrBin64 anErrBin64
962 set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
963 if { "$aQMsgBoxHPath" == "" } {
964 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
965 if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
966 lappend ::CSF_OPT_INC "$aPath/include"
967 lappend ::CSF_OPT_INC "$aPath/include/Qt"
968 lappend ::CSF_OPT_INC "$aPath/include/QtGui"
969 lappend ::CSF_OPT_INC "$aPath/include/QtCore"
971 if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
972 lappend ::CSF_OPT_INC "/usr/include/qt4"
973 lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
974 lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
975 lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
977 lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
983 set aQtGuiLibName "QtGui"
984 if { "$::tcl_platform(platform)" == "windows" } {
985 set aQtGuiLibName "QtGui4"
988 foreach anArchIter {64 32} {
989 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
990 if { "$aQMsgBoxLibPath" == "" } {
991 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
992 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
993 if { "$aQMsgBoxLibPath" != "" } {
994 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
996 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
997 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1000 if { "$::tcl_platform(platform)" == "windows" } {
1001 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
1002 if { "$aQMsgBoxDllPath" == "" } {
1003 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
1004 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
1005 if { "$aQMsgBoxDllPath" != "" } {
1006 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1008 lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
1009 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1018 # Search JDK placement
1019 proc wokdep:SearchJDK {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
1027 set aJniHPath [wokdep:SearchHeader "jni.h"]
1028 set aJniMdHPath [wokdep:SearchHeader "jni_md.h"]
1029 if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } {
1030 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ]
1031 if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } {
1032 lappend ::CSF_OPT_INC "$aPath/include"
1033 if { "$::tcl_platform(platform)" == "windows" } {
1034 lappend ::CSF_OPT_INC "$aPath/include/win32"
1035 } elseif { [file exists "$aPath/include/linux"] } {
1036 lappend ::CSF_OPT_INC "$aPath/include/linux"
1039 if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } {
1040 lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include"
1042 lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)"
1048 foreach anArchIter {64 32} {
1049 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"]
1050 if { "$aJavacPath" == "" } {
1051 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ]
1052 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"]
1053 if { "$aJavacPath" != "" } {
1054 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1056 if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } {
1057 lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin"
1059 lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)"
1060 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1069 # Search X11 libraries placement
1070 proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1071 upvar $theErrInc anErrInc
1072 upvar $theErrLib32 anErrLib32
1073 upvar $theErrLib64 anErrLib64
1074 upvar $theErrBin32 anErrBin32
1075 upvar $theErrBin64 anErrBin64
1078 if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
1082 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
1083 if { "$aXmuLibPath" == "" } {
1084 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
1085 if { "$aXmuLibPath" != "" } {
1086 #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
1088 lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
1096 # Generate (override) custom environment file
1097 proc wokdep:SaveCustom {} {
1098 if { "$::tcl_platform(platform)" == "windows" } {
1099 set aCustomFilePath "./custom.bat"
1100 set aFile [open $aCustomFilePath "w"]
1101 puts $aFile "@echo off"
1102 puts $aFile "rem This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1105 puts $aFile "set VCVER=$::VCVER"
1106 puts $aFile "set ARCH=$::ARCH"
1107 puts $aFile "set VCVARS=$::VCVARS"
1108 puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1111 puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\""
1114 puts $aFile "rem Optional 3rd-parties switches"
1115 foreach anEnvIter $::THE_ENV_VARIABLES {
1116 set aName ${anEnvIter}
1117 set aValue [set ::${anEnvIter}]
1118 if { "$aValue" != "" } {
1119 puts $aFile "set ${aName}=$aValue"
1123 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1125 puts $aFile "rem Additional headers search paths"
1126 puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
1128 set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
1130 puts $aFile "rem Additional libraries (32-bit) search paths"
1131 puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
1133 set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
1135 puts $aFile "rem Additional libraries (64-bit) search paths"
1136 puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
1138 set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
1140 puts $aFile "rem Additional (32-bit) search paths"
1141 puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
1143 set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
1145 puts $aFile "rem Additional (64-bit) search paths"
1146 puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
1150 set aCustomFilePath "./custom.sh"
1151 set aFile [open $aCustomFilePath "w"]
1152 puts $aFile "#!/bin/bash"
1153 puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1156 puts $aFile "export ARCH=$::ARCH"
1157 puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1160 puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1163 puts $aFile "# Optional 3rd-parties switches"
1164 foreach anEnvIter $::THE_ENV_VARIABLES {
1165 set aName ${anEnvIter}
1166 set aValue [set ::${anEnvIter}]
1167 if { "$aValue" != "" } {
1168 puts $aFile "export ${aName}=${aValue}"
1172 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1174 puts $aFile "# Additional headers search paths"
1175 puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
1177 set aStringLib$::ARCH [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
1179 puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
1180 puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib$::ARCH]\""
1182 set aStringBin$::ARCH [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
1184 puts $aFile "# Additional ($::ARCH-bit) search paths"
1185 puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin$::ARCH]\""
1190 puts "Configuration saved to file '$aCustomFilePath'"