0024786: Move functionality of WOK command wgenproj to OCCT tool genproj
[occt.git] / adm / genconfdeps.tcl
CommitLineData
910970ab 1#!/usr/bin/tclsh
2
3set ARCH "32"
4
5if { "$tcl_platform(platform)" == "unix" } {
6 set SYS_PATH_SPLITTER ":"
7 set SYS_LIB_PREFIX "lib"
8 set SYS_EXE_SUFFIX ""
9 if { "$tcl_platform(os)" == "Darwin" } {
10 set SYS_LIB_SUFFIX "dylib"
11 } else {
12 set SYS_LIB_SUFFIX "so"
13 }
14 set VCVER "gcc"
15 set VCVARS ""
16} elseif { "$tcl_platform(platform)" == "windows" } {
17 set SYS_PATH_SPLITTER ";"
18 set SYS_LIB_PREFIX ""
19 set SYS_LIB_SUFFIX "lib"
20 set SYS_EXE_SUFFIX ".exe"
21 set VCVER "vc10"
22 set VCVARS ""
23}
24
25set SHORTCUT_HEADERS "true"
26
27set HAVE_FREEIMAGE "false"
28set HAVE_GL2PS "false"
29set HAVE_TBB "false"
30set HAVE_OPENCL "false"
31set HAVE_VTK "false"
32set MACOSX_USE_GLX "false"
33set CHECK_QT4 "false"
34set CHECK_JDK "false"
35set PRODUCTS_PATH ""
36set CSF_OPT_INC [list]
37set CSF_OPT_LIB32 [list]
38set CSF_OPT_LIB64 [list]
39set CSF_OPT_BIN32 [list]
40set CSF_OPT_BIN64 [list]
41
42if { [info exists ::env(ARCH)] } {
43 set ARCH "$::env(ARCH)"
44}
45if { [info exists ::env(VCVER)] } {
46 set VCVER "$::env(VCVER)"
47}
48if { [info exists ::env(VCVARS)] } {
49 set VCVARS "$::env(VCVARS)"
50}
51if { [info exists ::env(SHORTCUT_HEADERS)] } {
52 set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
53}
54if { [info exists ::env(HAVE_FREEIMAGE)] } {
55 set HAVE_FREEIMAGE "$::env(HAVE_FREEIMAGE)"
56}
57if { [info exists ::env(HAVE_GL2PS)] } {
58 set HAVE_GL2PS "$::env(HAVE_GL2PS)"
59}
60if { [info exists ::env(HAVE_TBB)] } {
61 set HAVE_TBB "$::env(HAVE_TBB)"
62}
63if { [info exists ::env(HAVE_OPENCL)] } {
64 set HAVE_OPENCL "$::env(HAVE_OPENCL)"
65}
66if { [info exists ::env(HAVE_VTK)] } {
67 set HAVE_VTK "$::env(HAVE_VTK)"
68}
69if { [info exists ::env(MACOSX_USE_GLX)] } {
70 set MACOSX_USE_GLX "$::env(MACOSX_USE_GLX)"
71}
72if { [info exists ::env(CHECK_QT4)] } {
73 set CHECK_QT4 "$::env(CHECK_QT4)"
74}
75if { [info exists ::env(CHECK_JDK)] } {
76 set CHECK_JDK "$::env(CHECK_JDK)"
77}
78if { [info exists ::env(PRODUCTS_PATH)] } {
79 set PRODUCTS_PATH "$::env(PRODUCTS_PATH)"
80}
81if { [info exists ::env(CSF_OPT_INC)] } {
82 set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER]
83}
84if { [info exists ::env(CSF_OPT_LIB32)] } {
85 set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER]
86}
87if { [info exists ::env(CSF_OPT_LIB64)] } {
88 set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER]
89}
90if { [info exists ::env(CSF_OPT_BIN32)] } {
91 set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER]
92}
93if { [info exists ::env(CSF_OPT_BIN64)] } {
94 set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER]
95}
96
97# Search header file in $::CSF_OPT_INC and standard paths
98proc wokdep:SearchHeader {theHeader} {
99 # search in custom paths
100 foreach anIncPath $::CSF_OPT_INC {
101 set aPath "${anIncPath}/${theHeader}"
102 if { [file exists "$aPath"] } {
103 return "$aPath"
104 }
105 }
106
107 # search in system
108 set aPath "/usr/include/${theHeader}"
109 if { [file exists "$aPath"] } {
110 return "$aPath"
111 }
112 return ""
113}
114
115# Search library file in $::CSF_OPT_LIB* and standard paths
116proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} {
117 if { "$theSearchPath" != "" } {
118 set aPath "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
119 if { [file exists "$aPath"] } {
120 return "$aPath"
121 } else {
122 return ""
123 }
124 }
125
126 # search in custom paths
127 foreach aLibPath [set ::CSF_OPT_LIB$theBitness] {
128 set aPath "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
129 if { [file exists "$aPath"] } {
130 return "$aPath"
131 }
132 }
133
134 # search in system
135 if { "$::ARCH" == "$theBitness"} {
136 set aPath "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}"
137 if { [file exists "$aPath"] } {
138 return "$aPath"
139 }
140 }
141
142 if { "$::tcl_platform(platform)" == "linux" } {
143 if { "$theBitness" == "64" } {
144 set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so"
145 if { [file exists "$aPath"] } {
146 return "$aPath"
147 }
148 } else {
149 set aPath "/usr/lib/i386-linux-gnu/lib${theLib}.so"
150 if { [file exists "$aPath"] } {
151 return "$aPath"
152 }
153 }
154 }
155
156 return ""
157}
158
159# Search file in $::CSF_OPT_BIN* and standard paths
160proc wokdep:SearchBin {theBin theBitness {theSearchPath ""}} {
161 if { "$theSearchPath" != "" } {
162 set aPath "${theSearchPath}/${theBin}"
163 if { [file exists "$aPath"] } {
164 return "$aPath"
165 } else {
166 return ""
167 }
168 }
169
170 # search in custom paths
171 foreach aBinPath [set ::CSF_OPT_BIN$theBitness] {
172 set aPath "${aBinPath}/${theBin}"
173 if { [file exists "$aPath"] } {
174 return "$aPath"
175 }
176 }
177
178 # search in system
179 if { "$::ARCH" == "$theBitness"} {
180 set aPath "/usr/bin/${theBin}"
181 if { [file exists "$aPath"] } {
182 return "$aPath"
183 }
184 }
185
186 return ""
187}
188
189# Detect compiler C-runtime version 'vc*' and architecture '32'/'64'
190# to determine preferred path.
191proc wokdep:Preferred {theList theCmpl theArch} {
192 if { [llength $theList] == 0 } {
193 return ""
194 }
195
196 set aShortList {}
197 foreach aPath $theList {
198 if { [string first "$theCmpl" "$aPath"] != "-1" } {
199 lappend aShortList "$aPath"
200 }
201 }
202
203 if { [llength $aShortList] == 0 } {
204 #return [lindex $theList 0]
205 set aShortList $theList
206 }
207
208 set aVeryShortList {}
209 foreach aPath $aShortList {
210 if { [string first "$theArch" "$aPath"] != "-1" } {
211 lappend aVeryShortList "$aPath"
212 }
213 }
214 if { [llength $aVeryShortList] == 0 } {
215 return [lindex [lsort -decreasing $aShortList] 0]
216 }
217
218 return [lindex [lsort -decreasing $aVeryShortList] 0]
219}
220
221# Search Tcl/Tk libraries placement
222proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
223 upvar $theErrInc anErrInc
224 upvar $theErrLib32 anErrLib32
225 upvar $theErrLib64 anErrLib64
226 upvar $theErrBin32 anErrBin32
227 upvar $theErrBin64 anErrBin64
228
229 set tclver_maj 8
230 set tclver_min 6
231
232 set isFound "true"
233 set aTclHPath [wokdep:SearchHeader "tcl.h"]
234 set aTkHPath [wokdep:SearchHeader "tk.h"]
235 if { "$aTclHPath" == "" || "$aTkHPath" == "" } {
236 if { [file exists "/usr/include/tcl8.6/tcl.h"]
237 && [file exists "/usr/include/tcl8.6/tk.h" ] } {
238 lappend ::CSF_OPT_INC "/usr/include/tcl8.6"
239 set aTclHPath "/usr/include/tcl8.6/tcl.h"
240 } else {
241 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ]
242 if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } {
243 lappend ::CSF_OPT_INC "$aPath/include"
244 set aTclHPath "$aPath/include/tcl.h"
245 } else {
246 lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)"
247 set isFound "false"
248 }
249 }
250 }
251
252 # detect tcl version by parsing header file
253 if { $isFound } {
254 set fh [open $aTclHPath]
255 set tcl_h [read $fh]
256 close $fh
257 regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj
258 regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min
259 }
260
261 if { "$::tcl_platform(platform)" == "windows" } {
262 set aTclLibName "tcl${tclver_maj}${tclver_min}"
263 set aTkLibName "tk${tclver_maj}${tclver_min}"
264 } else {
265 set aTclLibName "tcl${tclver_maj}.${tclver_min}"
266 set aTkLibName "tk${tclver_maj}.${tclver_min}"
267 }
268
269 foreach anArchIter {64 32} {
270 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter"]
271 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter"]
272 if { "$aTclLibPath" == "" || "$aTkLibPath" == "" } {
273 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
274 set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter" "$aPath/lib"]
275 set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter" "$aPath/lib"]
276 if { "$aTclLibPath" != "" && "$aTkLibPath" != "" } {
277 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
278 } else {
279 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aTclLibName}.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}${aTkLibName}.${::SYS_LIB_SUFFIX}' not found (Tcl/Tk)"
280 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
281 }
282 }
283
284 if { "$::tcl_platform(platform)" == "windows" } {
285 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter"]
286 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter"]
287 if { "$aTclDllPath" == "" || "$aTkDllPath" == "" } {
288 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ]
289 set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter" "$aPath/bin"]
290 set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter" "$aPath/bin"]
291 if { "$aTclDllPath" != "" && "$aTkDllPath" != "" } {
292 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
293 } else {
294 lappend anErrBin$anArchIter "Error: '${aTclLibName}.dll' or '${aTkLibName}.dll' not found (Tcl/Tk)"
295 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
296 }
297 }
298 }
299 }
300
301 return "$isFound"
302}
303
304# Search FreeType library placement
305proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
306 upvar $theErrInc anErrInc
307 upvar $theErrLib32 anErrLib32
308 upvar $theErrLib64 anErrLib64
309 upvar $theErrBin32 anErrBin32
310 upvar $theErrBin64 anErrBin64
311
312 set isFound "true"
313 set aFtBuildPath [wokdep:SearchHeader "ft2build.h"]
314
315 # new layout of headers in Freetype 2.5.x
316 if { "$aFtBuildPath" == "" } {
317 set aFtBuildPath [wokdep:SearchHeader "freetype2/ft2build.h"]
318 }
319
320 if { "$aFtBuildPath" == "" } {
321 # TODO - use `freetype-config --cflags` instead
322 set aSysFreeType "/usr/include/freetype2"
323 if { [file exists "$aSysFreeType/ftbuild.h"] } {
324 lappend ::CSF_OPT_INC "$aSysFreeType"
325 } elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } {
326 lappend ::CSF_OPT_INC "$aSysFreeType/freetype2"
327 } else {
328 set aSysFreeType "/usr/X11/include/freetype2"
329 if { [file exists "$aSysFreeType/ft2build.h"] } {
330 lappend ::CSF_OPT_INC "/usr/X11/include"
331 lappend ::CSF_OPT_INC "$aSysFreeType"
332 } else {
333 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$::ARCH" ]
334 if {"$aPath" != ""} {
335 if {[file exists "$aPath/include/ft2build.h"]} {
336 lappend ::CSF_OPT_INC "$aPath/include"
337 } elseif {[file exists "$aPath/include/freetype2/ft2build.h"]} {
338 lappend ::CSF_OPT_INC "$aPath/include/freetype2"
339 }
340 } else {
341 lappend anErrInc "Error: 'freetype.h' not found (FreeType2)"
342 set isFound "false"
343 }
344 }
345 }
346 }
347
348 # parse 'freetype-config --libs'
349 set aConfLibPath ""
350 if { [catch { set aConfLibs [exec freetype-config --libs] } ] == 0 } {
351 foreach aPath [split $aConfLibs " "] {
352 if { [string first "-L" "$aPath"] == 0 } {
353 set aConfLibPath [string range "$aPath" 2 [string length "$aPath"]]
354 }
355 }
356 }
357
358 foreach anArchIter {64 32} {
359 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter"]
360 if { "$aFtLibPath" == "" } {
361 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
362 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aPath/lib"]
363 if { "$aFtLibPath" != "" } {
364 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
365 } else {
366 set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aConfLibPath"]
367 if { "$aFtLibPath" != "" } {
368 lappend ::CSF_OPT_LIB$anArchIter "$aConfLibPath"
369 } else {
370 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freetype.${::SYS_LIB_SUFFIX}' not found (FreeType2)"
371 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
372 }
373 }
374 }
375 if { "$::tcl_platform(platform)" == "windows" } {
376 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter"]
377 if { "$aFtDllPath" == "" } {
378 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ]
379 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/bin"]
380 if { "$aFtDllPath" != "" } {
381 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
382 } else {
383 set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/lib"]
384 if { "$aFtDllPath" != "" } {
385 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
386 } else {
387 lappend anErrBin$anArchIter "Error: 'freetype.dll' not found (FreeType2)"
388 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
389 }
390 }
391 }
392 }
393 }
394
395 return "$isFound"
396}
397
398# Search FreeImage library placement
399proc wokdep:SearchFreeImage {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
400 upvar $theErrInc anErrInc
401 upvar $theErrLib32 anErrLib32
402 upvar $theErrLib64 anErrLib64
403 upvar $theErrBin32 anErrBin32
404 upvar $theErrBin64 anErrBin64
405
406 # binary distribution has another layout
407 set aFImageDist "Dist"
408 set aFImagePlusDist "Wrapper/FreeImagePlus/dist"
409
410 set isFound "true"
411 set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
412 set aFImagePlusHPath [wokdep:SearchHeader "FreeImagePlus.h"]
413 if { "$aFImageHPath" == "" || "$aFImagePlusHPath" == "" } {
414 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ]
415 if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] && [file exists "$aPath/include/FreeImagePlus.h"] } {
416 lappend ::CSF_OPT_INC "$aPath/include"
417 } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] && [file exists "$aPath/$aFImagePlusDist/FreeImagePlus.h"] } {
418 lappend ::CSF_OPT_INC "$aPath/$aFImageDist"
419 lappend ::CSF_OPT_INC "$aPath/$aFImagePlusDist"
420 } else {
421 lappend anErrInc "Error: 'FreeImage.h' or 'FreeImagePlus.h' not found (FreeImage)"
422 set isFound "false"
423 }
424 }
425
426 foreach anArchIter {64 32} {
427 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
428 set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter"]
429 if { "$aFImageLibPath" == "" || "$aFImagePlusLibPath" == "" } {
430 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
431 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
432 set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter" "$aPath/lib"]
433 if { "$aFImageLibPath" != "" && "$aFImagePlusLibPath" != "" } {
434 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
435 } else {
436 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
437 set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter" "$aPath/$aFImagePlusDist"]
438 if { "$aFImageLibPath" != "" && "$aFImagePlusLibPath" != "" } {
439 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist"
440 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImagePlusDist"
441 } else {
442 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}freeimageplus.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
443 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
444 }
445 }
446 }
447 if { "$::tcl_platform(platform)" == "windows" } {
448 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"]
449 set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter"]
450 if { "$aFImageDllPath" == "" || "$aFImagePlusDllPath" == "" } {
451 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
452 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"]
453 set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter" "$aPath/bin"]
454 if { "$aFImageDllPath" != "" && "$aFImagePlusDllPath" != "" } {
455 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
456 } else {
457 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"]
458 set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter" "$aPath/$aFImagePlusDist"]
459 if { "$aFImageDllPath" != "" && "$aFImagePlusDllPath" != "" } {
460 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist"
461 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImagePlusDist"
462 } else {
463 lappend anErrBin$anArchIter "Error: 'freeimage.dll' or 'freeimageplus.dll' not found (FreeImage)"
464 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
465 }
466 }
467 }
468 }
469 }
470
471 return "$isFound"
472}
473
474# Search GL2PS library placement
475proc wokdep:SearchGL2PS {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
476 upvar $theErrInc anErrInc
477 upvar $theErrLib32 anErrLib32
478 upvar $theErrLib64 anErrLib64
479 upvar $theErrBin32 anErrBin32
480 upvar $theErrBin64 anErrBin64
481
482 set isFound "true"
483 set aGl2psHPath [wokdep:SearchHeader "gl2ps.h"]
484 if { "$aGl2psHPath" == "" } {
485 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$::ARCH" ]
486 if { "$aPath" != "" && [file exists "$aPath/include/gl2ps.h"] } {
487 lappend ::CSF_OPT_INC "$aPath/include"
488 } else {
489 lappend anErrInc "Error: 'gl2ps.h' not found (GL2PS)"
490 set isFound "false"
491 }
492 }
493
494 foreach anArchIter {64 32} {
495 set aGl2psLibPath [wokdep:SearchLib "gl2ps" "$anArchIter"]
496 if { "$aGl2psLibPath" == "" } {
497 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$anArchIter" ]
498 set aGl2psLibPath [wokdep:SearchLib "gl2ps" "$anArchIter" "$aPath/lib"]
499 if { "$aGl2psLibPath" != "" } {
500 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
501 } else {
502 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}gl2ps.${::SYS_LIB_SUFFIX}' not found (GL2PS)"
503 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
504 }
505 }
506 if { "$::tcl_platform(platform)" == "windows" } {
507 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter"]
508 if { "$aGl2psDllPath" == "" } {
509 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$anArchIter" ]
510 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter" "$aPath/bin"]
511 if { "$aGl2psDllPath" != "" } {
512 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
513 } else {
514 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter" "$aPath/lib"]
515 if { "$aGl2psDllPath" != "" } {
516 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
517 } else {
518 lappend anErrBin$anArchIter "Error: 'gl2ps.dll' not found (GL2PS)"
519 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
520 }
521 }
522 }
523 }
524 }
525
526 return "$isFound"
527}
528
529# Search TBB library placement
530proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
531 upvar $theErrInc anErrInc
532 upvar $theErrLib32 anErrLib32
533 upvar $theErrLib64 anErrLib64
534 upvar $theErrBin32 anErrBin32
535 upvar $theErrBin64 anErrBin64
536
537 set isFound "true"
538 set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"]
539 if { "$aTbbHPath" == "" } {
540 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ]
541 if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } {
542 lappend ::CSF_OPT_INC "$aPath/include"
543 } else {
544 lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)"
545 set isFound "false"
546 }
547 }
548
549 foreach anArchIter {64 32} {
550 set aSubDir "ia32"
551 if { "$anArchIter" == "64"} {
552 set aSubDir "intel64"
553 }
554
555 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"]
556 if { "$aTbbLibPath" == "" } {
557 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
558 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/${::VCVER}"]
559 if { "$aTbbLibPath" == "" } {
560 # Set the path to the TBB library for Linux
561 if { "$::tcl_platform(platform)" != "windows" } {
562 set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21"
563 }
564 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"]
565 if { "$aTbbLibPath" != "" } {
566 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir"
567 }
568 } else {
569 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/${::VCVER}"
570 }
571 if { "$aTbbLibPath" == "" } {
572 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
573 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
574 }
575 }
576 if { "$::tcl_platform(platform)" == "windows" } {
577 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
578 if { "$aTbbDllPath" == "" } {
579 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
580 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/${::VCVER}"]
581 if { "$aTbbDllPath" != "" } {
582 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/${::VCVER}"
583 } else {
584 lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
585 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
586 }
587 }
588 }
589 }
590
591 return "$isFound"
592}
593
594# Search OpenCL library placement
595proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
596 upvar $theErrInc anErrInc
597 upvar $theErrLib32 anErrLib32
598 upvar $theErrLib64 anErrLib64
599 upvar $theErrBin32 anErrBin32
600 upvar $theErrBin64 anErrBin64
601
602 set isFound "true"
603 if { "$::tcl_platform(os)" == "Darwin" } {
604 # OpenCL framework available since Mac OS X 16
605 return "$isFound"
606 }
607
608 set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"]
609 if { "$aCLHPath" == "" } {
610 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ]
611 if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } {
612 lappend ::CSF_OPT_INC "$aPath/include"
613 } else {
614 lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)"
615 set isFound "false"
616 }
617 }
618
619 foreach anArchIter {64 32} {
620 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"]
621 if { "$aCLLibPath" == "" } {
622 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ]
623 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"]
624 if { "$aCLLibPath" != "" } {
625 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
626 } else {
627 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)"
628 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
629 }
630 }
631 }
632
633 return "$isFound"
634}
635
636# Auxiliary function, gets VTK version to set default search directory
637proc wokdep:VtkVersion { thePath } {
638 set aResult "6.1"
639
640 set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0]
641 if { "$aVtkRoot" != "" } {
642 set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot]
643 if { "$aVtkRoot" != "" } {
644 set aResult $aVtkRoot
645 }
646 }
647
648 return $aResult
649}
650
651# Search VTK library placement
652proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
653 upvar $theErrInc anErrInc
654 upvar $theErrLib32 anErrLib32
655 upvar $theErrLib64 anErrLib64
656 upvar $theErrBin32 anErrBin32
657 upvar $theErrBin64 anErrBin64
658
659 set isFound "true"
660
661 set aVtkPath ""
662 set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"]
663 set aVtkVer [wokdep:VtkVersion $aVtkIncPath]
664 if { "$aVtkIncPath" == ""} {
665 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
666 set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ]
667 if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} {
668 set aVtkVer [wokdep:VtkVersion $aVtkPath]
669 lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]"
670 } else { # try to search in all found paths
671 set isFound "false"
672 foreach anIt $aPathList {
673 if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } {
674 set aVtkPath $anIt
675 set aVtkVer [wokdep:VtkVersion $aVtkPath]
676 lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]"
677 set isFound "true"
678 break
679 }
680 }
681
682 # Bad case: we do not found vtkConfigure.h in all paths.
683 if { "$isFound" == "false"} {
684 lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)"
685 set isFound "false"
686 }
687 }
688 }
689
690 set aVtkLibPath ""
691 foreach anArchIter {64 32} {
692 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"]
693 if { "$aVtkLibPath" == "" } {
694 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
695 set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ]
696 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"]
697 if { "$aVtkLibPath" != "" } {
698 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
699 } else {
700 set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"]
701 if { "$aPath" != "" } {
702 set aLibPath $aVtkIncPath
703 lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib"
704 } else {
705 # The last chance: search /lib directory in all found paths
706 foreach anIt $aPathList {
707 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"]
708 if { "$aVtkLibPath" != ""} {
709 lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib"
710 break
711 }
712 }
713 if { "$aVtkLibPath" == "" } {
714 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)"
715 if { "$::ARCH" == "$anArchIter" } {
716 set isFound "false"
717 }
718 }
719 }
720 }
721 }
722 }
723
724 # Search binary path
725 if { "$::tcl_platform(platform)" == "windows" } {
726 foreach anArchIter {64 32} {
727 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
728 if { "$aVtkBinPath" == "" } {
729 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
730 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
731 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
732 } else {
733 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
734 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
735 }
736 }
737 }
738
739 # We didn't find preferred binary path => search through inc path or among all available VTK directories
740 if { "$aVtkBinPath" == "" } {
741 # Try to find in lib path
742 set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aLibPath/bin"]
743 if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aLibPath/bin"
744 } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aLibPath/lib"] != "" } {
745 lappend ::CSF_OPT_BIN$anArchIter "$aLibPath/lib"
746 } else {
747 lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
748 set isFound "false"
749 }
750 }
751 }
752
753 return "$isFound"
754}
755
756# Search Qt4 libraries placement
757proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
758 upvar $theErrInc anErrInc
759 upvar $theErrLib32 anErrLib32
760 upvar $theErrLib64 anErrLib64
761 upvar $theErrBin32 anErrBin32
762 upvar $theErrBin64 anErrBin64
763
764 set isFound "true"
765 set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
766 if { "$aQMsgBoxHPath" == "" } {
767 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
768 if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
769 lappend ::CSF_OPT_INC "$aPath/include"
770 lappend ::CSF_OPT_INC "$aPath/include/Qt"
771 lappend ::CSF_OPT_INC "$aPath/include/QtGui"
772 lappend ::CSF_OPT_INC "$aPath/include/QtCore"
773 } else {
774 if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
775 lappend ::CSF_OPT_INC "/usr/include/qt4"
776 lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
777 lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
778 lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
779 } else {
780 lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
781 set isFound "false"
782 }
783 }
784 }
785
786 set aQtGuiLibName "QtGui"
787 if { "$::tcl_platform(platform)" == "windows" } {
788 set aQtGuiLibName "QtGui4"
789 }
790
791 foreach anArchIter {64 32} {
792 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
793 if { "$aQMsgBoxLibPath" == "" } {
794 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
795 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
796 if { "$aQMsgBoxLibPath" != "" } {
797 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
798 } else {
799 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
800 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
801 }
802 }
803 if { "$::tcl_platform(platform)" == "windows" } {
804 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
805 if { "$aQMsgBoxDllPath" == "" } {
806 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
807 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
808 if { "$aQMsgBoxDllPath" != "" } {
809 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
810 } else {
811 lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
812 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
813 }
814 }
815 }
816 }
817
818 return "$isFound"
819}
820
821# Search JDK placement
822proc wokdep:SearchJDK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
823 upvar $theErrInc anErrInc
824 upvar $theErrLib32 anErrLib32
825 upvar $theErrLib64 anErrLib64
826 upvar $theErrBin32 anErrBin32
827 upvar $theErrBin64 anErrBin64
828
829 set isFound "true"
830 set aJniHPath [wokdep:SearchHeader "jni.h"]
831 set aJniMdHPath [wokdep:SearchHeader "jni_md.h"]
832 if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } {
833 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ]
834 if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } {
835 lappend ::CSF_OPT_INC "$aPath/include"
836 if { "$::tcl_platform(platform)" == "windows" } {
837 lappend ::CSF_OPT_INC "$aPath/include/win32"
838 } elseif { [file exists "$aPath/include/linux"] } {
839 lappend ::CSF_OPT_INC "$aPath/include/linux"
840 }
841 } else {
842 if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } {
843 lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include"
844 } else {
845 lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)"
846 set isFound "false"
847 }
848 }
849 }
850
851 foreach anArchIter {64 32} {
852 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"]
853 if { "$aJavacPath" == "" } {
854 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ]
855 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"]
856 if { "$aJavacPath" != "" } {
857 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
858 } else {
859 if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } {
860 lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin"
861 } else {
862 lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)"
863 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
864 }
865 }
866 }
867 }
868
869 return "$isFound"
870}
871
872# Search X11 libraries placement
873proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
874 upvar $theErrInc anErrInc
875 upvar $theErrLib32 anErrLib32
876 upvar $theErrLib64 anErrLib64
877 upvar $theErrBin32 anErrBin32
878 upvar $theErrBin64 anErrBin64
879
880 set isFound "true"
881 if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
882 return "$isFound"
883 }
884
885 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
886 if { "$aXmuLibPath" == "" } {
887 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
888 if { "$aXmuLibPath" != "" } {
889 #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
890 } else {
891 lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
892 set isFound "false"
893 }
894 }
895
896 return "$isFound"
897}
898
899# Generate (override) custom environment file
900proc wokdep:SaveCustom {} {
901 if { "$::tcl_platform(platform)" == "windows" } {
902 set aCustomFilePath "./custom.bat"
903 set aFile [open $aCustomFilePath "w"]
904 puts $aFile "@echo off"
905 puts $aFile "rem This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
906
907 puts $aFile ""
908 puts $aFile "set VCVER=$::VCVER"
909 puts $aFile "set ARCH=$::ARCH"
910 puts $aFile "set VCVARS=$::VCVARS"
911 puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
912
913 puts $aFile ""
914 puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\""
915
916 puts $aFile ""
917 puts $aFile "rem Optional 3rd-parties switches"
918 puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
919 puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS"
920 puts $aFile "set HAVE_TBB=$::HAVE_TBB"
921 puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL"
922 puts $aFile "set HAVE_VTK=$::HAVE_VTK"
923 puts $aFile "set CHECK_QT4=$::CHECK_QT4"
924 puts $aFile "set CHECK_JDK=$::CHECK_JDK"
925
926 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
927 puts $aFile ""
928 puts $aFile "rem Additional headers search paths"
929 puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
930
931 set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
932 puts $aFile ""
933 puts $aFile "rem Additional libraries (32-bit) search paths"
934 puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
935
936 set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
937 puts $aFile ""
938 puts $aFile "rem Additional libraries (64-bit) search paths"
939 puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
940
941 set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
942 puts $aFile ""
943 puts $aFile "rem Additional (32-bit) search paths"
944 puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
945
946 set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
947 puts $aFile ""
948 puts $aFile "rem Additional (64-bit) search paths"
949 puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
950
951 close $aFile
952 } else {
953 set aCustomFilePath "./custom.sh"
954 set aFile [open $aCustomFilePath "w"]
955 puts $aFile "#!/bin/bash"
956 puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
957
958 #puts $aFile ""
959 #puts $aFile "export ARCH=$::ARCH"
960
961 puts $aFile ""
962 puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
963
964 puts $aFile ""
965 puts $aFile "# Optional 3rd-parties switches"
966 puts $aFile "export HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
967 puts $aFile "export HAVE_GL2PS=$::HAVE_GL2PS"
968 puts $aFile "export HAVE_TBB=$::HAVE_TBB"
969 puts $aFile "export HAVE_OPENCL=$::HAVE_OPENCL"
970 puts $aFile "export HAVE_VTK=$::HAVE_VTK"
971 if { "$::tcl_platform(os)" == "Darwin" } {
972 puts $aFile "export MACOSX_USE_GLX=$::MACOSX_USE_GLX"
973 }
974 puts $aFile "export CHECK_QT4=$::CHECK_QT4"
975 puts $aFile "export CHECK_JDK=$::CHECK_JDK"
976
977 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
978 puts $aFile ""
979 puts $aFile "# Additional headers search paths"
980 puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
981
982 set aStringLib$::ARCH [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
983 puts $aFile ""
984 puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
985 puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib$::ARCH]\""
986
987 set aStringBin$::ARCH [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
988 puts $aFile ""
989 puts $aFile "# Additional ($::ARCH-bit) search paths"
990 puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin$::ARCH]\""
991
992 close $aFile
993 }
994
995 puts "Configuration saved to file '$aCustomFilePath'"
996}