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