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 } {
89 if { [info exists ::env(${anEnvIter})] } {
90 set ${anEnvIter} "$::env(${anEnvIter})"
93 if { [info exists ::env(PRODUCTS_PATH)] } {
94 set PRODUCTS_PATH [file normalize "$::env(PRODUCTS_PATH)"]
97 if { [info exists ::env(CSF_OPT_INC)] } {
98 set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER]
100 if { [info exists ::env(CSF_OPT_LIB32)] } {
101 set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER]
103 if { [info exists ::env(CSF_OPT_LIB64)] } {
104 set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER]
106 if { [info exists ::env(CSF_OPT_BIN32)] } {
107 set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER]
109 if { [info exists ::env(CSF_OPT_BIN64)] } {
110 set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER]
113 # Search header file in $::CSF_OPT_INC and standard paths
114 proc wokdep:SearchHeader {theHeader} {
115 # search in custom paths
116 foreach anIncPath $::CSF_OPT_INC {
117 set aPath "${anIncPath}/${theHeader}"
118 if { [file exists "$aPath"] } {
124 set aPath "/usr/include/${theHeader}"
125 if { [file exists "$aPath"] } {
129 if { "$::tcl_platform(os)" == "Linux" } {
130 if { "$::ARCH" == "64" } {
131 set aPath "/usr/include/x86_64-linux-gnu/${theHeader}"
132 if { [file exists "$aPath"] } {
136 set aPath "/usr/include/i386-linux-gnu/${theHeader}"
137 if { [file exists "$aPath"] } {
146 # Search library file in $::CSF_OPT_LIB* and standard paths
147 proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} {
148 if { "$theSearchPath" != "" } {
149 set aPath "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
150 if { [file exists "$aPath"] } {
157 # search in custom paths
158 foreach aLibPath [set ::CSF_OPT_LIB$theBitness] {
159 set aPath "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
160 if { [file exists "$aPath"] } {
166 if { "$::ARCH" == "$theBitness"} {
167 set aPath "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
168 if { [file exists "$aPath"] } {
174 if { "$::tcl_platform(os)" == "Linux" } {
175 if { "$theBitness" == "64" } {
176 set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so"
177 if { [file exists "$aPath"] } {
181 set aPath "/usr/lib/i386-linux-gnu/lib${theLib}.so"
182 if { [file exists "$aPath"] } {
191 # Search file in $::CSF_OPT_BIN* and standard paths
192 proc wokdep:SearchBin {theBin theBitness {theSearchPath ""}} {
193 if { "$theSearchPath" != "" } {
194 set aPath "${theSearchPath}/${theBin}"
195 if { [file exists "$aPath"] } {
202 # search in custom paths
203 foreach aBinPath [set ::CSF_OPT_BIN$theBitness] {
204 set aPath "${aBinPath}/${theBin}"
205 if { [file exists "$aPath"] } {
211 if { "$::ARCH" == "$theBitness"} {
212 set aPath "/usr/bin/${theBin}"
213 if { [file exists "$aPath"] } {
221 # Detect compiler C-runtime version 'vc*' and architecture '32'/'64'
222 # to determine preferred path.
223 proc wokdep:Preferred {theList theCmpl theArch} {
224 if { [llength $theList] == 0 } {
228 # keep only two first digits in "vc141"
229 if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } {
234 foreach aPath $theList {
235 if { [string first "$aCmpl" "$aPath"] != "-1" } {
236 lappend aShortList "$aPath"
240 if { [llength $aShortList] == 0 } {
241 #return [lindex $theList 0]
242 set aShortList $theList
245 set aVeryShortList {}
246 foreach aPath $aShortList {
247 if { [string first "$theArch" "$aPath"] != "-1" } {
248 lappend aVeryShortList "$aPath"
251 if { [llength $aVeryShortList] == 0 } {
252 return [lindex [lsort -decreasing $aShortList] 0]
255 return [lindex [lsort -decreasing $aVeryShortList] 0]
258 # Search library placement
259 proc wokdep:SearchStandardLibrary {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64 theName theCheckHeader theCheckLib theCheckFolders} {
260 upvar $theErrInc anErrInc
261 upvar $theErrLib32 anErrLib32
262 upvar $theErrLib64 anErrLib64
263 upvar $theErrBin32 anErrBin32
264 upvar $theErrBin64 anErrBin64
267 set aHeaderPath [wokdep:SearchHeader "$theCheckHeader"]
268 if { "$aHeaderPath" == "" } {
270 foreach aFolderIter $theCheckFolders {
271 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$::ARCH" ]
272 if { "$aPath" != "" && [file exists "$aPath/include/$theCheckHeader"] } {
273 lappend ::CSF_OPT_INC "$aPath/include"
279 lappend anErrInc "Error: '$theCheckHeader' not found ($theName)"
284 foreach anArchIter {64 32} {
285 set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter"]
286 if { "$aLibPath" == "" } {
288 foreach aFolderIter $theCheckFolders {
289 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ]
290 set aLibPath [wokdep:SearchLib "$theCheckLib" "$anArchIter" "$aPath/lib"]
291 if { "$aLibPath" != "" } {
292 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
293 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
299 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}$theCheckLib.${::SYS_LIB_SUFFIX}' not found ($theName)"
300 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
304 if { "$::tcl_platform(platform)" == "windows" } {
305 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter"]
306 if { "$aDllPath" == "" } {
308 foreach aFolderIter $theCheckFolders {
309 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{$aFolderIter}*] "$::VCVER" "$anArchIter" ]
310 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/bin"]
311 if { "$aDllPath" != "" } {
312 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
316 set aDllPath [wokdep:SearchBin "$theCheckLib.dll" "$anArchIter" "$aPath/lib"]
317 if { "$aDllPath" != "" } {
318 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
325 lappend anErrBin$anArchIter "Error: '$theCheckLib.dll' not found ($theName)"
326 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
335 # Search Tcl/Tk libraries placement
336 proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
337 upvar $theErrInc anErrInc
338 upvar $theErrLib32 anErrLib32
339 upvar $theErrLib64 anErrLib64
340 upvar $theErrBin32 anErrBin32
341 upvar $theErrBin64 anErrBin64
347 set aTclHPath [wokdep:SearchHeader "tcl.h"]
348 set aTkHPath [wokdep:SearchHeader "tk.h"]
349 if { "$aTclHPath" == "" || "$aTkHPath" == "" } {
350 if { [file exists "/usr/include/tcl8.6/tcl.h"]
351 && [file exists "/usr/include/tcl8.6/tk.h" ] } {
352 lappend ::CSF_OPT_INC "/usr/include/tcl8.6"
353 set aTclHPath "/usr/include/tcl8.6/tcl.h"
355 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ]
356 if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } {
357 lappend ::CSF_OPT_INC "$aPath/include"
358 set aTclHPath "$aPath/include/tcl.h"
360 lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)"
366 # detect tcl version by parsing header file
368 set fh [open $aTclHPath]
371 regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj
372 regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min
375 if { "$::tcl_platform(platform)" == "windows" } {
376 set aTclLibName "tcl${tclver_maj}${tclver_min}"
377 set aTkLibName "tk${tclver_maj}${tclver_min}"
379 set aTclLibName "tcl${tclver_maj}.${tclver_min}"
380 set aTkLibName "tk${tclver_maj}.${tclver_min}"
383 foreach anArchIter {64 32} {
384 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter"]
385 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter"]
386 if { "$aTclLibPath" == "" || "$aTkLibPath" == "" } {
387 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
388 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter" "$aPath/lib"]
389 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter" "$aPath/lib"]
390 if { "$aTclLibPath" != "" && "$aTkLibPath" != "" } {
391 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
393 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aTclLibName}.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}${aTkLibName}.${::SYS_LIB_SUFFIX}' not found (Tcl/Tk)"
394 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
398 if { "$::tcl_platform(platform)" == "windows" } {
399 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter"]
400 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter"]
401 if { "$aTclDllPath" == "" || "$aTkDllPath" == "" } {
402 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
403 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter" "$aPath/bin"]
404 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter" "$aPath/bin"]
405 if { "$aTclDllPath" != "" && "$aTkDllPath" != "" } {
406 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
408 lappend anErrBin$anArchIter "Error: '${aTclLibName}.dll' or '${aTkLibName}.dll' not found (Tcl/Tk)"
409 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
418 # Search FreeType library placement
419 proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
420 upvar $theErrInc anErrInc
421 upvar $theErrLib32 anErrLib32
422 upvar $theErrLib64 anErrLib64
423 upvar $theErrBin32 anErrBin32
424 upvar $theErrBin64 anErrBin64
427 set aFtBuildPath [wokdep:SearchHeader "ft2build.h"]
429 if { "$aFtBuildPath" == "" } {
430 # TODO - use `freetype-config --cflags` instead
431 set aSysFreeType "/usr/include/freetype2"
432 if { [file exists "$aSysFreeType/ft2build.h"] } {
433 lappend ::CSF_OPT_INC "$aSysFreeType"
434 } elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } {
435 lappend ::CSF_OPT_INC "$aSysFreeType/freetype2"
437 set aSysFreeType "/usr/X11/include/freetype2"
438 if { [file exists "$aSysFreeType/ft2build.h"] } {
439 lappend ::CSF_OPT_INC "/usr/X11/include"
440 lappend ::CSF_OPT_INC "$aSysFreeType"
442 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$::ARCH" ]
443 if {"$aPath" != ""} {
444 if {[file exists "$aPath/include/ft2build.h"]} {
445 lappend ::CSF_OPT_INC "$aPath/include"
446 } elseif {[file exists "$aPath/include/freetype2/ft2build.h"]} {
447 lappend ::CSF_OPT_INC "$aPath/include/freetype2"
450 lappend anErrInc "Error: 'freetype.h' not found (FreeType2)"
457 # parse 'freetype-config --libs'
459 if { [catch { set aConfLibs [exec freetype-config --libs] } ] == 0 } {
460 foreach aPath [split $aConfLibs " "] {
461 if { [string first "-L" "$aPath"] == 0 } {
462 set aConfLibPath [string range "$aPath" 2 [string length "$aPath"]]
467 foreach anArchIter {64 32} {
468 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter"]
469 if { "$aFtLibPath" == "" } {
470 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
471 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aPath/lib"]
472 if { "$aFtLibPath" != "" } {
473 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
475 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aConfLibPath"]
476 if { "$aFtLibPath" != "" } {
477 lappend ::CSF_OPT_LIB$anArchIter "$aConfLibPath"
479 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freetype.${::SYS_LIB_SUFFIX}' not found (FreeType2)"
480 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
484 if { "$::tcl_platform(platform)" == "windows" } {
485 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter"]
486 if { "$aFtDllPath" == "" } {
487 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
488 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/bin"]
489 if { "$aFtDllPath" != "" } {
490 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
492 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/lib"]
493 if { "$aFtDllPath" != "" } {
494 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
496 lappend anErrBin$anArchIter "Error: 'freetype.dll' not found (FreeType2)"
497 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
507 # Search FreeImage library placement
508 proc wokdep:SearchFreeImage {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
509 upvar $theErrInc anErrInc
510 upvar $theErrLib32 anErrLib32
511 upvar $theErrLib64 anErrLib64
512 upvar $theErrBin32 anErrBin32
513 upvar $theErrBin64 anErrBin64
515 # binary distribution has another layout
516 set aFImageDist "Dist"
519 set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
520 if { "$aFImageHPath" == "" } {
521 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ]
522 if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] } {
523 lappend ::CSF_OPT_INC "$aPath/include"
524 } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] } {
525 lappend ::CSF_OPT_INC "$aPath/$aFImageDist"
527 lappend anErrInc "Error: 'FreeImage.h' not found (FreeImage)"
532 foreach anArchIter {64 32} {
533 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
534 if { "$aFImageLibPath" == "" } {
535 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
536 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
537 if { "$aFImageLibPath" != "" } {
538 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
540 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
541 if { "$aFImageLibPath" != "" } {
542 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist"
544 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
545 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
549 if { "$::tcl_platform(platform)" == "windows" } {
550 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"]
551 if { "$aFImageDllPath" == "" } {
552 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
553 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"]
554 if { "$aFImageDllPath" != "" } {
555 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
557 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"]
558 if { "$aFImageDllPath" != "" } {
559 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist"
561 lappend anErrBin$anArchIter "Error: 'freeimage.dll' is not found (FreeImage)"
562 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
572 # Search FFmpeg framework placement
573 proc wokdep:SearchFFmpeg {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
574 upvar $theErrInc anErrInc
575 upvar $theErrLib32 anErrLib32
576 upvar $theErrLib64 anErrLib64
577 upvar $theErrBin32 anErrBin32
578 upvar $theErrBin64 anErrBin64
581 set aFFmpegHPath [wokdep:SearchHeader "libavutil/avutil.h"]
582 if { "$aFFmpegHPath" == "" } {
583 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$::ARCH" ]
584 if { "$aPath" != "" && [file exists "$aPath/include/libavutil/avutil.h"] } {
585 lappend ::CSF_OPT_INC "$aPath/include"
587 lappend anErrInc "Error: 'libavutil/avutil.h' not found (FFmpeg)"
592 foreach anArchIter {64 32} {
593 set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter"]
594 if { "$aFFmpegLibPath" == "" } {
595 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{ffmpeg}*] "$::VCVER" "$anArchIter" ]
596 set aFFmpegLibPath [wokdep:SearchLib "avutil" "$anArchIter" "$aPath/lib"]
597 if { "$aFFmpegLibPath" != "" } {
598 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
599 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
601 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}avutil.${::SYS_LIB_SUFFIX}' not found (FFmpeg)"
602 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
610 # Search TBB library placement
611 proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
612 upvar $theErrInc anErrInc
613 upvar $theErrLib32 anErrLib32
614 upvar $theErrLib64 anErrLib64
615 upvar $theErrBin32 anErrBin32
616 upvar $theErrBin64 anErrBin64
618 # keep only two first digits in "vc141"
619 if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } {
620 set aVcLib ${::VCVER}
624 set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"]
625 if { "$aTbbHPath" == "" } {
626 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ]
627 if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } {
628 lappend ::CSF_OPT_INC "$aPath/include"
630 lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)"
635 foreach anArchIter {64 32} {
637 if { "$anArchIter" == "64"} {
638 set aSubDir "intel64"
641 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"]
642 if { "$aTbbLibPath" == "" } {
643 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
644 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/$aVcLib"]
645 if { "$aTbbLibPath" == "" } {
646 # Set the path to the TBB library for Linux
647 if { "$::tcl_platform(platform)" != "windows" } {
648 set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21"
650 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"]
651 if { "$aTbbLibPath" != "" } {
652 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir"
655 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/$aVcLib"
657 if { "$aTbbLibPath" == "" } {
658 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
659 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
662 if { "$::tcl_platform(platform)" == "windows" } {
663 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
664 if { "$aTbbDllPath" == "" } {
665 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
666 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
667 if { "$aTbbDllPath" != "" } {
668 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
670 lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
671 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
680 # Search OpenCL library placement
681 proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
682 upvar $theErrInc anErrInc
683 upvar $theErrLib32 anErrLib32
684 upvar $theErrLib64 anErrLib64
685 upvar $theErrBin32 anErrBin32
686 upvar $theErrBin64 anErrBin64
689 if { "$::tcl_platform(os)" == "Darwin" } {
690 # OpenCL framework available since Mac OS X 16
694 set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"]
695 if { "$aCLHPath" == "" } {
696 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ]
697 if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } {
698 lappend ::CSF_OPT_INC "$aPath/include"
700 lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)"
705 foreach anArchIter {64 32} {
706 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"]
707 if { "$aCLLibPath" == "" } {
708 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ]
709 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"]
710 if { "$aCLLibPath" != "" } {
711 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
713 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)"
714 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
722 # Search EGL library placement
723 proc wokdep:SearchEGL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
724 upvar $theErrInc anErrInc
725 upvar $theErrLib32 anErrLib32
726 upvar $theErrLib64 anErrLib64
727 upvar $theErrBin32 anErrBin32
728 upvar $theErrBin64 anErrBin64
731 set aHeaderPath [wokdep:SearchHeader "EGL/egl.h"]
732 if { "$aHeaderPath" == "" } {
733 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$::ARCH" ]
734 if { "$aPath" == "" || ![file exists "$aPath/include/EGL/egl.h"] } {
735 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
738 if { "$aPath" != "" && [file exists "$aPath/include/EGL/egl.h"] } {
739 lappend ::CSF_OPT_INC "$aPath/include"
741 lappend anErrInc "Error: 'EGL/egl.h' not found (EGL)"
747 if { "$::tcl_platform(platform)" == "windows" } {
749 set aLibName "libEGL"
752 foreach anArchIter {64 32} {
753 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
754 if { "$aLibPath" == "" } {
755 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
756 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
757 if { "$aLibPath" == "" } {
758 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
759 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
762 if { "$aLibPath" != "" } {
763 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
765 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (EGL)"
766 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
770 if { "$::tcl_platform(platform)" == "windows" } {
771 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter"]
772 if { "$aDllPath" == "" } {
773 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
774 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
775 if { "$aDllPath" == "" } {
776 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
777 set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
780 if { "$aDllPath" != "" } {
781 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
783 lappend anErrBin$anArchIter "Error: 'libEGL.dll' not found (EGL)"
784 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
793 # Search OpenGL ES 2.0 library placement
794 proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
795 upvar $theErrInc anErrInc
796 upvar $theErrLib32 anErrLib32
797 upvar $theErrLib64 anErrLib64
798 upvar $theErrBin32 anErrBin32
799 upvar $theErrBin64 anErrBin64
802 set aHeaderPath [wokdep:SearchHeader "GLES2/gl2.h"]
803 if { "$aHeaderPath" == "" } {
804 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$::ARCH" ]
805 if { "$aPath" == "" || ![file exists "$aPath/include/GLES2/gl2.h"] } {
806 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
809 if { "$aPath" != "" && [file exists "$aPath/include/GLES2/gl2.h"] } {
810 lappend ::CSF_OPT_INC "$aPath/include"
812 lappend anErrInc "Error: 'GLES2/gl2.h' not found (OpenGL ES 2.0)"
817 set aLibName "GLESv2"
818 if { "$::tcl_platform(platform)" == "windows" } {
820 set aLibName "libGLESv2"
823 foreach anArchIter {64 32} {
824 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
825 if { "$aLibPath" == "" } {
826 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$anArchIter" ]
827 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
828 if { "$aLibPath" == "" } {
829 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
830 set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
833 if { "$aLibPath" != "" } {
834 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
836 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (OpenGL ES 2.0)"
837 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
841 if { "$::tcl_platform(platform)" == "windows" } {
842 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter"]
843 if { "$aDllPath" == "" } {
844 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
845 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
846 if { "$aDllPath" == "" } {
847 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
848 set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
851 if { "$aDllPath" != "" } {
852 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
854 lappend anErrBin$anArchIter "Error: 'libGLESv2.dll' not found (OpenGL ES 2.0)"
855 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
864 # Search RapidJSON headers
865 proc wokdep:SearchRapidJson {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
866 upvar $theErrInc anErrInc
869 set aRJHPath [wokdep:SearchHeader "rapidjson/rapidjson.h"]
870 if { "$aRJHPath" == "" } {
871 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{rapidjson}*] "$::VCVER" "$::ARCH" ]
872 if { "$aPath" != "" && [file exists "$aPath/include/rapidjson/rapidjson.h"] } {
873 lappend ::CSF_OPT_INC "$aPath/include"
875 lappend anErrInc "Error: 'rapidjson/rapidjson.h' not found (RapidJSON)"
883 # Auxiliary function, gets VTK version to set default search directory
884 proc wokdep:VtkVersion { thePath } {
887 set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0]
888 if { "$aVtkRoot" != "" } {
889 set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot]
890 if { "$aVtkRoot" != "" } {
891 set aResult $aVtkRoot
898 # Search VTK library placement
899 proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
900 upvar $theErrInc anErrInc
901 upvar $theErrLib32 anErrLib32
902 upvar $theErrLib64 anErrLib64
903 upvar $theErrBin32 anErrBin32
904 upvar $theErrBin64 anErrBin64
909 set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"]
910 set aVtkVer [wokdep:VtkVersion $aVtkIncPath]
911 if { "$aVtkIncPath" == ""} {
912 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
913 set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ]
914 if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} {
915 set aVtkVer [wokdep:VtkVersion $aVtkPath]
916 lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]"
917 } else { # try to search in all found paths
919 foreach anIt $aPathList {
920 if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } {
922 set aVtkVer [wokdep:VtkVersion $aVtkPath]
923 lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]"
929 # Bad case: we do not found vtkConfigure.h in all paths.
930 if { "$isFound" == "false"} {
931 lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)"
938 foreach anArchIter {64 32} {
939 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"]
940 if { "$aVtkLibPath" == "" } {
941 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
942 set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ]
943 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"]
944 if { "$aVtkLibPath" != "" } {
945 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
947 set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"]
948 if { "$aPath" != "" } {
949 set aLibPath $aVtkIncPath
950 lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib"
952 # The last chance: search /lib directory in all found paths
953 foreach anIt $aPathList {
954 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"]
955 if { "$aVtkLibPath" != ""} {
956 lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib"
960 if { "$aVtkLibPath" == "" } {
961 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)"
962 if { "$::ARCH" == "$anArchIter" } {
972 if { "$::tcl_platform(platform)" == "windows" } {
973 foreach anArchIter {64 32} {
974 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
975 if { "$aVtkBinPath" == "" } {
976 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
977 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
978 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
980 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
981 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
986 # We didn't find preferred binary path => search through inc path or among all available VTK directories
987 if { "$aVtkBinPath" == "" } {
988 # Try to find in lib path
989 set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/bin"]
990 if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/bin"
991 } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/lib"] != "" } {
992 lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/lib"
994 lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
1003 # Search Qt4 libraries placement
1004 proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1005 upvar $theErrInc anErrInc
1006 upvar $theErrLib32 anErrLib32
1007 upvar $theErrLib64 anErrLib64
1008 upvar $theErrBin32 anErrBin32
1009 upvar $theErrBin64 anErrBin64
1012 set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
1013 if { "$aQMsgBoxHPath" == "" } {
1014 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
1015 if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
1016 lappend ::CSF_OPT_INC "$aPath/include"
1017 lappend ::CSF_OPT_INC "$aPath/include/Qt"
1018 lappend ::CSF_OPT_INC "$aPath/include/QtGui"
1019 lappend ::CSF_OPT_INC "$aPath/include/QtCore"
1021 if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
1022 lappend ::CSF_OPT_INC "/usr/include/qt4"
1023 lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
1024 lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
1025 lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
1027 lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
1033 set aQtGuiLibName "QtGui"
1034 if { "$::tcl_platform(platform)" == "windows" } {
1035 set aQtGuiLibName "QtGui4"
1038 foreach anArchIter {64 32} {
1039 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
1040 if { "$aQMsgBoxLibPath" == "" } {
1041 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
1042 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
1043 if { "$aQMsgBoxLibPath" != "" } {
1044 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
1046 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
1047 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1050 if { "$::tcl_platform(platform)" == "windows" } {
1051 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
1052 if { "$aQMsgBoxDllPath" == "" } {
1053 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
1054 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
1055 if { "$aQMsgBoxDllPath" != "" } {
1056 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1058 lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
1059 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1068 # Search JDK placement
1069 proc wokdep:SearchJDK {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 set aJniHPath [wokdep:SearchHeader "jni.h"]
1078 set aJniMdHPath [wokdep:SearchHeader "jni_md.h"]
1079 if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } {
1080 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ]
1081 if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } {
1082 lappend ::CSF_OPT_INC "$aPath/include"
1083 if { "$::tcl_platform(platform)" == "windows" } {
1084 lappend ::CSF_OPT_INC "$aPath/include/win32"
1085 } elseif { [file exists "$aPath/include/linux"] } {
1086 lappend ::CSF_OPT_INC "$aPath/include/linux"
1089 if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } {
1090 lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include"
1092 lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)"
1098 foreach anArchIter {64 32} {
1099 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"]
1100 if { "$aJavacPath" == "" } {
1101 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ]
1102 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"]
1103 if { "$aJavacPath" != "" } {
1104 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
1106 if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } {
1107 lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin"
1109 lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)"
1110 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
1119 # Search X11 libraries placement
1120 proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
1121 upvar $theErrInc anErrInc
1122 upvar $theErrLib32 anErrLib32
1123 upvar $theErrLib64 anErrLib64
1124 upvar $theErrBin32 anErrBin32
1125 upvar $theErrBin64 anErrBin64
1128 if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
1132 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
1133 if { "$aXmuLibPath" == "" } {
1134 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
1135 if { "$aXmuLibPath" != "" } {
1136 #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
1138 lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
1146 # Returns OCCT version string from file Standard_Version.hxx (if available)
1147 proc wokdep:DetectCasVersion {} {
1149 set aCasRoot [file normalize [file dirname [info script]]]
1150 set filename "${aCasRoot}/src/Standard/Standard_Version.hxx"
1151 if { [file exists $filename] } {
1152 set fh [open $filename "r"]
1153 set fh_loaded [read $fh]
1155 regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver
1157 puts "Error: file '$filename' not found"
1162 # Generate (override) custom environment file
1163 proc wokdep:SaveCustom {} {
1164 set aGenInfo "This environment file was generated by genconf.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
1165 if { "$::tcl_platform(platform)" == "windows" } {
1166 set aCustomFilePath "./custom.bat"
1167 set aFile [open $aCustomFilePath "w"]
1168 puts $aFile "@echo off"
1169 puts $aFile "rem $aGenInfo"
1172 puts $aFile "set PRJFMT=$::PRJFMT"
1173 puts $aFile "set VCVER=$::VCVER"
1174 puts $aFile "set ARCH=$::ARCH"
1175 puts $aFile "set VCVARS=$::VCVARS"
1176 puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1179 puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\""
1182 puts $aFile "rem Optional 3rd-parties switches"
1183 foreach anEnvIter $::THE_ENV_VARIABLES {
1184 set aName ${anEnvIter}
1185 set aValue [set ::${anEnvIter}]
1186 if { "$aValue" != "" } {
1187 puts $aFile "set ${aName}=$aValue"
1191 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1192 if { "$::PRODUCTS_PATH" != "" } {
1193 set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "%PRODUCTS_PATH%"]
1196 puts $aFile "rem Additional headers search paths"
1197 puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
1199 set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
1200 if { "$::PRODUCTS_PATH" != "" } {
1201 set aStringLib32 [regsub -all "$::PRODUCTS_PATH" $aStringLib32 "%PRODUCTS_PATH%"]
1204 puts $aFile "rem Additional libraries (32-bit) search paths"
1205 puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
1207 set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
1208 if { "$::PRODUCTS_PATH" != "" } {
1209 set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"]
1212 puts $aFile "rem Additional libraries (64-bit) search paths"
1213 puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
1215 set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
1216 if { "$::PRODUCTS_PATH" != "" } {
1217 set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"]
1220 puts $aFile "rem Additional (32-bit) search paths"
1221 puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
1223 set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
1224 if { "$::PRODUCTS_PATH" != "" } {
1225 set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"]
1228 puts $aFile "rem Additional (64-bit) search paths"
1229 puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
1233 set aCustomFilePath "./custom.sh"
1234 set aFile [open $aCustomFilePath "w"]
1235 puts $aFile "#!/bin/bash"
1236 puts $aFile "# $aGenInfo"
1239 puts $aFile "export PRJFMT=$::PRJFMT"
1240 puts $aFile "export ARCH=$::ARCH"
1241 puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
1244 puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1247 puts $aFile "# Optional 3rd-parties switches"
1248 foreach anEnvIter $::THE_ENV_VARIABLES {
1249 set aName ${anEnvIter}
1250 set aValue [set ::${anEnvIter}]
1251 if { "$aValue" != "" } {
1252 puts $aFile "export ${aName}=${aValue}"
1256 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1257 if { "$::PRODUCTS_PATH" != "" } {
1258 set aStringInc [regsub -all "$::PRODUCTS_PATH" $aStringInc "\${PRODUCTS_PATH}"]
1261 puts $aFile "# Additional headers search paths"
1262 puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
1264 set aStringLib [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
1265 if { "$::PRODUCTS_PATH" != "" } {
1266 set aStringLib [regsub -all "$::PRODUCTS_PATH" $aStringLib "\${PRODUCTS_PATH}"]
1269 puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
1270 puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\""
1272 set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
1273 if { "$::PRODUCTS_PATH" != "" } {
1274 set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"]
1277 puts $aFile "# Additional ($::ARCH-bit) search paths"
1278 puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\""
1282 puts "Configuration saved to file '$aCustomFilePath'"
1284 # generate custom.auto.pri
1285 set toExportCustomPri 1
1286 if { $toExportCustomPri == 1 } {
1287 set aCasVer [wokdep:DetectCasVersion]
1288 set aCustomFilePath "./adm/qmake/custom.auto.pri"
1289 set aFile [open $aCustomFilePath "w"]
1290 puts $aFile "# $aGenInfo"
1293 puts $aFile "VERSION=$aCasVer"
1294 puts $aFile "PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
1297 puts $aFile "# Optional 3rd-parties switches"
1298 foreach anEnvIter $::THE_ENV_VARIABLES {
1299 set aName ${anEnvIter}
1300 set aValue [set ::${anEnvIter}]
1301 if { "$aValue" == "true" } {
1302 puts $aFile "CONFIG += ${aName}"
1304 #puts $aFile "CONFIG -= ${aName}"
1309 puts $aFile "# Additional headers search paths"
1310 foreach anIncPath $::CSF_OPT_INC {
1311 if { "$::PRODUCTS_PATH" != "" } {
1312 set anIncPath [regsub -all "$::PRODUCTS_PATH" $anIncPath "\$\$\{PRODUCTS_PATH\}"]
1314 puts $aFile "INCLUDEPATH += \"${anIncPath}\""
1318 puts $aFile "# Additional libraries search paths"
1319 foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] {
1320 if { "$::PRODUCTS_PATH" != "" } {
1321 set aLibPath [regsub -all "$::PRODUCTS_PATH" $aLibPath "\$\$\{PRODUCTS_PATH\}"]
1323 puts $aFile "LIBS += -L\"${aLibPath}\""
1326 if { "$::tcl_platform(platform)" == "windows" } {
1328 puts $aFile "# Additional DLLs search paths"
1329 foreach aDllPath [set ::CSF_OPT_BIN$::ARCH] {
1330 if { "$::PRODUCTS_PATH" != "" } {
1331 set aDllPath [regsub -all "$::PRODUCTS_PATH" $aDllPath "\$\$\{PRODUCTS_PATH\}"]
1333 puts $aFile "LIBS += -L\"${aDllPath}\""
1339 puts "Configuration saved to file '$aCustomFilePath'"