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}
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" } {
80 if { "$tcl_platform(platform)" != "windows" } {
84 foreach anEnvIter {ARCH VCVER VCVARS PRODUCTS_PATH} {
85 if { [info exists ::env(${anEnvIter})] } {
86 set ${anEnvIter} "$::env(${anEnvIter})"
90 if { [info exists ::env(CSF_OPT_INC)] } {
91 set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER]
93 if { [info exists ::env(CSF_OPT_LIB32)] } {
94 set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER]
96 if { [info exists ::env(CSF_OPT_LIB64)] } {
97 set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER]
99 if { [info exists ::env(CSF_OPT_BIN32)] } {
100 set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER]
102 if { [info exists ::env(CSF_OPT_BIN64)] } {
103 set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER]
106 # Search header file in $::CSF_OPT_INC and standard paths
107 proc wokdep:SearchHeader {theHeader} {
108 # search in custom paths
109 foreach anIncPath $::CSF_OPT_INC {
110 set aPath "${anIncPath}/${theHeader}"
111 if { [file exists "$aPath"] } {
117 set aPath "/usr/include/${theHeader}"
118 if { [file exists "$aPath"] } {
124 # Search library file in $::CSF_OPT_LIB* and standard paths
125 proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} {
126 if { "$theSearchPath" != "" } {
127 set aPath "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
128 if { [file exists "$aPath"] } {
135 # search in custom paths
136 foreach aLibPath [set ::CSF_OPT_LIB$theBitness] {
137 set aPath "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
138 if { [file exists "$aPath"] } {
144 if { "$::ARCH" == "$theBitness"} {
145 set aPath "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
146 if { [file exists "$aPath"] } {
152 if { "$::tcl_platform(os)" == "Linux" } {
153 if { "$theBitness" == "64" } {
154 set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so"
155 if { [file exists "$aPath"] } {
159 set aPath "/usr/lib/i386-linux-gnu/lib${theLib}.so"
160 if { [file exists "$aPath"] } {
169 # Search file in $::CSF_OPT_BIN* and standard paths
170 proc wokdep:SearchBin {theBin theBitness {theSearchPath ""}} {
171 if { "$theSearchPath" != "" } {
172 set aPath "${theSearchPath}/${theBin}"
173 if { [file exists "$aPath"] } {
180 # search in custom paths
181 foreach aBinPath [set ::CSF_OPT_BIN$theBitness] {
182 set aPath "${aBinPath}/${theBin}"
183 if { [file exists "$aPath"] } {
189 if { "$::ARCH" == "$theBitness"} {
190 set aPath "/usr/bin/${theBin}"
191 if { [file exists "$aPath"] } {
199 # Detect compiler C-runtime version 'vc*' and architecture '32'/'64'
200 # to determine preferred path.
201 proc wokdep:Preferred {theList theCmpl theArch} {
202 if { [llength $theList] == 0 } {
207 foreach aPath $theList {
208 if { [string first "$theCmpl" "$aPath"] != "-1" } {
209 lappend aShortList "$aPath"
213 if { [llength $aShortList] == 0 } {
214 #return [lindex $theList 0]
215 set aShortList $theList
218 set aVeryShortList {}
219 foreach aPath $aShortList {
220 if { [string first "$theArch" "$aPath"] != "-1" } {
221 lappend aVeryShortList "$aPath"
224 if { [llength $aVeryShortList] == 0 } {
225 return [lindex [lsort -decreasing $aShortList] 0]
228 return [lindex [lsort -decreasing $aVeryShortList] 0]
231 # Search library placement
232 proc wokdep:SearchStandardLibrary {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64 theName theCheckHeader theCheckLib theCheckFolders} {
233 upvar $theErrInc anErrInc
234 upvar $theErrLib32 anErrLib32
235 upvar $theErrLib64 anErrLib64
236 upvar $theErrBin32 anErrBin32
237 upvar $theErrBin64 anErrBin64
240 set aHeaderPath [wokdep:SearchHeader "$theCheckHeader"]
241 if { "$aHeaderPath" == "" } {
243 foreach aFolderIter $theCheckFolders {
244 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$::ARCH" ]
245 if { "$aPath" != "" && [file exists "$aPath/include/$theCheckHeader"] } {
246 lappend ::CSF_OPT_INC "$aPath/include"
252 lappend anErrInc "Error: '$theCheckHeader' not found ($theName)"
257 foreach anArchIter {64 32} {
258 set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter"]
259 if { "$aLibPath" == "" } {
261 foreach aFolderIter $theCheckFolders {
262 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ]
263 set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter" "$aPath/lib"]
264 if { "$aLibPath" != "" } {
265 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
266 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
272 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}$theCheckLib.${::SYS_LIB_SUFFIX}' not found ($theName)"
273 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
277 if { "$::tcl_platform(platform)" == "windows" } {
278 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter"]
279 if { "$aDllPath" == "" } {
281 foreach aFolderIter $theCheckFolders {
282 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ]
283 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/bin"]
284 if { "$aDllPath" != "" } {
285 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
289 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/lib"]
290 if { "$aDllPath" != "" } {
291 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
298 lappend anErrBin$anArchIter "Error: '$theCheckLib.dll' not found ($theName)"
299 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
308 # Search Tcl/Tk libraries placement
309 proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
310 upvar $theErrInc anErrInc
311 upvar $theErrLib32 anErrLib32
312 upvar $theErrLib64 anErrLib64
313 upvar $theErrBin32 anErrBin32
314 upvar $theErrBin64 anErrBin64
320 set aTclHPath [wokdep:SearchHeader "tcl.h"]
321 set aTkHPath [wokdep:SearchHeader "tk.h"]
322 if { "$aTclHPath" == "" || "$aTkHPath" == "" } {
323 if { [file exists "/usr/include/tcl8.6/tcl.h"]
324 && [file exists "/usr/include/tcl8.6/tk.h" ] } {
325 lappend ::CSF_OPT_INC "/usr/include/tcl8.6"
326 set aTclHPath "/usr/include/tcl8.6/tcl.h"
328 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ]
329 if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } {
330 lappend ::CSF_OPT_INC "$aPath/include"
331 set aTclHPath "$aPath/include/tcl.h"
333 lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)"
339 # detect tcl version by parsing header file
341 set fh [open $aTclHPath]
344 regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj
345 regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min
348 if { "$::tcl_platform(platform)" == "windows" } {
349 set aTclLibName "tcl${tclver_maj}${tclver_min}"
350 set aTkLibName "tk${tclver_maj}${tclver_min}"
352 set aTclLibName "tcl${tclver_maj}.${tclver_min}"
353 set aTkLibName "tk${tclver_maj}.${tclver_min}"
356 foreach anArchIter {64 32} {
357 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter"]
358 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter"]
359 if { "$aTclLibPath" == "" || "$aTkLibPath" == "" } {
360 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
361 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter" "$aPath/lib"]
362 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter" "$aPath/lib"]
363 if { "$aTclLibPath" != "" && "$aTkLibPath" != "" } {
364 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
366 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aTclLibName}.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}${aTkLibName}.${::SYS_LIB_SUFFIX}' not found (Tcl/Tk)"
367 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
371 if { "$::tcl_platform(platform)" == "windows" } {
372 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter"]
373 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter"]
374 if { "$aTclDllPath" == "" || "$aTkDllPath" == "" } {
375 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
376 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter" "$aPath/bin"]
377 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter" "$aPath/bin"]
378 if { "$aTclDllPath" != "" && "$aTkDllPath" != "" } {
379 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
381 lappend anErrBin$anArchIter "Error: '${aTclLibName}.dll' or '${aTkLibName}.dll' not found (Tcl/Tk)"
382 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
391 # Search FreeType library placement
392 proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
393 upvar $theErrInc anErrInc
394 upvar $theErrLib32 anErrLib32
395 upvar $theErrLib64 anErrLib64
396 upvar $theErrBin32 anErrBin32
397 upvar $theErrBin64 anErrBin64
400 set aFtBuildPath [wokdep:SearchHeader "ft2build.h"]
402 if { "$aFtBuildPath" == "" } {
403 # TODO - use `freetype-config --cflags` instead
404 set aSysFreeType "/usr/include/freetype2"
405 if { [file exists "$aSysFreeType/ft2build.h"] } {
406 lappend ::CSF_OPT_INC "$aSysFreeType"
407 } elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } {
408 lappend ::CSF_OPT_INC "$aSysFreeType/freetype2"
410 set aSysFreeType "/usr/X11/include/freetype2"
411 if { [file exists "$aSysFreeType/ft2build.h"] } {
412 lappend ::CSF_OPT_INC "/usr/X11/include"
413 lappend ::CSF_OPT_INC "$aSysFreeType"
415 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$::ARCH" ]
416 if {"$aPath" != ""} {
417 if {[file exists "$aPath/include/ft2build.h"]} {
418 lappend ::CSF_OPT_INC "$aPath/include"
419 } elseif {[file exists "$aPath/include/freetype2/ft2build.h"]} {
420 lappend ::CSF_OPT_INC "$aPath/include/freetype2"
423 lappend anErrInc "Error: 'freetype.h' not found (FreeType2)"
430 # parse 'freetype-config --libs'
432 if { [catch { set aConfLibs [exec freetype-config --libs] } ] == 0 } {
433 foreach aPath [split $aConfLibs " "] {
434 if { [string first "-L" "$aPath"] == 0 } {
435 set aConfLibPath [string range "$aPath" 2 [string length "$aPath"]]
440 foreach anArchIter {64 32} {
441 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter"]
442 if { "$aFtLibPath" == "" } {
443 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
444 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aPath/lib"]
445 if { "$aFtLibPath" != "" } {
446 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
448 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aConfLibPath"]
449 if { "$aFtLibPath" != "" } {
450 lappend ::CSF_OPT_LIB$anArchIter "$aConfLibPath"
452 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freetype.${::SYS_LIB_SUFFIX}' not found (FreeType2)"
453 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
457 if { "$::tcl_platform(platform)" == "windows" } {
458 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter"]
459 if { "$aFtDllPath" == "" } {
460 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
461 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/bin"]
462 if { "$aFtDllPath" != "" } {
463 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
465 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/lib"]
466 if { "$aFtDllPath" != "" } {
467 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
469 lappend anErrBin$anArchIter "Error: 'freetype.dll' not found (FreeType2)"
470 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
480 # Search FreeImage library placement
481 proc wokdep:SearchFreeImage {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
482 upvar $theErrInc anErrInc
483 upvar $theErrLib32 anErrLib32
484 upvar $theErrLib64 anErrLib64
485 upvar $theErrBin32 anErrBin32
486 upvar $theErrBin64 anErrBin64
488 # binary distribution has another layout
489 set aFImageDist "Dist"
492 set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
493 if { "$aFImageHPath" == "" } {
494 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ]
495 if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] } {
496 lappend ::CSF_OPT_INC "$aPath/include"
497 } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] } {
498 lappend ::CSF_OPT_INC "$aPath/$aFImageDist"
500 lappend anErrInc "Error: 'FreeImage.h' not found (FreeImage)"
505 foreach anArchIter {64 32} {
506 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
507 if { "$aFImageLibPath" == "" } {
508 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
509 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
510 if { "$aFImageLibPath" != "" } {
511 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
513 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
514 if { "$aFImageLibPath" != "" } {
515 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist"
517 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
518 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
522 if { "$::tcl_platform(platform)" == "windows" } {
523 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"]
524 if { "$aFImageDllPath" == "" } {
525 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
526 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"]
527 if { "$aFImageDllPath" != "" } {
528 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
530 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"]
531 if { "$aFImageDllPath" != "" } {
532 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist"
534 lappend anErrBin$anArchIter "Error: 'freeimage.dll' is not found (FreeImage)"
535 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
545 # Search FFmpeg framework placement
546 proc wokdep:SearchFFmpeg {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
547 upvar $theErrInc anErrInc
548 upvar $theErrLib32 anErrLib32
549 upvar $theErrLib64 anErrLib64
550 upvar $theErrBin32 anErrBin32
551 upvar $theErrBin64 anErrBin64
554 set aFFmpegHPath [wokdep:SearchHeader "libavutil/avutil.h"]
555 if { "$aFFmpegHPath" == "" } {
556 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$::ARCH" ]
557 if { "$aPath" != "" && [file exists "$aPath/include/libavutil/avutil.h"] } {
558 lappend ::CSF_OPT_INC "$aPath/include"
560 lappend anErrInc "Error: 'libavutil/avutil.h' not found (FFmpeg)"
565 foreach anArchIter {64 32} {
566 set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter"]
567 if { "$aFFmpegLibPath" == "" } {
568 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$anArchIter" ]
569 set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter" "$aPath/lib"]
570 if { "$aFFmpegLibPath" != "" } {
571 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
572 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
574 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}avutil.${::SYS_LIB_SUFFIX}' not found (FFmpeg)"
575 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
583 # Search TBB library placement
584 proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
585 upvar $theErrInc anErrInc
586 upvar $theErrLib32 anErrLib32
587 upvar $theErrLib64 anErrLib64
588 upvar $theErrBin32 anErrBin32
589 upvar $theErrBin64 anErrBin64
592 set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"]
593 if { "$aTbbHPath" == "" } {
594 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ]
595 if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } {
596 lappend ::CSF_OPT_INC "$aPath/include"
598 lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)"
603 foreach anArchIter {64 32} {
605 if { "$anArchIter" == "64"} {
606 set aSubDir "intel64"
609 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"]
610 if { "$aTbbLibPath" == "" } {
611 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
612 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/${::VCVER}"]
613 if { "$aTbbLibPath" == "" } {
614 # Set the path to the TBB library for Linux
615 if { "$::tcl_platform(platform)" != "windows" } {
616 set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21"
618 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"]
619 if { "$aTbbLibPath" != "" } {
620 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir"
623 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/${::VCVER}"
625 if { "$aTbbLibPath" == "" } {
626 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
627 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
630 if { "$::tcl_platform(platform)" == "windows" } {
631 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
632 if { "$aTbbDllPath" == "" } {
633 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
634 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/${::VCVER}"]
635 if { "$aTbbDllPath" != "" } {
636 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/${::VCVER}"
638 lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
639 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
648 # Search OpenCL library placement
649 proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
650 upvar $theErrInc anErrInc
651 upvar $theErrLib32 anErrLib32
652 upvar $theErrLib64 anErrLib64
653 upvar $theErrBin32 anErrBin32
654 upvar $theErrBin64 anErrBin64
657 if { "$::tcl_platform(os)" == "Darwin" } {
658 # OpenCL framework available since Mac OS X 16
662 set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"]
663 if { "$aCLHPath" == "" } {
664 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ]
665 if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } {
666 lappend ::CSF_OPT_INC "$aPath/include"
668 lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)"
673 foreach anArchIter {64 32} {
674 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"]
675 if { "$aCLLibPath" == "" } {
676 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ]
677 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"]
678 if { "$aCLLibPath" != "" } {
679 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
681 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)"
682 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
690 # Search EGL library placement
691 proc wokdep:SearchEGL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
692 upvar $theErrInc anErrInc
693 upvar $theErrLib32 anErrLib32
694 upvar $theErrLib64 anErrLib64
695 upvar $theErrBin32 anErrBin32
696 upvar $theErrBin64 anErrBin64
699 set aHeaderPath [wokdep:SearchHeader "EGL/egl.h"]
700 if { "$aHeaderPath" == "" } {
701 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$::ARCH" ]
702 if { "$aPath" == "" || ![file exists "$aPath/include/EGL/egl.h"] } {
703 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
706 if { "$aPath" != "" && [file exists "$aPath/include/EGL/egl.h"] } {
707 lappend ::CSF_OPT_INC "$aPath/include"
709 lappend anErrInc "Error: 'EGL/egl.h' not found (EGL)"
715 if { "$::tcl_platform(platform)" == "windows" } {
717 set aLibName "libEGL"
720 foreach anArchIter {64 32} {
721 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
722 if { "$aLibPath" == "" } {
723 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
724 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
725 if { "$aLibPath" == "" } {
726 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
727 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
730 if { "$aLibPath" != "" } {
731 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
733 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (EGL)"
734 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
738 if { "$::tcl_platform(platform)" == "windows" } {
739 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter"]
740 if { "$aDllPath" == "" } {
741 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
742 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
743 if { "$aDllPath" == "" } {
744 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
745 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
748 if { "$aDllPath" != "" } {
749 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
751 lappend anErrBin$anArchIter "Error: 'libEGL.dll' not found (EGL)"
752 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
761 # Search OpenGL ES 2.0 library placement
762 proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
763 upvar $theErrInc anErrInc
764 upvar $theErrLib32 anErrLib32
765 upvar $theErrLib64 anErrLib64
766 upvar $theErrBin32 anErrBin32
767 upvar $theErrBin64 anErrBin64
770 set aHeaderPath [wokdep:SearchHeader "GLES2/gl2.h"]
771 if { "$aHeaderPath" == "" } {
772 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$::ARCH" ]
773 if { "$aPath" == "" || ![file exists "$aPath/include/GLES2/gl2.h"] } {
774 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
777 if { "$aPath" != "" && [file exists "$aPath/include/GLES2/gl2.h"] } {
778 lappend ::CSF_OPT_INC "$aPath/include"
780 lappend anErrInc "Error: 'GLES2/gl2.h' not found (OpenGL ES 2.0)"
785 set aLibName "GLESv2"
786 if { "$::tcl_platform(platform)" == "windows" } {
788 set aLibName "libGLESv2"
791 foreach anArchIter {64 32} {
792 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
793 if { "$aLibPath" == "" } {
794 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$anArchIter" ]
795 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
796 if { "$aLibPath" == "" } {
797 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
798 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
801 if { "$aLibPath" != "" } {
802 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
804 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (OpenGL ES 2.0)"
805 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
809 if { "$::tcl_platform(platform)" == "windows" } {
810 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter"]
811 if { "$aDllPath" == "" } {
812 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
813 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
814 if { "$aDllPath" == "" } {
815 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
816 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
819 if { "$aDllPath" != "" } {
820 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
822 lappend anErrBin$anArchIter "Error: 'libGLESv2.dll' not found (OpenGL ES 2.0)"
823 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
832 # Auxiliary function, gets VTK version to set default search directory
833 proc wokdep:VtkVersion { thePath } {
836 set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0]
837 if { "$aVtkRoot" != "" } {
838 set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot]
839 if { "$aVtkRoot" != "" } {
840 set aResult $aVtkRoot
847 # Search VTK library placement
848 proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
849 upvar $theErrInc anErrInc
850 upvar $theErrLib32 anErrLib32
851 upvar $theErrLib64 anErrLib64
852 upvar $theErrBin32 anErrBin32
853 upvar $theErrBin64 anErrBin64
858 set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"]
859 set aVtkVer [wokdep:VtkVersion $aVtkIncPath]
860 if { "$aVtkIncPath" == ""} {
861 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
862 set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ]
863 if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} {
864 set aVtkVer [wokdep:VtkVersion $aVtkPath]
865 lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]"
866 } else { # try to search in all found paths
868 foreach anIt $aPathList {
869 if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } {
871 set aVtkVer [wokdep:VtkVersion $aVtkPath]
872 lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]"
878 # Bad case: we do not found vtkConfigure.h in all paths.
879 if { "$isFound" == "false"} {
880 lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)"
887 foreach anArchIter {64 32} {
888 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"]
889 if { "$aVtkLibPath" == "" } {
890 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
891 set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ]
892 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"]
893 if { "$aVtkLibPath" != "" } {
894 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
896 set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"]
897 if { "$aPath" != "" } {
898 set aLibPath $aVtkIncPath
899 lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib"
901 # The last chance: search /lib directory in all found paths
902 foreach anIt $aPathList {
903 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"]
904 if { "$aVtkLibPath" != ""} {
905 lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib"
909 if { "$aVtkLibPath" == "" } {
910 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)"
911 if { "$::ARCH" == "$anArchIter" } {
921 if { "$::tcl_platform(platform)" == "windows" } {
922 foreach anArchIter {64 32} {
923 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
924 if { "$aVtkBinPath" == "" } {
925 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
926 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
927 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
929 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
930 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
935 # We didn't find preferred binary path => search through inc path or among all available VTK directories
936 if { "$aVtkBinPath" == "" } {
937 # Try to find in lib path
938 set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/bin"]
939 if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/bin"
940 } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/lib"] != "" } {
941 lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/lib"
943 lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
952 # Search Qt4 libraries placement
953 proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
954 upvar $theErrInc anErrInc
955 upvar $theErrLib32 anErrLib32
956 upvar $theErrLib64 anErrLib64
957 upvar $theErrBin32 anErrBin32
958 upvar $theErrBin64 anErrBin64
961 set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
962 if { "$aQMsgBoxHPath" == "" } {
963 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
964 if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
965 lappend ::CSF_OPT_INC "$aPath/include"
966 lappend ::CSF_OPT_INC "$aPath/include/Qt"
967 lappend ::CSF_OPT_INC "$aPath/include/QtGui"
968 lappend ::CSF_OPT_INC "$aPath/include/QtCore"
970 if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
971 lappend ::CSF_OPT_INC "/usr/include/qt4"
972 lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
973 lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
974 lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
976 lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
982 set aQtGuiLibName "QtGui"
983 if { "$::tcl_platform(platform)" == "windows" } {
984 set aQtGuiLibName "QtGui4"
987 foreach anArchIter {64 32} {
988 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
989 if { "$aQMsgBoxLibPath" == "" } {
990 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
991 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
992 if { "$aQMsgBoxLibPath" != "" } {
993 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
995 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
996 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
999 if { "$::tcl_platform(platform)" == "windows" } {
1000 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
1001 if { "$aQMsgBoxDllPath" == "" } {
1002 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
1003 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
1004 if { "$aQMsgBoxDllPath" != "" } {
1005 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1007 lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
1008 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1017 # Search JDK placement
1018 proc wokdep:SearchJDK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1019 upvar $theErrInc anErrInc
1020 upvar $theErrLib32 anErrLib32
1021 upvar $theErrLib64 anErrLib64
1022 upvar $theErrBin32 anErrBin32
1023 upvar $theErrBin64 anErrBin64
1026 set aJniHPath [wokdep:SearchHeader "jni.h"]
1027 set aJniMdHPath [wokdep:SearchHeader "jni_md.h"]
1028 if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } {
1029 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ]
1030 if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } {
1031 lappend ::CSF_OPT_INC "$aPath/include"
1032 if { "$::tcl_platform(platform)" == "windows" } {
1033 lappend ::CSF_OPT_INC "$aPath/include/win32"
1034 } elseif { [file exists "$aPath/include/linux"] } {
1035 lappend ::CSF_OPT_INC "$aPath/include/linux"
1038 if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } {
1039 lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include"
1041 lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)"
1047 foreach anArchIter {64 32} {
1048 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"]
1049 if { "$aJavacPath" == "" } {
1050 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ]
1051 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"]
1052 if { "$aJavacPath" != "" } {
1053 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1055 if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } {
1056 lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin"
1058 lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)"
1059 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1068 # Search X11 libraries placement
1069 proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1070 upvar $theErrInc anErrInc
1071 upvar $theErrLib32 anErrLib32
1072 upvar $theErrLib64 anErrLib64
1073 upvar $theErrBin32 anErrBin32
1074 upvar $theErrBin64 anErrBin64
1077 if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
1081 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
1082 if { "$aXmuLibPath" == "" } {
1083 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
1084 if { "$aXmuLibPath" != "" } {
1085 #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
1087 lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
1095 # Generate (override) custom environment file
1096 proc wokdep:SaveCustom {} {
1097 if { "$::tcl_platform(platform)" == "windows" } {
1098 set aCustomFilePath "./custom.bat"
1099 set aFile [open $aCustomFilePath "w"]
1100 puts $aFile "@echo off"
1101 puts $aFile "rem This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1104 puts $aFile "set VCVER=$::VCVER"
1105 puts $aFile "set ARCH=$::ARCH"
1106 puts $aFile "set VCVARS=$::VCVARS"
1107 puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1110 puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\""
1113 puts $aFile "rem Optional 3rd-parties switches"
1114 foreach anEnvIter $::THE_ENV_VARIABLES {
1115 set aName ${anEnvIter}
1116 set aValue [set ::${anEnvIter}]
1117 if { "$aValue" != "" } {
1118 puts $aFile "set ${aName}=$aValue"
1122 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1124 puts $aFile "rem Additional headers search paths"
1125 puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
1127 set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
1129 puts $aFile "rem Additional libraries (32-bit) search paths"
1130 puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
1132 set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
1134 puts $aFile "rem Additional libraries (64-bit) search paths"
1135 puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
1137 set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
1139 puts $aFile "rem Additional (32-bit) search paths"
1140 puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
1142 set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
1144 puts $aFile "rem Additional (64-bit) search paths"
1145 puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
1149 set aCustomFilePath "./custom.sh"
1150 set aFile [open $aCustomFilePath "w"]
1151 puts $aFile "#!/bin/bash"
1152 puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1155 puts $aFile "export ARCH=$::ARCH"
1156 puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1159 puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1162 puts $aFile "# Optional 3rd-parties switches"
1163 foreach anEnvIter $::THE_ENV_VARIABLES {
1164 set aName ${anEnvIter}
1165 set aValue [set ::${anEnvIter}]
1166 if { "$aValue" != "" } {
1167 puts $aFile "export ${aName}=${aValue}"
1171 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1173 puts $aFile "# Additional headers search paths"
1174 puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
1176 set aStringLib$::ARCH [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
1178 puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
1179 puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib$::ARCH]\""
1181 set aStringBin$::ARCH [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
1183 puts $aFile "# Additional ($::ARCH-bit) search paths"
1184 puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin$::ARCH]\""
1189 puts "Configuration saved to file '$aCustomFilePath'"