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"
32 set SYS_LIB_SUFFIX "so"
37 } elseif { "$tcl_platform(platform)" == "windows" } {
38 set SYS_PATH_SPLITTER ";"
40 set SYS_LIB_SUFFIX "lib"
41 set SYS_EXE_SUFFIX ".exe"
47 set SHORTCUT_HEADERS "ShortCut"
50 set CSF_OPT_INC [list]
51 set CSF_OPT_LIB32 [list]
52 set CSF_OPT_LIB64 [list]
53 set CSF_OPT_BIN32 [list]
54 set CSF_OPT_BIN64 [list]
56 if { "$tcl_platform(pointerSize)" == "4" } {
59 if { [info exists ::env(ARCH)] } {
60 set ARCH "$::env(ARCH)"
63 if { [info exists ::env(SHORTCUT_HEADERS)] } {
64 set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
65 if { $SHORTCUT_HEADERS == "true" } {
66 set SHORTCUT_HEADERS "ShortCut"
70 # fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
71 set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
72 foreach anEnvIter $THE_ENV_VARIABLES {
73 set ${anEnvIter} "false"
74 if { [info exists ::env(${anEnvIter})] } {
75 set ${anEnvIter} "$::env(${anEnvIter})"
78 # do not export platform-specific variables
79 if { "$::tcl_platform(os)" == "Darwin" } {
84 if { "$tcl_platform(platform)" != "windows" } {
86 set HAVE_RelWithDebInfo ""
88 foreach anEnvIter {ARCH VCVER VCVARS PRJFMT PRODUCTS_PATH} {
89 if { [info exists ::env(${anEnvIter})] } {
90 set ${anEnvIter} "$::env(${anEnvIter})"
94 if { [info exists ::env(CSF_OPT_INC)] } {
95 set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER]
97 if { [info exists ::env(CSF_OPT_LIB32)] } {
98 set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER]
100 if { [info exists ::env(CSF_OPT_LIB64)] } {
101 set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER]
103 if { [info exists ::env(CSF_OPT_BIN32)] } {
104 set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER]
106 if { [info exists ::env(CSF_OPT_BIN64)] } {
107 set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER]
110 # Search header file in $::CSF_OPT_INC and standard paths
111 proc wokdep:SearchHeader {theHeader} {
112 # search in custom paths
113 foreach anIncPath $::CSF_OPT_INC {
114 set aPath "${anIncPath}/${theHeader}"
115 if { [file exists "$aPath"] } {
121 set aPath "/usr/include/${theHeader}"
122 if { [file exists "$aPath"] } {
126 if { "$::tcl_platform(os)" == "Linux" } {
127 if { "$::ARCH" == "64" } {
128 set aPath "/usr/include/x86_64-linux-gnu/${theHeader}"
129 if { [file exists "$aPath"] } {
133 set aPath "/usr/include/i386-linux-gnu/${theHeader}"
134 if { [file exists "$aPath"] } {
143 # Search library file in $::CSF_OPT_LIB* and standard paths
144 proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} {
145 if { "$theSearchPath" != "" } {
146 set aPath "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
147 if { [file exists "$aPath"] } {
154 # search in custom paths
155 foreach aLibPath [set ::CSF_OPT_LIB$theBitness] {
156 set aPath "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
157 if { [file exists "$aPath"] } {
163 if { "$::ARCH" == "$theBitness"} {
164 set aPath "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
165 if { [file exists "$aPath"] } {
171 if { "$::tcl_platform(os)" == "Linux" } {
172 if { "$theBitness" == "64" } {
173 set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so"
174 if { [file exists "$aPath"] } {
178 set aPath "/usr/lib/i386-linux-gnu/lib${theLib}.so"
179 if { [file exists "$aPath"] } {
188 # Search file in $::CSF_OPT_BIN* and standard paths
189 proc wokdep:SearchBin {theBin theBitness {theSearchPath ""}} {
190 if { "$theSearchPath" != "" } {
191 set aPath "${theSearchPath}/${theBin}"
192 if { [file exists "$aPath"] } {
199 # search in custom paths
200 foreach aBinPath [set ::CSF_OPT_BIN$theBitness] {
201 set aPath "${aBinPath}/${theBin}"
202 if { [file exists "$aPath"] } {
208 if { "$::ARCH" == "$theBitness"} {
209 set aPath "/usr/bin/${theBin}"
210 if { [file exists "$aPath"] } {
218 # Detect compiler C-runtime version 'vc*' and architecture '32'/'64'
219 # to determine preferred path.
220 proc wokdep:Preferred {theList theCmpl theArch} {
221 if { [llength $theList] == 0 } {
225 # keep only two first digits in "vc141"
226 if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } {
231 foreach aPath $theList {
232 if { [string first "$aCmpl" "$aPath"] != "-1" } {
233 lappend aShortList "$aPath"
237 if { [llength $aShortList] == 0 } {
238 #return [lindex $theList 0]
239 set aShortList $theList
242 set aVeryShortList {}
243 foreach aPath $aShortList {
244 if { [string first "$theArch" "$aPath"] != "-1" } {
245 lappend aVeryShortList "$aPath"
248 if { [llength $aVeryShortList] == 0 } {
249 return [lindex [lsort -decreasing $aShortList] 0]
252 return [lindex [lsort -decreasing $aVeryShortList] 0]
255 # Search library placement
256 proc wokdep:SearchStandardLibrary {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64 theName theCheckHeader theCheckLib theCheckFolders} {
257 upvar $theErrInc anErrInc
258 upvar $theErrLib32 anErrLib32
259 upvar $theErrLib64 anErrLib64
260 upvar $theErrBin32 anErrBin32
261 upvar $theErrBin64 anErrBin64
264 set aHeaderPath [wokdep:SearchHeader "$theCheckHeader"]
265 if { "$aHeaderPath" == "" } {
267 foreach aFolderIter $theCheckFolders {
268 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$::ARCH" ]
269 if { "$aPath" != "" && [file exists "$aPath/include/$theCheckHeader"] } {
270 lappend ::CSF_OPT_INC "$aPath/include"
276 lappend anErrInc "Error: '$theCheckHeader' not found ($theName)"
281 foreach anArchIter {64 32} {
282 set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter"]
283 if { "$aLibPath" == "" } {
285 foreach aFolderIter $theCheckFolders {
286 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ]
287 set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter" "$aPath/lib"]
288 if { "$aLibPath" != "" } {
289 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
290 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
296 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}$theCheckLib.${::SYS_LIB_SUFFIX}' not found ($theName)"
297 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
301 if { "$::tcl_platform(platform)" == "windows" } {
302 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter"]
303 if { "$aDllPath" == "" } {
305 foreach aFolderIter $theCheckFolders {
306 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ]
307 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/bin"]
308 if { "$aDllPath" != "" } {
309 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
313 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/lib"]
314 if { "$aDllPath" != "" } {
315 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
322 lappend anErrBin$anArchIter "Error: '$theCheckLib.dll' not found ($theName)"
323 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
332 # Search Tcl/Tk libraries placement
333 proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
334 upvar $theErrInc anErrInc
335 upvar $theErrLib32 anErrLib32
336 upvar $theErrLib64 anErrLib64
337 upvar $theErrBin32 anErrBin32
338 upvar $theErrBin64 anErrBin64
344 set aTclHPath [wokdep:SearchHeader "tcl.h"]
345 set aTkHPath [wokdep:SearchHeader "tk.h"]
346 if { "$aTclHPath" == "" || "$aTkHPath" == "" } {
347 if { [file exists "/usr/include/tcl8.6/tcl.h"]
348 && [file exists "/usr/include/tcl8.6/tk.h" ] } {
349 lappend ::CSF_OPT_INC "/usr/include/tcl8.6"
350 set aTclHPath "/usr/include/tcl8.6/tcl.h"
352 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ]
353 if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } {
354 lappend ::CSF_OPT_INC "$aPath/include"
355 set aTclHPath "$aPath/include/tcl.h"
357 lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)"
363 # detect tcl version by parsing header file
365 set fh [open $aTclHPath]
368 regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj
369 regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min
372 if { "$::tcl_platform(platform)" == "windows" } {
373 set aTclLibName "tcl${tclver_maj}${tclver_min}"
374 set aTkLibName "tk${tclver_maj}${tclver_min}"
376 set aTclLibName "tcl${tclver_maj}.${tclver_min}"
377 set aTkLibName "tk${tclver_maj}.${tclver_min}"
380 foreach anArchIter {64 32} {
381 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter"]
382 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter"]
383 if { "$aTclLibPath" == "" || "$aTkLibPath" == "" } {
384 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
385 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter" "$aPath/lib"]
386 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter" "$aPath/lib"]
387 if { "$aTclLibPath" != "" && "$aTkLibPath" != "" } {
388 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
390 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aTclLibName}.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}${aTkLibName}.${::SYS_LIB_SUFFIX}' not found (Tcl/Tk)"
391 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
395 if { "$::tcl_platform(platform)" == "windows" } {
396 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter"]
397 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter"]
398 if { "$aTclDllPath" == "" || "$aTkDllPath" == "" } {
399 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
400 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter" "$aPath/bin"]
401 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter" "$aPath/bin"]
402 if { "$aTclDllPath" != "" && "$aTkDllPath" != "" } {
403 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
405 lappend anErrBin$anArchIter "Error: '${aTclLibName}.dll' or '${aTkLibName}.dll' not found (Tcl/Tk)"
406 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
415 # Search FreeType library placement
416 proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
417 upvar $theErrInc anErrInc
418 upvar $theErrLib32 anErrLib32
419 upvar $theErrLib64 anErrLib64
420 upvar $theErrBin32 anErrBin32
421 upvar $theErrBin64 anErrBin64
424 set aFtBuildPath [wokdep:SearchHeader "ft2build.h"]
426 if { "$aFtBuildPath" == "" } {
427 # TODO - use `freetype-config --cflags` instead
428 set aSysFreeType "/usr/include/freetype2"
429 if { [file exists "$aSysFreeType/ft2build.h"] } {
430 lappend ::CSF_OPT_INC "$aSysFreeType"
431 } elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } {
432 lappend ::CSF_OPT_INC "$aSysFreeType/freetype2"
434 set aSysFreeType "/usr/X11/include/freetype2"
435 if { [file exists "$aSysFreeType/ft2build.h"] } {
436 lappend ::CSF_OPT_INC "/usr/X11/include"
437 lappend ::CSF_OPT_INC "$aSysFreeType"
439 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$::ARCH" ]
440 if {"$aPath" != ""} {
441 if {[file exists "$aPath/include/ft2build.h"]} {
442 lappend ::CSF_OPT_INC "$aPath/include"
443 } elseif {[file exists "$aPath/include/freetype2/ft2build.h"]} {
444 lappend ::CSF_OPT_INC "$aPath/include/freetype2"
447 lappend anErrInc "Error: 'freetype.h' not found (FreeType2)"
454 # parse 'freetype-config --libs'
456 if { [catch { set aConfLibs [exec freetype-config --libs] } ] == 0 } {
457 foreach aPath [split $aConfLibs " "] {
458 if { [string first "-L" "$aPath"] == 0 } {
459 set aConfLibPath [string range "$aPath" 2 [string length "$aPath"]]
464 foreach anArchIter {64 32} {
465 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter"]
466 if { "$aFtLibPath" == "" } {
467 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
468 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aPath/lib"]
469 if { "$aFtLibPath" != "" } {
470 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
472 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aConfLibPath"]
473 if { "$aFtLibPath" != "" } {
474 lappend ::CSF_OPT_LIB$anArchIter "$aConfLibPath"
476 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freetype.${::SYS_LIB_SUFFIX}' not found (FreeType2)"
477 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
481 if { "$::tcl_platform(platform)" == "windows" } {
482 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter"]
483 if { "$aFtDllPath" == "" } {
484 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
485 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/bin"]
486 if { "$aFtDllPath" != "" } {
487 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
489 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/lib"]
490 if { "$aFtDllPath" != "" } {
491 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
493 lappend anErrBin$anArchIter "Error: 'freetype.dll' not found (FreeType2)"
494 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
504 # Search FreeImage library placement
505 proc wokdep:SearchFreeImage {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
506 upvar $theErrInc anErrInc
507 upvar $theErrLib32 anErrLib32
508 upvar $theErrLib64 anErrLib64
509 upvar $theErrBin32 anErrBin32
510 upvar $theErrBin64 anErrBin64
512 # binary distribution has another layout
513 set aFImageDist "Dist"
516 set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
517 if { "$aFImageHPath" == "" } {
518 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ]
519 if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] } {
520 lappend ::CSF_OPT_INC "$aPath/include"
521 } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] } {
522 lappend ::CSF_OPT_INC "$aPath/$aFImageDist"
524 lappend anErrInc "Error: 'FreeImage.h' not found (FreeImage)"
529 foreach anArchIter {64 32} {
530 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
531 if { "$aFImageLibPath" == "" } {
532 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
533 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
534 if { "$aFImageLibPath" != "" } {
535 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
537 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
538 if { "$aFImageLibPath" != "" } {
539 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist"
541 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
542 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
546 if { "$::tcl_platform(platform)" == "windows" } {
547 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"]
548 if { "$aFImageDllPath" == "" } {
549 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
550 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"]
551 if { "$aFImageDllPath" != "" } {
552 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
554 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"]
555 if { "$aFImageDllPath" != "" } {
556 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist"
558 lappend anErrBin$anArchIter "Error: 'freeimage.dll' is not found (FreeImage)"
559 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
569 # Search FFmpeg framework placement
570 proc wokdep:SearchFFmpeg {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
571 upvar $theErrInc anErrInc
572 upvar $theErrLib32 anErrLib32
573 upvar $theErrLib64 anErrLib64
574 upvar $theErrBin32 anErrBin32
575 upvar $theErrBin64 anErrBin64
578 set aFFmpegHPath [wokdep:SearchHeader "libavutil/avutil.h"]
579 if { "$aFFmpegHPath" == "" } {
580 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$::ARCH" ]
581 if { "$aPath" != "" && [file exists "$aPath/include/libavutil/avutil.h"] } {
582 lappend ::CSF_OPT_INC "$aPath/include"
584 lappend anErrInc "Error: 'libavutil/avutil.h' not found (FFmpeg)"
589 foreach anArchIter {64 32} {
590 set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter"]
591 if { "$aFFmpegLibPath" == "" } {
592 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$anArchIter" ]
593 set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter" "$aPath/lib"]
594 if { "$aFFmpegLibPath" != "" } {
595 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
596 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
598 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}avutil.${::SYS_LIB_SUFFIX}' not found (FFmpeg)"
599 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
607 # Search TBB library placement
608 proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
609 upvar $theErrInc anErrInc
610 upvar $theErrLib32 anErrLib32
611 upvar $theErrLib64 anErrLib64
612 upvar $theErrBin32 anErrBin32
613 upvar $theErrBin64 anErrBin64
615 # keep only two first digits in "vc141"
616 if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } {
617 set aVcLib ${::VCVER}
621 set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"]
622 if { "$aTbbHPath" == "" } {
623 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ]
624 if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } {
625 lappend ::CSF_OPT_INC "$aPath/include"
627 lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)"
632 foreach anArchIter {64 32} {
634 if { "$anArchIter" == "64"} {
635 set aSubDir "intel64"
638 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"]
639 if { "$aTbbLibPath" == "" } {
640 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
641 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/$aVcLib"]
642 if { "$aTbbLibPath" == "" } {
643 # Set the path to the TBB library for Linux
644 if { "$::tcl_platform(platform)" != "windows" } {
645 set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21"
647 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"]
648 if { "$aTbbLibPath" != "" } {
649 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir"
652 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/$aVcLib"
654 if { "$aTbbLibPath" == "" } {
655 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
656 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
659 if { "$::tcl_platform(platform)" == "windows" } {
660 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
661 if { "$aTbbDllPath" == "" } {
662 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
663 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
664 if { "$aTbbDllPath" != "" } {
665 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
667 lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
668 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
677 # Search OpenCL library placement
678 proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
679 upvar $theErrInc anErrInc
680 upvar $theErrLib32 anErrLib32
681 upvar $theErrLib64 anErrLib64
682 upvar $theErrBin32 anErrBin32
683 upvar $theErrBin64 anErrBin64
686 if { "$::tcl_platform(os)" == "Darwin" } {
687 # OpenCL framework available since Mac OS X 16
691 set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"]
692 if { "$aCLHPath" == "" } {
693 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ]
694 if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } {
695 lappend ::CSF_OPT_INC "$aPath/include"
697 lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)"
702 foreach anArchIter {64 32} {
703 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"]
704 if { "$aCLLibPath" == "" } {
705 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ]
706 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"]
707 if { "$aCLLibPath" != "" } {
708 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
710 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)"
711 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
719 # Search EGL library placement
720 proc wokdep:SearchEGL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
721 upvar $theErrInc anErrInc
722 upvar $theErrLib32 anErrLib32
723 upvar $theErrLib64 anErrLib64
724 upvar $theErrBin32 anErrBin32
725 upvar $theErrBin64 anErrBin64
728 set aHeaderPath [wokdep:SearchHeader "EGL/egl.h"]
729 if { "$aHeaderPath" == "" } {
730 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$::ARCH" ]
731 if { "$aPath" == "" || ![file exists "$aPath/include/EGL/egl.h"] } {
732 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
735 if { "$aPath" != "" && [file exists "$aPath/include/EGL/egl.h"] } {
736 lappend ::CSF_OPT_INC "$aPath/include"
738 lappend anErrInc "Error: 'EGL/egl.h' not found (EGL)"
744 if { "$::tcl_platform(platform)" == "windows" } {
746 set aLibName "libEGL"
749 foreach anArchIter {64 32} {
750 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
751 if { "$aLibPath" == "" } {
752 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
753 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
754 if { "$aLibPath" == "" } {
755 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
756 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
759 if { "$aLibPath" != "" } {
760 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
762 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (EGL)"
763 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
767 if { "$::tcl_platform(platform)" == "windows" } {
768 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter"]
769 if { "$aDllPath" == "" } {
770 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
771 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
772 if { "$aDllPath" == "" } {
773 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
774 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
777 if { "$aDllPath" != "" } {
778 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
780 lappend anErrBin$anArchIter "Error: 'libEGL.dll' not found (EGL)"
781 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
790 # Search OpenGL ES 2.0 library placement
791 proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
792 upvar $theErrInc anErrInc
793 upvar $theErrLib32 anErrLib32
794 upvar $theErrLib64 anErrLib64
795 upvar $theErrBin32 anErrBin32
796 upvar $theErrBin64 anErrBin64
799 set aHeaderPath [wokdep:SearchHeader "GLES2/gl2.h"]
800 if { "$aHeaderPath" == "" } {
801 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$::ARCH" ]
802 if { "$aPath" == "" || ![file exists "$aPath/include/GLES2/gl2.h"] } {
803 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
806 if { "$aPath" != "" && [file exists "$aPath/include/GLES2/gl2.h"] } {
807 lappend ::CSF_OPT_INC "$aPath/include"
809 lappend anErrInc "Error: 'GLES2/gl2.h' not found (OpenGL ES 2.0)"
814 set aLibName "GLESv2"
815 if { "$::tcl_platform(platform)" == "windows" } {
817 set aLibName "libGLESv2"
820 foreach anArchIter {64 32} {
821 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
822 if { "$aLibPath" == "" } {
823 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$anArchIter" ]
824 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
825 if { "$aLibPath" == "" } {
826 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
827 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
830 if { "$aLibPath" != "" } {
831 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
833 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (OpenGL ES 2.0)"
834 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
838 if { "$::tcl_platform(platform)" == "windows" } {
839 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter"]
840 if { "$aDllPath" == "" } {
841 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
842 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
843 if { "$aDllPath" == "" } {
844 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
845 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
848 if { "$aDllPath" != "" } {
849 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
851 lappend anErrBin$anArchIter "Error: 'libGLESv2.dll' not found (OpenGL ES 2.0)"
852 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
861 # Auxiliary function, gets VTK version to set default search directory
862 proc wokdep:VtkVersion { thePath } {
865 set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0]
866 if { "$aVtkRoot" != "" } {
867 set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot]
868 if { "$aVtkRoot" != "" } {
869 set aResult $aVtkRoot
876 # Search VTK library placement
877 proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
878 upvar $theErrInc anErrInc
879 upvar $theErrLib32 anErrLib32
880 upvar $theErrLib64 anErrLib64
881 upvar $theErrBin32 anErrBin32
882 upvar $theErrBin64 anErrBin64
887 set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"]
888 set aVtkVer [wokdep:VtkVersion $aVtkIncPath]
889 if { "$aVtkIncPath" == ""} {
890 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
891 set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ]
892 if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} {
893 set aVtkVer [wokdep:VtkVersion $aVtkPath]
894 lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]"
895 } else { # try to search in all found paths
897 foreach anIt $aPathList {
898 if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } {
900 set aVtkVer [wokdep:VtkVersion $aVtkPath]
901 lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]"
907 # Bad case: we do not found vtkConfigure.h in all paths.
908 if { "$isFound" == "false"} {
909 lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)"
916 foreach anArchIter {64 32} {
917 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"]
918 if { "$aVtkLibPath" == "" } {
919 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
920 set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ]
921 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"]
922 if { "$aVtkLibPath" != "" } {
923 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
925 set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"]
926 if { "$aPath" != "" } {
927 set aLibPath $aVtkIncPath
928 lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib"
930 # The last chance: search /lib directory in all found paths
931 foreach anIt $aPathList {
932 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"]
933 if { "$aVtkLibPath" != ""} {
934 lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib"
938 if { "$aVtkLibPath" == "" } {
939 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)"
940 if { "$::ARCH" == "$anArchIter" } {
950 if { "$::tcl_platform(platform)" == "windows" } {
951 foreach anArchIter {64 32} {
952 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
953 if { "$aVtkBinPath" == "" } {
954 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
955 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
956 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
958 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
959 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
964 # We didn't find preferred binary path => search through inc path or among all available VTK directories
965 if { "$aVtkBinPath" == "" } {
966 # Try to find in lib path
967 set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/bin"]
968 if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/bin"
969 } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/lib"] != "" } {
970 lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/lib"
972 lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
981 # Search Qt4 libraries placement
982 proc wokdep:SearchQt4 {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
990 set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
991 if { "$aQMsgBoxHPath" == "" } {
992 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
993 if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
994 lappend ::CSF_OPT_INC "$aPath/include"
995 lappend ::CSF_OPT_INC "$aPath/include/Qt"
996 lappend ::CSF_OPT_INC "$aPath/include/QtGui"
997 lappend ::CSF_OPT_INC "$aPath/include/QtCore"
999 if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
1000 lappend ::CSF_OPT_INC "/usr/include/qt4"
1001 lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
1002 lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
1003 lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
1005 lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
1011 set aQtGuiLibName "QtGui"
1012 if { "$::tcl_platform(platform)" == "windows" } {
1013 set aQtGuiLibName "QtGui4"
1016 foreach anArchIter {64 32} {
1017 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
1018 if { "$aQMsgBoxLibPath" == "" } {
1019 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
1020 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
1021 if { "$aQMsgBoxLibPath" != "" } {
1022 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
1024 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
1025 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1028 if { "$::tcl_platform(platform)" == "windows" } {
1029 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
1030 if { "$aQMsgBoxDllPath" == "" } {
1031 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
1032 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
1033 if { "$aQMsgBoxDllPath" != "" } {
1034 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1036 lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
1037 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1046 # Search JDK placement
1047 proc wokdep:SearchJDK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1048 upvar $theErrInc anErrInc
1049 upvar $theErrLib32 anErrLib32
1050 upvar $theErrLib64 anErrLib64
1051 upvar $theErrBin32 anErrBin32
1052 upvar $theErrBin64 anErrBin64
1055 set aJniHPath [wokdep:SearchHeader "jni.h"]
1056 set aJniMdHPath [wokdep:SearchHeader "jni_md.h"]
1057 if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } {
1058 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ]
1059 if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } {
1060 lappend ::CSF_OPT_INC "$aPath/include"
1061 if { "$::tcl_platform(platform)" == "windows" } {
1062 lappend ::CSF_OPT_INC "$aPath/include/win32"
1063 } elseif { [file exists "$aPath/include/linux"] } {
1064 lappend ::CSF_OPT_INC "$aPath/include/linux"
1067 if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } {
1068 lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include"
1070 lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)"
1076 foreach anArchIter {64 32} {
1077 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"]
1078 if { "$aJavacPath" == "" } {
1079 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ]
1080 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"]
1081 if { "$aJavacPath" != "" } {
1082 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1084 if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } {
1085 lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin"
1087 lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)"
1088 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1097 # Search X11 libraries placement
1098 proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1099 upvar $theErrInc anErrInc
1100 upvar $theErrLib32 anErrLib32
1101 upvar $theErrLib64 anErrLib64
1102 upvar $theErrBin32 anErrBin32
1103 upvar $theErrBin64 anErrBin64
1106 if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
1110 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
1111 if { "$aXmuLibPath" == "" } {
1112 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
1113 if { "$aXmuLibPath" != "" } {
1114 #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
1116 lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
1124 # Returns OCCT version string from file Standard_Version.hxx (if available)
1125 proc wokdep:DetectCasVersion {} {
1127 set aCasRoot [file normalize [file dirname [info script]]]
1128 set filename "${aCasRoot}/src/Standard/Standard_Version.hxx"
1129 if { [file exists $filename] } {
1130 set fh [open $filename "r"]
1131 set fh_loaded [read $fh]
1133 regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver
1135 puts "Error: file '$filename' not found"
1140 # Generate (override) custom environment file
1141 proc wokdep:SaveCustom {} {
1142 set aGenInfo "This environment file was generated by genconf.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1143 if { "$::tcl_platform(platform)" == "windows" } {
1144 set aCustomFilePath "./custom.bat"
1145 set aFile [open $aCustomFilePath "w"]
1146 puts $aFile "@echo off"
1147 puts $aFile "rem $aGenInfo"
1150 puts $aFile "set PRJFMT=$::PRJFMT"
1151 puts $aFile "set VCVER=$::VCVER"
1152 puts $aFile "set ARCH=$::ARCH"
1153 puts $aFile "set VCVARS=$::VCVARS"
1154 puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1157 puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\""
1160 puts $aFile "rem Optional 3rd-parties switches"
1161 foreach anEnvIter $::THE_ENV_VARIABLES {
1162 set aName ${anEnvIter}
1163 set aValue [set ::${anEnvIter}]
1164 if { "$aValue" != "" } {
1165 puts $aFile "set ${aName}=$aValue"
1169 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1170 if { "$::PRODUCTS_PATH" != "" } {
1171 set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "%PRODUCTS_PATH%"]
1174 puts $aFile "rem Additional headers search paths"
1175 puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
1177 set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
1178 if { "$::PRODUCTS_PATH" != "" } {
1179 set aStringLib32 [regsub -all "$::PRODUCTS_PATH" $aStringLib32 "%PRODUCTS_PATH%"]
1182 puts $aFile "rem Additional libraries (32-bit) search paths"
1183 puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
1185 set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
1186 if { "$::PRODUCTS_PATH" != "" } {
1187 set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"]
1190 puts $aFile "rem Additional libraries (64-bit) search paths"
1191 puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
1193 set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
1194 if { "$::PRODUCTS_PATH" != "" } {
1195 set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"]
1198 puts $aFile "rem Additional (32-bit) search paths"
1199 puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
1201 set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
1202 if { "$::PRODUCTS_PATH" != "" } {
1203 set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"]
1206 puts $aFile "rem Additional (64-bit) search paths"
1207 puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
1211 set aCustomFilePath "./custom.sh"
1212 set aFile [open $aCustomFilePath "w"]
1213 puts $aFile "#!/bin/bash"
1214 puts $aFile "# $aGenInfo"
1217 puts $aFile "export PRJFMT=$::PRJFMT"
1218 puts $aFile "export ARCH=$::ARCH"
1219 puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1222 puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1225 puts $aFile "# Optional 3rd-parties switches"
1226 foreach anEnvIter $::THE_ENV_VARIABLES {
1227 set aName ${anEnvIter}
1228 set aValue [set ::${anEnvIter}]
1229 if { "$aValue" != "" } {
1230 puts $aFile "export ${aName}=${aValue}"
1234 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1235 if { "$::PRODUCTS_PATH" != "" } {
1236 set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "\${PRODUCTS_PATH}"]
1239 puts $aFile "# Additional headers search paths"
1240 puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
1242 set aStringLib [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
1243 if { "$::PRODUCTS_PATH" != "" } {
1244 set aStringLib [regsub -all "$::PRODUCTS_PATH" $aStringLib "\${PRODUCTS_PATH}"]
1247 puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
1248 puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\""
1250 set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
1251 if { "$::PRODUCTS_PATH" != "" } {
1252 set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"]
1255 puts $aFile "# Additional ($::ARCH-bit) search paths"
1256 puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\""
1260 puts "Configuration saved to file '$aCustomFilePath'"
1262 # generate custom.auto.pri
1263 set toExportCustomPri 1
1264 if { $toExportCustomPri == 1 } {
1265 set aCasVer [wokdep:DetectCasVersion]
1266 set aCustomFilePath "./adm/qmake/custom.auto.pri"
1267 set aFile [open $aCustomFilePath "w"]
1268 puts $aFile "# $aGenInfo"
1271 puts $aFile "VERSION=$aCasVer"
1272 puts $aFile "PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1275 puts $aFile "# Optional 3rd-parties switches"
1276 foreach anEnvIter $::THE_ENV_VARIABLES {
1277 set aName ${anEnvIter}
1278 set aValue [set ::${anEnvIter}]
1279 if { "$aValue" == "true" } {
1280 puts $aFile "CONFIG += ${aName}"
1282 #puts $aFile "CONFIG -= ${aName}"
1287 puts $aFile "# Additional headers search paths"
1288 foreach anIncPath $::CSF_OPT_INC {
1289 if { "$::PRODUCTS_PATH" != "" } {
1290 set anIncPath [regsub -all "$::PRODUCTS_PATH" $anIncPath "\$\$\{PRODUCTS_PATH\}"]
1292 puts $aFile "INCLUDEPATH += \"${anIncPath}\""
1296 puts $aFile "# Additional libraries search paths"
1297 foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] {
1298 if { "$::PRODUCTS_PATH" != "" } {
1299 set aLibPath [regsub -all "$::PRODUCTS_PATH" $aLibPath "\$\$\{PRODUCTS_PATH\}"]
1301 puts $aFile "LIBS += -L\"${aLibPath}\""
1304 if { "$::tcl_platform(platform)" == "windows" } {
1306 puts $aFile "# Additional DLLs search paths"
1307 foreach aDllPath [set ::CSF_OPT_BIN$::ARCH] {
1308 if { "$::PRODUCTS_PATH" != "" } {
1309 set aDllPath [regsub -all "$::PRODUCTS_PATH" $aDllPath "\$\$\{PRODUCTS_PATH\}"]
1311 puts $aFile "LIBS += -L\"${aDllPath}\""
1317 puts "Configuration saved to file '$aCustomFilePath'"