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