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_RAPIDJSON 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 # Search RapidJSON headers
862 proc wokdep:SearchRapidJson {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
863 upvar $theErrInc anErrInc
866 set aRJHPath [wokdep:SearchHeader "rapidjson/rapidjson.h"]
867 if { "$aRJHPath" == "" } {
868 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{rapidjson}*] "$::VCVER" "$::ARCH" ]
869 if { "$aPath" != "" && [file exists "$aPath/include/rapidjson/rapidjson.h"] } {
870 lappend ::CSF_OPT_INC "$aPath/include"
872 lappend anErrInc "Error: 'rapidjson/rapidjson.h' not found (RapidJSON)"
880 # Auxiliary function, gets VTK version to set default search directory
881 proc wokdep:VtkVersion { thePath } {
884 set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0]
885 if { "$aVtkRoot" != "" } {
886 set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot]
887 if { "$aVtkRoot" != "" } {
888 set aResult $aVtkRoot
895 # Search VTK library placement
896 proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
897 upvar $theErrInc anErrInc
898 upvar $theErrLib32 anErrLib32
899 upvar $theErrLib64 anErrLib64
900 upvar $theErrBin32 anErrBin32
901 upvar $theErrBin64 anErrBin64
906 set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"]
907 set aVtkVer [wokdep:VtkVersion $aVtkIncPath]
908 if { "$aVtkIncPath" == ""} {
909 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
910 set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ]
911 if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} {
912 set aVtkVer [wokdep:VtkVersion $aVtkPath]
913 lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]"
914 } else { # try to search in all found paths
916 foreach anIt $aPathList {
917 if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } {
919 set aVtkVer [wokdep:VtkVersion $aVtkPath]
920 lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]"
926 # Bad case: we do not found vtkConfigure.h in all paths.
927 if { "$isFound" == "false"} {
928 lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)"
935 foreach anArchIter {64 32} {
936 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"]
937 if { "$aVtkLibPath" == "" } {
938 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
939 set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ]
940 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"]
941 if { "$aVtkLibPath" != "" } {
942 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
944 set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"]
945 if { "$aPath" != "" } {
946 set aLibPath $aVtkIncPath
947 lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib"
949 # The last chance: search /lib directory in all found paths
950 foreach anIt $aPathList {
951 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"]
952 if { "$aVtkLibPath" != ""} {
953 lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib"
957 if { "$aVtkLibPath" == "" } {
958 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)"
959 if { "$::ARCH" == "$anArchIter" } {
969 if { "$::tcl_platform(platform)" == "windows" } {
970 foreach anArchIter {64 32} {
971 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
972 if { "$aVtkBinPath" == "" } {
973 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
974 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
975 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
977 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
978 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
983 # We didn't find preferred binary path => search through inc path or among all available VTK directories
984 if { "$aVtkBinPath" == "" } {
985 # Try to find in lib path
986 set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/bin"]
987 if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/bin"
988 } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/lib"] != "" } {
989 lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/lib"
991 lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
1000 # Search Qt4 libraries placement
1001 proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1002 upvar $theErrInc anErrInc
1003 upvar $theErrLib32 anErrLib32
1004 upvar $theErrLib64 anErrLib64
1005 upvar $theErrBin32 anErrBin32
1006 upvar $theErrBin64 anErrBin64
1009 set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
1010 if { "$aQMsgBoxHPath" == "" } {
1011 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
1012 if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
1013 lappend ::CSF_OPT_INC "$aPath/include"
1014 lappend ::CSF_OPT_INC "$aPath/include/Qt"
1015 lappend ::CSF_OPT_INC "$aPath/include/QtGui"
1016 lappend ::CSF_OPT_INC "$aPath/include/QtCore"
1018 if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
1019 lappend ::CSF_OPT_INC "/usr/include/qt4"
1020 lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
1021 lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
1022 lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
1024 lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
1030 set aQtGuiLibName "QtGui"
1031 if { "$::tcl_platform(platform)" == "windows" } {
1032 set aQtGuiLibName "QtGui4"
1035 foreach anArchIter {64 32} {
1036 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
1037 if { "$aQMsgBoxLibPath" == "" } {
1038 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
1039 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
1040 if { "$aQMsgBoxLibPath" != "" } {
1041 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
1043 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
1044 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1047 if { "$::tcl_platform(platform)" == "windows" } {
1048 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
1049 if { "$aQMsgBoxDllPath" == "" } {
1050 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
1051 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
1052 if { "$aQMsgBoxDllPath" != "" } {
1053 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1055 lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
1056 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1065 # Search JDK placement
1066 proc wokdep:SearchJDK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1067 upvar $theErrInc anErrInc
1068 upvar $theErrLib32 anErrLib32
1069 upvar $theErrLib64 anErrLib64
1070 upvar $theErrBin32 anErrBin32
1071 upvar $theErrBin64 anErrBin64
1074 set aJniHPath [wokdep:SearchHeader "jni.h"]
1075 set aJniMdHPath [wokdep:SearchHeader "jni_md.h"]
1076 if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } {
1077 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ]
1078 if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } {
1079 lappend ::CSF_OPT_INC "$aPath/include"
1080 if { "$::tcl_platform(platform)" == "windows" } {
1081 lappend ::CSF_OPT_INC "$aPath/include/win32"
1082 } elseif { [file exists "$aPath/include/linux"] } {
1083 lappend ::CSF_OPT_INC "$aPath/include/linux"
1086 if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } {
1087 lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include"
1089 lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)"
1095 foreach anArchIter {64 32} {
1096 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"]
1097 if { "$aJavacPath" == "" } {
1098 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ]
1099 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"]
1100 if { "$aJavacPath" != "" } {
1101 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1103 if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } {
1104 lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin"
1106 lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)"
1107 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1116 # Search X11 libraries placement
1117 proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1118 upvar $theErrInc anErrInc
1119 upvar $theErrLib32 anErrLib32
1120 upvar $theErrLib64 anErrLib64
1121 upvar $theErrBin32 anErrBin32
1122 upvar $theErrBin64 anErrBin64
1125 if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
1129 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
1130 if { "$aXmuLibPath" == "" } {
1131 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
1132 if { "$aXmuLibPath" != "" } {
1133 #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
1135 lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
1143 # Returns OCCT version string from file Standard_Version.hxx (if available)
1144 proc wokdep:DetectCasVersion {} {
1146 set aCasRoot [file normalize [file dirname [info script]]]
1147 set filename "${aCasRoot}/src/Standard/Standard_Version.hxx"
1148 if { [file exists $filename] } {
1149 set fh [open $filename "r"]
1150 set fh_loaded [read $fh]
1152 regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver
1154 puts "Error: file '$filename' not found"
1159 # Generate (override) custom environment file
1160 proc wokdep:SaveCustom {} {
1161 set aGenInfo "This environment file was generated by genconf.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1162 if { "$::tcl_platform(platform)" == "windows" } {
1163 set aCustomFilePath "./custom.bat"
1164 set aFile [open $aCustomFilePath "w"]
1165 puts $aFile "@echo off"
1166 puts $aFile "rem $aGenInfo"
1169 puts $aFile "set PRJFMT=$::PRJFMT"
1170 puts $aFile "set VCVER=$::VCVER"
1171 puts $aFile "set ARCH=$::ARCH"
1172 puts $aFile "set VCVARS=$::VCVARS"
1173 puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1176 puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\""
1179 puts $aFile "rem Optional 3rd-parties switches"
1180 foreach anEnvIter $::THE_ENV_VARIABLES {
1181 set aName ${anEnvIter}
1182 set aValue [set ::${anEnvIter}]
1183 if { "$aValue" != "" } {
1184 puts $aFile "set ${aName}=$aValue"
1188 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1189 if { "$::PRODUCTS_PATH" != "" } {
1190 set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "%PRODUCTS_PATH%"]
1193 puts $aFile "rem Additional headers search paths"
1194 puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
1196 set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
1197 if { "$::PRODUCTS_PATH" != "" } {
1198 set aStringLib32 [regsub -all "$::PRODUCTS_PATH" $aStringLib32 "%PRODUCTS_PATH%"]
1201 puts $aFile "rem Additional libraries (32-bit) search paths"
1202 puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
1204 set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
1205 if { "$::PRODUCTS_PATH" != "" } {
1206 set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"]
1209 puts $aFile "rem Additional libraries (64-bit) search paths"
1210 puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
1212 set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
1213 if { "$::PRODUCTS_PATH" != "" } {
1214 set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"]
1217 puts $aFile "rem Additional (32-bit) search paths"
1218 puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
1220 set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
1221 if { "$::PRODUCTS_PATH" != "" } {
1222 set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"]
1225 puts $aFile "rem Additional (64-bit) search paths"
1226 puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
1230 set aCustomFilePath "./custom.sh"
1231 set aFile [open $aCustomFilePath "w"]
1232 puts $aFile "#!/bin/bash"
1233 puts $aFile "# $aGenInfo"
1236 puts $aFile "export PRJFMT=$::PRJFMT"
1237 puts $aFile "export ARCH=$::ARCH"
1238 puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1241 puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1244 puts $aFile "# Optional 3rd-parties switches"
1245 foreach anEnvIter $::THE_ENV_VARIABLES {
1246 set aName ${anEnvIter}
1247 set aValue [set ::${anEnvIter}]
1248 if { "$aValue" != "" } {
1249 puts $aFile "export ${aName}=${aValue}"
1253 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1254 if { "$::PRODUCTS_PATH" != "" } {
1255 set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "\${PRODUCTS_PATH}"]
1258 puts $aFile "# Additional headers search paths"
1259 puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
1261 set aStringLib [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
1262 if { "$::PRODUCTS_PATH" != "" } {
1263 set aStringLib [regsub -all "$::PRODUCTS_PATH" $aStringLib "\${PRODUCTS_PATH}"]
1266 puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
1267 puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\""
1269 set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
1270 if { "$::PRODUCTS_PATH" != "" } {
1271 set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"]
1274 puts $aFile "# Additional ($::ARCH-bit) search paths"
1275 puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\""
1279 puts "Configuration saved to file '$aCustomFilePath'"
1281 # generate custom.auto.pri
1282 set toExportCustomPri 1
1283 if { $toExportCustomPri == 1 } {
1284 set aCasVer [wokdep:DetectCasVersion]
1285 set aCustomFilePath "./adm/qmake/custom.auto.pri"
1286 set aFile [open $aCustomFilePath "w"]
1287 puts $aFile "# $aGenInfo"
1290 puts $aFile "VERSION=$aCasVer"
1291 puts $aFile "PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1294 puts $aFile "# Optional 3rd-parties switches"
1295 foreach anEnvIter $::THE_ENV_VARIABLES {
1296 set aName ${anEnvIter}
1297 set aValue [set ::${anEnvIter}]
1298 if { "$aValue" == "true" } {
1299 puts $aFile "CONFIG += ${aName}"
1301 #puts $aFile "CONFIG -= ${aName}"
1306 puts $aFile "# Additional headers search paths"
1307 foreach anIncPath $::CSF_OPT_INC {
1308 if { "$::PRODUCTS_PATH" != "" } {
1309 set anIncPath [regsub -all "$::PRODUCTS_PATH" $anIncPath "\$\$\{PRODUCTS_PATH\}"]
1311 puts $aFile "INCLUDEPATH += \"${anIncPath}\""
1315 puts $aFile "# Additional libraries search paths"
1316 foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] {
1317 if { "$::PRODUCTS_PATH" != "" } {
1318 set aLibPath [regsub -all "$::PRODUCTS_PATH" $aLibPath "\$\$\{PRODUCTS_PATH\}"]
1320 puts $aFile "LIBS += -L\"${aLibPath}\""
1323 if { "$::tcl_platform(platform)" == "windows" } {
1325 puts $aFile "# Additional DLLs search paths"
1326 foreach aDllPath [set ::CSF_OPT_BIN$::ARCH] {
1327 if { "$::PRODUCTS_PATH" != "" } {
1328 set aDllPath [regsub -all "$::PRODUCTS_PATH" $aDllPath "\$\$\{PRODUCTS_PATH\}"]
1330 puts $aFile "LIBS += -L\"${aDllPath}\""
1336 puts "Configuration saved to file '$aCustomFilePath'"